| |
- ctm_profile_cl
class ctm_profile_cl |
|
general container for profiles for geo-physical variables at given locations.
Members:
------------------------------------------------------------------------------
1. name: <str>: name (container name etc)
2. olon:<array, (nob,)>: longitudes
3. olat:<array, (nob,)>: latitudes
4. tau:<array, (nob,)>: time
5. dims:<array, (ndim,)>: shape of data
6. ndim: <integer>: number of dimensions.
7. extra_axis:<gp_axis_cl>: extra axis.
8. attr_dict:<dict>: dictionary for attributes.
9. data: <array, (nobs, nz, )>: data
10. unit:<str/float>: unit of the data
11. is_xz_data:<T/F>: True, if it is in shape of (nob, nz).
12. mask_val:<float>: filling for missing or bad data
Attributes (expected)
---------------------------------------------------
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 (Seconds since 1985.01.01 00:00)
6. tau_end:<float>:end time (Seconds since 1985.01.01 00:00)
Functions:
------------------------------------------------------------------------------
1. __init__:Initialization
2. get_location: retunr olon, olat
# data retieval and maintainence.
3. update_data: update the data set and its attributes
4. copy_data: get the data set.
5. __getitem__: (over-riding) index function
# attributes
6. set_attr: set attribute
7. get_attr: get attribute
8. is_matched: compare attributes
9. regrid_profile: vertically regrid profile.
10. copy: duplicate itself |
|
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='', lon=None, lat=None, tau=None, mask_val=-999.0, is_xz_data=True, extra_axis=None, **keywords)
- initialization
Input:
--------------------------------------
1. name:<str>:name of the object
2. data:<array>: (2D, 3D) data over location
Data is assumed to be in the form of
---(a). (nob, lz) for cross-section
---(b). (nob, lz, ntime) for 2D time serie,
---(c). (nob, lz, ne):2D data ensemble
---(d). (nob, lz, ne, ...): high-dimension data
3. unit:<str>: the unit of the profile
4. lon:<array, (nob,)>:longitudes
5. lat:<array, (nob,)>:latitudes.
6. tau:<array, (nob,)>: tau
7. is_xz_data:<T/F>: Ture when data is in the shape of (nob, lz, ..)
8. extra_axis:<gp_axis>: extra axis (for example, time, etc)
keywords (expected):
1. tracer_name:<str>: tracer name
2. tracer_id:<integer>: tracer number
3. category:<str>: tracer category
4. group:<str/integer>:tracer group ID.
5. tau_st:<float>: start time (Seconds since 1985.01.01 00:00)
6. tau_end:<float>:end time (Seconds since 1985.01.01 00:00)
- copy(self)
- create duplicate itself
Outputs:
--------------------------------------------
1. new_profile:<ctm_profil_cl>: the profile class at the new vertical grid
- copy_attr_dict(self)
- get the attribute dictionary
- copy_data(self)
- get_attr(self, name)
- set attribute
Inputs:
-----------------------------
1. name:<str>: attribute name
Returns:
1. val:<obj>: attribute value
- get_lat(self)
- get lat
- get_lon(self)
- get lon
- grid_profile(self, lons=None, lats=None, use_intpl=0)
- gridded profiles to a gridded defined by lons, lats
Inputs:
-------------------------------------------------
1. lons:<array, (nlon,)>: longitude grid
2. lats:<array, (nlat,)>: latitude grid
3. use_intpl:<int>: 0 means profiles will be allocated the closest grid points.
--- others, meaning interpolation will be done.
Outputs:
------------------------------------------------
1. counts:<array, ([nlon], [nlat])>: number of profile at each grid boxes
2. sum_val:<array, ([nlon], [nlat], nz)>: summary of profile at each grid boxes
3. sum_square:<array, ([nlon], [nlat], nz)>: summary of profile^2 at each grid boxes
Notes:
------------------------------------------------------
if data have a more than 2 dims, it will be reshape to (nob, nz) with nz=size(data)/nob
- is_matched(self, **keywords)
- Check whether attribute is matched what is required
Inputs:
-------------------------------------------------
1. keywords:<dictionary>: Attributes to be compared
- regrid_profile(self, vintpl)
- create a new profile at level specified in vintp
Inputs:
------------------------------------------
1. vintpl:<None, or initialized vinterpl_cl>: interpolation function
--- Pressure grid of vintpl should be in the shape of (nob, nz),
consistent with the first two dimensions of profile.
--- ob pressure of the vintpl represent the grid to be projected to.
should be in the shape of (nob, nz_new)
Outputs:
--------------------------------------------
1. new_profile:<ctm_profil_cl>: the profile class at the new vertical grid
- set_attr(self, name, val)
- set attribute
Inputs:
-----------------------------
1. name:<str>: attribute name
2. val: <obj>: attribute value
- set_lat(self, olat)
- set longitude
Inputs:
-------------------------------------------
1. olat:<array>: latitudes
- set_lon(self, olon)
- set longitude
Inputs:
-------------------------------------------
1. olon:<array>: longitude
- set_tau(self, tau)
- set tau
Inputs:
-------------------------------------------
1. tau:<array>: time
- shape(self)
- get the shape of the data
- size(self)
- get the size of the data
- update_data(self, data, **keywords)
| |