| |
- ctm_field_cl
class ctm_field_cl |
|
general container for geo-physical variables in a high-dimension grid
It can be used to store multiple species storage species fields,
such as T, O3, H2O, etc. It also contains member functions for
field regrid and interploations etc
Members:
--------------------------------------------------------------------
1. name: <str>: name (container name etc)
2. ctm_grid:<ctm_grid_cl>: the grid for ctm
3. is_xyz_data:<T/F>: True when data is in form of [lon, lat, lz,...].
---Otherwise, data is inform of [lon, lat, ...].
4. ndim: <integer>: number of dimensions.
5. dims: <array>: sizes in each directions.
6. extra_axis:<gp_axis>: extra axis.
7. attr_dict:<dict>: dictionary for attributes.
8. data: <array>: data
9. unit:<str/float>: unit of the data
Attributes (expected or reserved)
---------------------------------------------------
1. tracer_name:<str>: tracer name
2. tracer_id:<integer>: tracer number
3. category:<str>: tracer category
4. group:<str/integer>: group id for the tracer
5. tau_st:<float>: start time (hours since 1985.01.01 00:00)
6. tau_end:<float>:end time (hours since 1985.01.01 00:00)
Functions:
------------------------------------------------------
1. __init__:Initialization
2. get_grid: get CTM grid
# data retieval and maintainence.
3. update_data: update the data set and its attributes
4. copy_data: get the copy of the data set.
5. get_data: return the pointer of data member.
5. __getitem__: (over-riding) index function
6. get_profile: get profiles at horizontal locations
# attributes
7. set_attr: set attribute
8. get_attr: get attribute
9. is_matched: compare attributes
10. copy_attr_dict: get attriute dictionary
11. copy: make a copy of the class |
|
Methods defined here:
- __getitem__(self, index)
- over-ridding index function
Inputs:
---------------------------------
1. index:<array,(ndim, )>: element indexs of data array
Returns:
---------------------------------
1. data[index]:<array>: data values at the elements specified by index.
- __init__(self, name, data, unit='', ctm_grd=None, is_xyz_data=True, extra_axis=None, **keywords)
- initialization
Input:
--------------------------------------
1. name:<str>:name of the object
2. data:<array>: (2D, 3D or 4D) data over ctm_grid
---Data is assumed to be in the form of
(a). (lon, lat, lz) for 3D spatial distributions or
(b). (lon, lat, ntime) for 2D time serie,
(c). (lon, lat, ne) 2D data ensemble
(d). (lon, lat, lz, ntime):3D time series
(e). (lon, lat, lz, ne): 3D data ensemble
3. ctm_grd:<ctm_grid_cl>: grid
4. is_xyz_data:<T/F>: form of the field
5. keywords:<dict>: attributes (expected):
--->tracer_name:<str>: tracer name
--->tracer_id:<integer>: tracer number
--->category:<str>: tracer category
--->group:<str/integer>:tracer group ID.
--->tau0:<float>: start time (Hours since 1985.01.01 00:00)
--->tau1:<float>:end time (Hours since 1985.01.01 00:00)
- copy(self)
- make a copy of the class
Returns:
--------------------------------------
1. new_field: a copy of field
- copy_attr_dict(self)
- get the attribute dictionary
- copy_data(self)
- get a copy of the data
Outputs:
-------------------------------------------
1. data:<array,>: one copy of the data stored here
- get_attr(self, name)
- get attribute
Inputs:
-----------------------------
1. name:<str>: attribute name
Returns:
-------------------------------
1. val: <obj>: attribute value
- get_data(self)
- get the data
Outputs
----------------------------------
1. self.data:<array,>: the data member
- get_grid(self)
- retrieve CTM grid
Returns:
-----------------------------------
1. ctm_grd:<ctm_grd_cl>: class
- get_profile(self, olon, olat)
- get profiles at the horizontal locations (olon, olat)
Inputs:
---------------------------------
1. olon:<array, (nob,)>: longitudes at nob locations
2. olat:<array, (nob,)>: latitudes at nob locations
Returns:
---------------------------------
1. prof:<array, (nob, nz)>: profiles at nob locations
- is_matched(self, **keywords)
- Check whether attribute is matched what is required
Inputs:
-------------------------------------------------
1. keywords:<dictionary>: Attributes to be compared
- set_attr(self, name, val)
- set attribute
Inputs:
-----------------------------
1. name:<str>: attribute name
2. val: <obj>: attribute value
- set_grid(self, ctm_grd)
- define the grid
Inputs:
-------------------------------
1.ctm_grid:<ctm_grid_cl>: grid
- update_data(self, data, **keywords)
- change data
Inputs:
----------------------------------------
1.data:<array, ([nlon], [nlat], [nz], ,,,)>:
---data array with shape assumed to be consistent with ctm_grid
| |