| |
- ESA.atmosphere.ctm_grid_3d.ctm_grid_cl(ESA.util.gp_grid_m.gp_grid_cl)
-
- gc_grid_cl
class gc_grid_cl(ESA.atmosphere.ctm_grid_3d.ctm_grid_cl) |
|
derived class for model grid
Members (overrided and newly added):
---------------------------------------
# window definitition
1. ix: longitude size
2. jx: latitude size
3. lx: vertical size
4. ifirst: longitude shift
5. jfirst: latitude shift
6. lfirst: vertical shift
7. halfpolar: polar configuration/
8. centre180: =1, if longitudes are represented in (0 to 360) degrees.
# global H-grid (important for nested model)
9. glb_ix: global x size
10. glb_jx: global y size
11. glb_lx: global z size
12. glb_lon: global longitude centers
13. glb_lat: global latitude centers
14. glb_lon_edge: global longitude edges
15. glb_lat_edge: global latitude edges
# global V-vertical
21. is_nested: whether it is nested
22. lonres: longitude resolutions
23. latres: latitude resolutions
24. geos_ver: geos-chem version
# initialization control
25. resize_use_mod_res
Functions: (new or overridden functions)
---------------------------------------------------------------------
1. __init__: initialize the class
2. get_lon: return longitude grid
3. set_lon: set longitude grid
4. get_lat: return latitude grid
5. set_lat: set longitude grid
#
6. compute_mod_pres: compute model pressure and reset the attributes
7. compute_mod_pres_edge: compute model pressures at level edges and reset the attributes
# edges
8. set_lon_edge: set longitude edge
9. set_lat_edge: set latitude edge
10. compute_lat_edge: compute_lat_edge
11. compute_lon_edge: compute_lon_edge
12. get_area: calculate areas of grid boxes
# global grid
13.get_glb_lon: return global longitude grid
14.get_glb_lon_edge: return global longitude grid at box edges
14.get_glb_lat: return global latitude grid
15.get_glb_lat_egde: return global latitude grid
Attributes (Added for resevered keywords):
-------------------------------------------------------------
1. glb_mod_pres: model pressure at level centers
2. glb_mod_pres_edge: model pressures at level edges |
|
- Method resolution order:
- gc_grid_cl
- ESA.atmosphere.ctm_grid_3d.ctm_grid_cl
- ESA.util.gp_grid_m.gp_grid_cl
Methods defined here:
- __init__(self, ix, jx, lx, ifirst=1, jfirst=1, lfirst=1, halfpolar=0, centre180=0, lonres=None, latres=None, is_nested=0, use_reduced=1, geos_ver=5, mod_res=None, resize_use_mod_res=True, mask_val=-999.0, **keywords)
- Initialize the class
Input:
----------------------------------
1. ix, jx, lx:<nteger> : the sizes of lon, lat, z
2. ifirst, jfirst, lfirst:<integer> the start point for the data to store.
3. halfpolar, centre180:<integer>: 0 or 1 for the type of lon
4. lonres, latres: <float>: the resolution of the lat and lon
- compute_lat_edge(self)
- Returns:
-----------------------------------------
1. lats:<array, (jx+1,)>: longitude at grid edges
- compute_lon_edge(self)
- Returns:
1. lons:<array, (ix+1,)>: longitude at grid edges
- compute_mod_pres(self, sp)
- set pressure at model level centres
Inputs:
-------------------------------------
1. sp: <array, (ix,jx)> surface pressure
Returns:
----------------------------------
1. mod_res: <array, (ix, jx, lx)>: pressure at model level
- compute_mod_pres_edge(self, sp)
- Set model pressure at model level edges
Inputs:
-------------------------------------
1. sp: <array, (ix,jx)> surface pressure
Returns:
1. mod_res: <array, (ix, jx, lx)>: pressure at model level
- copy(self)
- Make a copy of itself
Returns:
---------------------------------------------------
1. new_grid:<ctm_grid_cl>: new grid
- get_area(self)
- calculate area for grid box
Returns:
1. area:<array, (nx, ny)>: areas for grid boxes in m^2
- get_glb_lat(self)
- get global latitude grid
Returns
-----------------------------------------
1. glb_lat:<array, (glb_jx)>: global latitudes
- get_glb_lat_edge(self)
- get global latitude grid
Returns
-----------------------------------------
1. glb_lat_edge:<array, (glb_jx+1)>: global latitudes
- get_glb_lon(self)
- get global longitude grid
Returns
-----------------------------------------
1. glb_lon:<array, (glb_ix)>: global longitudes
- get_glb_lon_edge(self)
- get global longitude grid
Returns
-----------------------------------------
1. glb_lon_edge:<array, (glb_ix+1)>: global longitudes
- get_lat_edge(self)
- Returns:
------------------------------------------
1. lats:<array, (jx+1,)>: longitude at grid edges
- get_lon_edge(self)
- Returns:
----------------------------------------
1. lons:<array, (ix+1,)>: longitude at grid edges
- get_mod_pres(self)
- Retrieve model pressure from dictionary
Returns
-------------------------------
1. mod_pres:<array, (nz,)>:pressure at model edge
- get_mod_pres_edge(self)
- Retrieve model pressure at box edges from dictionary
Returns:
----------------------------------
mod_pres_edge:<array, (nz+1,)>:pressure at model edge
- init_lat(self, jx=None, jfirst=None, latres=None, is_nested=None, resize_use_mod_res=True)
- initialize latitude grid
Inputs:
-------------------------------------
1. jx:<integer>: size of longitude
2. jfirst:<integer>: poistion of first longitude in global grid
3. latres:<float>: longitude resolution
4. is_nested:<integer>: 0==not nested grid
5. resize_use_mod_res:<T/F>: if Ture, jx will be calculated from latres when it is not
provided.
Returns:
-------------------------------------
lats:<array, (ix,)>: longitudes
- init_lon(self, ix=None, ifirst=None, lonres=None, centre180=None, is_nested=None, resize_use_mod_res=True)
- initialize longitude grid
Inputs:
-------------------------------------
1. ix:<integer>: size of longitude
2. ifirst:<integer>: poistion of first longitude in global grid
3. lonres:<float>L: longitude resolution
4. centre180:<integer>: 0==centerred around 0
5. is_nested:<integer>: 0==not using nested grid
6. resize_use_mod_res:<T/F>: True, ix will be calculated from lonres, if it is not
provided.
Returns:
------------------------------------------
1. lons:<array, (ix,)>: longitudes
-------------------------------------
- init_lz(self, lx=None, lfirst=None, geos_ver=None, use_reduced=None, resize_use_glb=True)
- initialize vertical levels
Inputs:
-------------------------------------
1. lx:<integer>: size of vertical levels
2. lfirst:<integer>: poistion of first level
3. geos_ver:<integer>: version for GEOS data
4. use_reduced:<integer>: 1==reduced vertical will be use.
5. resize_use_glb:<T/F>: if ture, lx will be resized to glb_lx when it is not given
Returns:
-------------------------------------
lz:<array, (lx,)>: longitudes
- set_lat(self, jx=None, jfirst=None, latres=None, is_nested=None)
- set latitude grid (over-riding function
Inputs:
-------------------------------------
1. jx:<integer>: size of latitude
2. jfirst:<integer>: poistion of first latitude in global grid
3. latres:<float>: latitude resolution
Returns:
-----------------------------------------
1. lats:<array, (ix,)>: longitudes
------------------------------------
- set_lon(self, ix=None, ifirst=None, lonres=None, centre180=None, is_nested=None)
- Re-set longitude grid (over-riding function)
Inputs:
-------------------------------------
1. ix:<integer>: size of longitude
2. ifirst:<integer>: poistion of first longitude in global grid
3. lonres:<float>L: longitude resolution
4. centre180:<integer>: 0==centerred around 0
5. is_nested:<integer>: 0==not using nested grid
Returns:
--------------------------------------
1. lons:<array, (ix,)>: longitudes
-------------------------------------
Methods inherited from ESA.atmosphere.ctm_grid_3d.ctm_grid_cl:
- get_hintpl(self, olon, olat)
- get weightings and locations for interpolating fields along a track
Inputs:
------------------------------------
1. olon:<array, nob>: longitude of the track
2. olat:<array, nob>: latitude of the track
Returns:
------------------------------------
hintpl:<interp_cl>: interpolation matrix along the track
- get_lat(self)
- retrieve latitude grid
Returns:
-------------------------------------
1. self.lat:<array, (nlat)>: latitudes
- get_lon(self)
- retrieve longitude grid
Returns:
-------------------------------------
1. self.lon:<array, (nlon)>: longitudes
- get_lz(self)
- retrieve lz (vertical) grid
returns:
--------------------------
1. self.lz:<array>: longitudes
- get_regrid_mtx(self, newlon, newlat)
- get weightings and locations for interpolating fields along a track
Inputs:
------------------------------------
1. newlon:<array, new_nlon>: longitude of the track
2. newlat:<array, new_nlat>: latitude of the track
Returns:
------------------------------------
hintpl:<interp_cl>: interpolation matrix for regridding
- get_vintpl(self, mod_pres, opres, is_in_log, do_reverse, do_ob_reverse)
- get weightings and locations for vertically interpolating fields along a track
Inputs:
------------------------------------
1. mod_pres:<array, (nob, nz, ..)>: model pressure along the track
2. opres:<array, (nob, ob_nz, ...)>: ob pressures to be interpolated to.
3. is_in_log:<T/F>: True, if mod_pres and and opress are in log10
4. do_reverse:<T/F>: True, if mod_pres is given in decending order
5. do_ob_reverse:<T/F>: True, if opress is given in decending order
Returns:
------------------------------------
hintpl:<interp_cl>: vertical interpolation matrix
- set_lat_edge(self, lat_edge)
- Save latitude box edge into dictionary
Inputs:
---------------------------------------------------
1. lat_edge:<array, nlat+1>: edge of the latitude boxes
- set_lon_edge(self, lon_edge)
- save longitude box edges to the dictionary
- set_lz(self, lz)
- set latitude grid
Inputs:
------------------------------------
1. lz:<array>: vertical coordinate
returns:
------------------------------------
- set_mask(self, mask)
- set filling value for missing or bad data
- set_mod_pres(self, mod_pres)
Methods inherited from ESA.util.gp_grid_m.gp_grid_cl:
- __getitem__(self, ax_id)
- get axis
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
----------------------------------
1, gax:<gp_axis_cl>: axis if the ax_id is valid
- allocate_point(self, p)
- find grid points around a given point, and
calculate their weights according to the distances from this point.
Inputs:
----------------------------------------------------------------
1. p:<array, (nax,)>: the coordiantes of the given point.
Returns:
-------------------------------------------------------------------
1. grd_pt_lst: <list, t:tuple>: list of the index of the surrounding grid points.
---If the dimension size nax is n, the length of grd_pt_lst is 2^n,
with each element being an array of size n.
2. grd_wgt_lst: <list, t:float>: Weights of the the surrounding points,
---which are calculated from their distances from the point.
- allocate_point_subspace(self, p, axis_id_lst)
- find grid points around a given point, and
calculate their weights according to the distances from this point.
Inputs:
----------------------------------------------------------------
1. p:<array, (nuse,)>: the coordiantes of the given point.
2. axis_id_lst:<list, t:integer>: the use the index
Returns:
-------------------------------------------------------------------
1. grd_pt_lst: <list, t:tuple>: list of the index of the surrounding grid points.
---If the dimension size nax is n, the length of grd_pt_lst is 2^n,
with each element being an array of size n with coordinate [:] for axis=axis_id
2. grd_wgt_lst: <list, t:float>: Weights of the the surrounding points,
---which are calculated from their distances from the point.
- copy_attr_dict(self)
- get one copy of the attr_dict
- get_attr(self, attr_name)
- find the attribute
Inputs:
----------------------------------
1. attr_name:<str>: name of the attribute
Returns:
------------------------------------------
1. attr: <obj>: if the attribute exists.
- get_axis(self, ax_id)
- wrapper for __getitem__
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
----------------------------------
1, gax:<gp_axis_cl>: axis if the ax_id is valid
- get_axis_ids(self, axis_name_lst)
- Find id for given names
Inputs:
----------------------------------------------------------------
1. axis_name_lst:<list, t:str>: the names
Returns:
------------------------------------------
1. axis_id_lst:<list,t:integer>: the index
- get_profile(self, p, field, axis_id_lst)
- extract profile at a given 'horizontal location'
Inputs:
----------------------------------------------------------------
1. p:<array, (nuse,)>: the sub coordiantes of the given points.
2. field:<array, dims>: gridded data
3. axis_id_lst:<integer>: index of the axis, where the axises to be used
Returns:
---------------------------------------------------------------
1. profile:<array, ...>: the profile at the locations
- get_value_at_point(self, p, field)
- calculate value at a given p by interpolating the
gridded data (field) at surrounding grid points
Inputs:
----------------------------------------------------------------
1. p:<array, (nax,)>: the coordiantes of the given point.
2. field:<array, (nx, ny, nz, ...)>:gridded data
Returns:
----------------------------------------------------------------
val:<float>: values at point p
- set_attr(self, attr_name, attr_value)
- set attribute
Inputs:
----------------------------
1. attr_name:<str>: name of the attribute
2. attr_value:<obj>: the value of the attribute
- shape(self)
- Return the shape of the grid
- size(self, ax_id=None)
- Return size along one direction or total size of the grid
Inputs:
--------------------------------
1. ax_id:<integer/str>: Id for the axis to be found
Returns:
1. nsize:<integer>: the size of axis if axis_id is provided, or the total size if no ax_id is specified.
- update_axis(self, gp_axis)
- add or replace axis
Inputs:
--------------------------------------------------
1. gp_axis:<gp_axis_cl>: class to be added or replaced
Output:
-------------------------------------------------
2. gax:<gp_axis>: axis if the Id is correct
| |