| 
            
            ocssw
            
             V2022
            
            
           | 
         
#include <math.h>#include <stdio.h>#include "filehandle.h"#include "l12_proto.h"#include "l2_struc.h"Go to the source code of this file.
Classes | |
| struct | Temp_merra_data | 
| struct | Rho_dims | 
| struct | Td_dims | 
| struct | Tg_dims | 
| struct | Dobson_dims | 
| struct | WaterVapor_dims | 
| struct | Surface_Ocean_Alebedo | 
| struct | Scalar_PAR_MU_Cosine | 
| struct | Scalar_PAR_Inst | 
| struct | LUTs_data | 
Macros | |
| #define | NMODEL 12 | 
| #define | NPHASE 75 | 
| #define | EARTH_SURF_PRESSURE 1013.15f | 
| #define | TAU_550_LOW_BOUND 0.1f | 
| #define | ANGSTROM_DEFAULT_VALUE 0.2537f | 
| #define | MAXGLINT 0.05 | 
| #define | MAXHOURS 48 | 
| #define | EINSTEIN 1.193 | 
| #define | MAX_SOLZEN 89.5f | 
| #define | PAR_0 176.323f | 
| #define | PAR_0_2023 176.41f | 
| #define | TAUCONS_LOW 15.0f | 
| #define | TAUCONS_HIGH 300.0f | 
Functions | |
| size_t | search (const float *arr, size_t s, size_t e, float val, size_t *i_s, size_t *i_e) | 
| float | kasten_equation (float solz) | 
| float | interpnd (size_t n_dims, const size_t *dims, const float *point, float **grid, const float *lut) | 
| float | interp4d (const size_t *dims, const float *point, float **grid, const float *lut) | 
| float | interp3d (const size_t *dims, const float *point, float **grid, const float *lut) | 
| float | interp1d (const size_t *dims, const float *point, float **grid, const float *lut) | 
| float | interp6d (const size_t *dims, const float *point, float **grid, const float *lut) | 
| void | getcldalbe (float *TauCld, float *CF, float cosSZ, float t_obs, float *t_range, float *albe_obs, float *TauCld_obs, float *CF_obs, size_t t_step, float *wl, size_t bands_num) | 
| float | getosa (float wl, float sza, float wind, float chl, float fr, const luts_par *luts_data) | 
| void | get_luts_data (l2str *l2rec, luts_par *luts_data) | 
| float | calc_par (l2str *l2rec, int ip, int nbands, float *Lt, float taua, float angstrom, float *wl, float *fo, float *ko3, float *taumolbar) | 
| void | calc_scalar_inst_par (l2str *l2rec, int ip, float par_above_ins, float *par_scalar_ins) | 
| void | calc_scalar_par_mean_cosine (l2str *l2rec, int ip, float par_above, float par_c, float *scalar_par, float *mean_cosine) | 
| float | calc_par_impl_of_2023 (l2str *l2rec, int ip, int nbands, float *Lt, float taua, float angstrom, float *wl, float *fo, float *ko3, float *taumolbar, float *parb, float *parc) | 
| void | GetAerPhase (l2str *l2rec, int ip, int32_t nbands, float angstrom, float *phasea, float *omegaa, float *modelAngstrom) | 
| void | read_aerosol_par (l2str *l2rec, int32_t nbands, float *tablewavelengths, float *tablephaseangles, float *tablealphas, float *tableomegas, float *tableaerphasefunc) | 
| void * | allocateMemoryPar (size_t numBytes, const char *name) | 
| float | EstimateDobson (int32_t year, int32_t month, int32_t day, float lat) | 
| float | EstimateWatVap (int32_t year, int32_t month, int32_t day, float lat) | 
| float | varsol (int32_t jday) | 
| void | triseset (int32_t jday, float xlon, float xlat, float *trise, float *tset) | 
| int | Greg2Jul (int32_t year, int32_t month, int32_t day) | 
| float | get_solz (int jday, float time, float lon, float lat) | 
| float | interp_as_taulow (float csz, float tau) | 
| float | interp_as_tauhigh (float csz) | 
| float | SunGlint (float sz, float vz, float ra, float ws) | 
Macro Definition Documentation
◆ ANGSTROM_DEFAULT_VALUE
| #define ANGSTROM_DEFAULT_VALUE 0.2537f | 
Definition at line 19 of file par_utils.h.
◆ EARTH_SURF_PRESSURE
| #define EARTH_SURF_PRESSURE 1013.15f | 
Definition at line 17 of file par_utils.h.
◆ EINSTEIN
| #define EINSTEIN 1.193 | 
Definition at line 22 of file par_utils.h.
◆ MAX_SOLZEN
| #define MAX_SOLZEN 89.5f | 
Definition at line 23 of file par_utils.h.
◆ MAXGLINT
| #define MAXGLINT 0.05 | 
Definition at line 20 of file par_utils.h.
◆ MAXHOURS
| #define MAXHOURS 48 | 
Definition at line 21 of file par_utils.h.
◆ NMODEL
| #define NMODEL 12 | 
Definition at line 14 of file par_utils.h.
◆ NPHASE
| #define NPHASE 75 | 
Definition at line 15 of file par_utils.h.
◆ PAR_0
| #define PAR_0 176.323f | 
Definition at line 24 of file par_utils.h.
◆ PAR_0_2023
| #define PAR_0_2023 176.41f | 
Definition at line 25 of file par_utils.h.
◆ TAU_550_LOW_BOUND
| #define TAU_550_LOW_BOUND 0.1f | 
Definition at line 18 of file par_utils.h.
◆ TAUCONS_HIGH
| #define TAUCONS_HIGH 300.0f | 
Definition at line 27 of file par_utils.h.
◆ TAUCONS_LOW
| #define TAUCONS_LOW 15.0f | 
Definition at line 26 of file par_utils.h.
Function Documentation
◆ allocateMemoryPar()
| void* allocateMemoryPar | ( | size_t | numBytes, | 
| const char * | name | ||
| ) | 
◆ calc_par()
| float calc_par | ( | l2str * | l2rec, | 
| int | ip, | ||
| int | nbands, | ||
| float * | Lt, | ||
| float | taua, | ||
| float | angstrom, | ||
| float * | wl, | ||
| float * | fo, | ||
| float * | ko3, | ||
| float * | taumolbar | ||
| ) | 
Definition at line 192 of file calc_par.c.
◆ calc_par_impl_of_2023()
| float calc_par_impl_of_2023 | ( | l2str * | l2rec, | 
| int | ip, | ||
| int | nbands, | ||
| float * | Lt, | ||
| float | taua, | ||
| float | angstrom, | ||
| float * | wl, | ||
| float * | fo, | ||
| float * | ko3, | ||
| float * | taumolbar, | ||
| float * | parb, | ||
| float * | parc | ||
| ) | 
◆ calc_scalar_inst_par()
| void calc_scalar_inst_par | ( | l2str * | l2rec, | 
| int | ip, | ||
| float | par_above_ins, | ||
| float * | par_scalar_ins | ||
| ) | 
Definition at line 123 of file calc_par.c.
◆ calc_scalar_par_mean_cosine()
| void calc_scalar_par_mean_cosine | ( | l2str * | l2rec, | 
| int | ip, | ||
| float | par_above, | ||
| float | par_c, | ||
| float * | scalar_par, | ||
| float * | mean_cosine | ||
| ) | 
Definition at line 160 of file calc_par.c.
◆ EstimateDobson()
| float EstimateDobson | ( | int32_t | year, | 
| int32_t | month, | ||
| int32_t | day, | ||
| float | lat | ||
| ) | 
Definition at line 876 of file par_utils.c.
◆ EstimateWatVap()
| float EstimateWatVap | ( | int32_t | year, | 
| int32_t | month, | ||
| int32_t | day, | ||
| float | lat | ||
| ) | 
Definition at line 1002 of file par_utils.c.
◆ get_luts_data()
| void get_luts_data | ( | l2str * | l2rec, | 
| luts_par * | luts_data | ||
| ) | 
Get the luts data object For now it includes the MERRA data. Should be moved after the merra data is read.
Definition at line 244 of file par_utils.c.
◆ get_solz()
| float get_solz | ( | int | jday, | 
| float | time, | ||
| float | lon, | ||
| float | lat | ||
| ) | 
◆ GetAerPhase()
| void GetAerPhase | ( | l2str * | l2rec, | 
| int | ip, | ||
| int32_t | nbands, | ||
| float | angstrom, | ||
| float * | phasea, | ||
| float * | omegaa, | ||
| float * | modelAngstrom | ||
| ) | 
Definition at line 680 of file par_utils.c.
◆ getcldalbe()
| void getcldalbe | ( | float * | TauCld, | 
| float * | CF, | ||
| float | cosSZ, | ||
| float | t_obs, | ||
| float * | t_range, | ||
| float * | albe_obs, | ||
| float * | TauCld_obs, | ||
| float * | CF_obs, | ||
| size_t | t_step, | ||
| float * | wl, | ||
| size_t | bands_num | ||
| ) | 
//
from Fitzpatrick et al. (2005), compute cloud albedo
Fitzpatrick, M. F., R. E. Brandt, and S. G. Warren, 2004: Transmission of
Solar # Radiation by Clouds over Snow and Ice Surfaces: A Parameterization in Terms of # Optical Depth, Solar Zenith Angle, and Surface Albedo. Journal of Climate 17, 2: # 266-275, https://doi.org/10.1175/1520-0442(2004)017<0266:TOSRBC>2.0.CO;2
- Parameters
 - 
  
