| |
- vintpl_cl
class vintpl_cl |
|
class for vertical interpolation and integration
Members:
-------------------------------------------------------------------------------
# model grid
1. grd_pres:<array, ([nx], [ny], ..., nz)>: vertical pressure levels at horizontal locations.
---It can be 1D, 2D, 3D or more, but the last dimension must be vertical levels.
2. lg_grd_pres:<array, ([nx], [ny], ..., nz)>: log10(grd_pres)
3. grd_dims:<tuple/array>: shape of lg_grd_pres
4. grd_ndim:<integer>: length of grd_dims
5. do_reverse:<T/F>: True if the original grid pressure is in descending order.
--- class member grd_pres will always be stored in ascending order.
# interpolation
6. grd_vpl:<array, ([nx], [ny], nz_ob)>: lower boundary for interpolations from
ob (target) grid to model grid
7. grd_vpr:<array, ([nx], [ny], nz_ob)>: upper boundary for interpolations from
ob (target) grid to model grid
8. grd_vwgt:<array, ([nx], [ny], nz_ob)>: weighting factor for lower boundary
# column
9. grd_colwgt<array, , ([nx], [ny], nz)>: mass weight at levels
# Observation (target) grid
10. ob_pres:<array, ([nx], [ny], ..., nz_ob)>: ob pressue levels
11. lg_ob_pres:<array, ([nx], [ny], ..., nz_ob)>: log10(lg_ob_pres)
12. ob_dims:<tuple>: shape of lg_grd_pres
13. ob_ndim:<integer>: length of ob_dims
14. ob_vpl:<array, ([nx], [ny], ..., nz)>: lower boundary for interpolations from model grid to ob grid
15. ob_vpr:<array, ([nx], [ny], ..., nz)>: upper boundary
16. ob_vwgt:<array, ([nx], [ny], ..., nz)>: weighting factor for lower boundary
17. do_ob_reverse:<T/F>: Ture when the original ob_pressure is in descending order
# others
18. mask_val: <float>: mask for missing or bad data
19. do_reshape:<T/F>: True when the dimension of the pressure is larger than 3
--- when it is true, the lg_grd_pres will be reshaped as (reshape_nx, nz)
--- before calling profile or column fortran functions.
--- the result will be reshaped back to high-dimension data
20. reshape_nx:<integer>: the size of the leading column
Functions:
-------------------------------------------------------------------------------
1. __init__: initialization
2. init_interp: set parameters for interoplation
3. interpolate_ob_prof: Interpolate ob profiles to model pressure grid
4. interpolate_mod_prof: interpolate field from model grid to ob grid
5. get_mod_column: calculate column values for profiles at model vertical grid
6. get_ob_column: calculate column values for profile at ob vertical grid
7. get_ob_ak_column: calculate column values for profiles weighted by averging kernel at ob vertical grid. |
|
Methods defined here:
- __init__(self, pres, is_in_log, do_reverse, mask_val=-999.0)
- initialize horizontal interpolation class
Inputs:
1. pres:<array, ([nx], [ny], nz>:
---Pressure grid for profiles to be interpolated to or from.
---The last column of the array is assumed to be vertical levels
2. is_in_log: <T/F>: Ture the pressure is given in log10
3. do_reverse:<T/F>: True, if the pressure is given in decending order/
4. mask_val: <float>: masks for bad or missing value
- get_ak_ob_column(self, fld, ak)
- Get column values weigted by averging kernels at the observation pressure grid defined at init_interp
Inputs:
===============================================================
1. fld:<array, ([nx], [ny], nz,[ne])>:1D, 2D or 3D data at ob grid.
2. ak:<array, ([nx], [ny], nz)>: averaging kernels
Outputs:
==================================================================
1. col_ob <array>: column values
- get_attr(self, name)
- check attribute
Inputs:
---------------------------------------------
1. name:<str>: attribute name
Returns:
----------------------------------------------
1. val:<obj>: value of the attribute
- get_mod_column(self, gp_fld)
- get column values for profiles at model pressure grid
Inputs:
--------------------------------------------------------------------------
1. gp_fld:<array>: 1D, 2D or 3D gridded data at model (or slice) grid. Its shape is
assumed to be ([nx], [ny], nz, [ne])
---[nx] * [ny]: Number of horizontal locations;
---nz: Size of the model vertical grid.
---[ne]: Tracer (time step) number
2. mask_val:<float>: missing or bad value
Outputs:
1. col_at_grd <array,([nx], [ny], [ne]) >: column values
- get_ob_column(self, fld)
- get column values at the observation pressure grid defined at init_interp
Inputs:
1. fld:<array, ([nx], [ny], nz, [ne])>:1D, 2D or 3D data at ob grid.
Outputs:
1. col_ob <array>: column values
- init_interp(self, opres, is_in_log=False, do_ob_reverse=False)
- initialize interpolation coefficients
Inputs:
1. opres:<array>: ob pressure grid to be projected.
2. is_in_log:<T/F>: optional. Ture if opres is given in log10 space
3. do_ob_reverse:<T/F>: optional. True of opres is given at descending order
- interpolate_mod_prof(self, fld)
- Interpolate model profiles to the ob (target) pressure grid defined at init_interp
Inputs:
--------------------------------------------------------------------------------
1. fld:<array, ([nx],[ny], nz, [ne]>: 1D, 2D or 3D gridded data at model grid. Its shape is assumed to be (nz, [ne]) 1D; (nx, nz, [ne]), (2D); or (nx, ny, nz, [ne]), (3D).
---[nx] * [ny]: Number of horizontal locations;
---nz: Size of the model vertical grid.
---[ne]: Tracer (time step) number
Outputs:
-----------------------------------------------------------------------------------
1. prof_at_ob:<array,([nx],[ny], nz_ob, [ne]) >: gp_fld at the new (ob) vertical grid
of nz_ob levels
- interpolate_ob_prof(self, ob_fld, mask_val=-999.0)
- Interpolate ob profiles to model pressure grid
Inputs:
--------------------------------------------------------------------------------
1. ob_fld:<array, ([nx],[ny], nz0>: 2D or 3D gridded data at ob grid. Its reshape is
assumed to be (nz) 1D; (nx, nz), (2D); or (nx, ny, nz), (3D).
---[nx] * [ny]: Number of horizontal locations;
---nz0: Size of the vertical grid.
2. mask_val:<float>: missing or bad value
Outputs:
-----------------------------------------------------------------------------------
1. prof_at_ob:<array,([nx],[ny], nz>: gp_fld at the new (model) vertical grid
- set_attr(self, name, val)
- add or replace attributes
Inputs:
---------------------------------
1. name:<str>: attribute name
2. val: <obj>: value of the attribute
- set_mask(self, mask)
- set values for data mask
Inputs:
------------------------------------------
1. mask:<float>: mask for bad or missing values
| |