TauCld - MERRA 2 input,cloud optical thickness for a given pixel, a 1D array resolved with respect to time, hourly CF - MERRA 2 input,cloud fraction for a given pixel, aa 1D resolved with respect to time, hourly cosSZ - cosine of solar zenith angle t_obs - observed time t_range - a 1D time array, the same length as TauCld and CF albe_obs - observed albedo for each wavelentgh TauCld_obs - observed optical thinckness CF_obs - obesrved cloud fraction t_step - size of t_range, TauCld and CF wl - input wavelength, 1D arrays bands_num lengh of wl  
Definition at line 1384 of file par_utils.c.
◆ getosa()
| float getosa | ( | float | wl, | 
| float | sza, | ||
| float | wind, | ||
| float | chl, | ||
| float | fr, | ||
| const luts_par * | luts_data | ||
| ) | 
Definition at line 1544 of file par_utils.c.
◆ Greg2Jul()
| int Greg2Jul | ( | int32_t | year, | 
| int32_t | month, | ||
| int32_t | day | ||
| ) | 
◆ interp1d()
1-dimensional interpolation
- Parameters
 - 
  
dims - arrays which contains dimension sizes point - point of interest ( array of size n_dims ) grid - two dimensional array, where grid[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims lut - look up table, where lut[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims  
- Returns
 - float
 
Definition at line 1827 of file par_utils.c.
◆ interp3d()
3-dimensional interpolation
- Parameters
 - 
  
dims - arrays which contains dimension sizes point - point of interest ( array of size n_dims ) grid - two dimensional array, where grid[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims lut - look up table, where lut[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims  
- Returns
 - float
 
Definition at line 1795 of file par_utils.c.
◆ interp4d()
4-dimensional interpolation
- Parameters
 - 
  
dims - arrays which contains dimension sizes point - point of interest ( array of size n_dims ) grid - two dimensional array, where grid[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims lut - look up table, where lut[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims  
- Returns
 - float
 
Definition at line 1749 of file par_utils.c.
◆ interp6d()
6-dimensional interpolation
- Parameters
 - 
  
dims - arrays which contains dimension sizes point - point of interest ( array of size n_dims ) grid - two dimensional array, where grid[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims lut - look up table, where lut[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims  
- Returns
 - float
 
Definition at line 1675 of file par_utils.c.
◆ interp_as_tauhigh()
| float interp_as_tauhigh | ( | float | csz | ) | 
Definition at line 1349 of file par_utils.c.
◆ interp_as_taulow()
| float interp_as_taulow | ( | float | csz, | 
| float | tau | ||
| ) | 
Definition at line 1258 of file par_utils.c.
◆ interpnd()
| float interpnd | ( | size_t | n_dims, | 
| const size_t * | dims, | ||
| const float * | point, | ||
| float ** | grid, | ||
| const float * | lut | ||
| ) | 
N-dimensional interpolation.
- Parameters
 - 
  
n_dims - number of dimensions dims - arrays which contains dimension sizes point - point of interest ( array of size n_dims ) grid - two dimensional array, where grid[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims lut - look up table, where lut[i_dim] is an array of size dims[i_dim] where 0<= i_dim < n_dims  
- Returns
 - float
 
Definition at line 158 of file par_utils.c.
◆ kasten_equation()
      
  | 
  inline | 
Kasten eq to compute airmass.
- Parameters
 - 
  
solz - angle  
- Returns
 - airmass
 
Definition at line 58 of file par_utils.c.
◆ read_aerosol_par()
| void read_aerosol_par | ( | l2str * | l2rec, | 
| int32_t | nbands, | ||
| float * | tablewavelengths, | ||
| float * | tablephaseangles, | ||
| float * | tablealphas, | ||
| float * | tableomegas, | ||
| float * | tableaerphasefunc | ||
| ) | 
Definition at line 802 of file par_utils.c.
◆ search()
| size_t search | ( | const float * | arr, | 
| size_t | s, | ||
| size_t | e, | ||
| float | val, | ||
| size_t * | i_s, | ||
| size_t * | i_e | ||
| ) | 
Binary search algorithm.
- Parameters
 - 
  
arr input array, sorted (either desending or ascending order. It is user responsibility to sort the array) s start e end val value  
- Returns
 - int index to find
 
Definition at line 64 of file par_utils.c.
◆ SunGlint()
| float SunGlint | ( | float | sz, | 
| float | vz, | ||
| float | ra, | ||
| float | ws | ||
| ) | 
Compute sun glint reflectance using wind speed only (no direction)
- Parameters
 - 
  
sz -solar zenith angle vz - view zenith angle ra - radiance ws - windspeed  
- Returns
 - reflectance glint
 
Definition at line 1614 of file par_utils.c.
◆ triseset()
| void triseset | ( | int32_t | jday, | 
| float | xlon, | ||
| float | xlat, | ||
| float * | trise, | ||
| float * | tset | ||
| ) | 
Definition at line 1131 of file par_utils.c.
◆ varsol()
| float varsol | ( | int32_t | jday | ) | 
Definition at line 1116 of file par_utils.c.


