ESA.enkf.x2flux_m
index
/home/lfeng/otool/ESA/enkf/x2flux_m.py

Class for projecting coefficient to flux
 
Authors: L. Feng, Edinburgh University
History: v0.9, 2012.11.12
History: v0.95, 2013.01.07
 
Classes:
===============================================
1. x2flux_cl: Class for projecting coefficients vector 
 
 
Functions:
===================================================
1. set_localization_wgt:

 
Modules
       
ESA.surface.bf_file_m
ESA.util.flux_regrid
ESA.util.geo_constant
ESA.util.otool_gcfile_io
ESA.util.great_circle_distance
ESA.util.gen_plots
ESA.util.otool_ncfile_io
numpy
ESA.util.otool_obj
ESA.util.otool_var_io
pylab
ESA.util.time_module

 
Classes
       
x2flux_cl

 
class x2flux_cl
     Methods defined here:
__init__(self, datapath, flnm, yyyy, mm, dd, bf_get=<function read_bf>, bfcl=None, lon_nm='lon', lat_nm='lat', flux_nm='flux', fio_keywords={}, **keywords)
initialization 
 
Inputs:
------------------------------------------------------
1. datapath:<str>: file path for aod data 
2. flnm: <flnm>:  file name for aod file
3. yyyy: <int>:   year 
4. mm:<]int>:     month 
5. dd:<int>:      day 
6. bf_get:<func>: function for reading basis function (or ensemble function)
7. bfcl:<bf_cl>:  basis function class
8. lon_nm:<str>: name of longitude
9. lat_nm:<str>: name of latitude
10. flux_nm:<str>: name of flux
11. fio_keywords: <dict>:  extra inputs for file accessing
12. keywords:<dict>: attribute
copy(self, yyyy, mm, dd, **keywords)
Make a copy of itself, and replace the keywords 
 
Inputs:
---------------------------------------------
1. yyyy, mm, dd:<int>: date
2. keywords:<dict>: extra inputs 
 
Returns
-------------------------------------------
cl_new:<x2flux_cl>: a copy of itself
load_flux_from_file(self, **keywords)
Inputs:
---------------------------------------------
1. datapath:<str>: file path for aod data 
2. flnm: <flnm>:  file name for aod file
3. keywords:<dict>: extra inputs
---reserved keys:
--->lon_nm:<str>: name of longitude
--->lat_nm:<str>: name of latitude
--->flux_nm:<str>: name of flux
--->flnm:<str>: name of flux file
--->path:<str>: name of data path
--->yyyy, mm, dd:<int>: year, month, day 
 
 
 
 
Notes:
--------------------------------------------
1. if existing self.bfcl, self.bfck.load_bf will be called. 
otherwise, self.bf_get will be invoked.
x2flux(self, x, flux=None, locz_wgt=None, keep_flux=False, **keywords)
Inputs:
------------------------------------------
1. x:<array, (ne, (ne))>: coefficient matrix 
2. flux:<array, (nlon, nlat, ne)>: flux basis function or ensemble 
3. locz_wgt:<array, (nlon, nlat)>: localization scaling factor
4. keep_flux:<T/F>: if true, flux will be saved

 
Functions
       
read_bf(datapath, flnm, yyyy, mm, dd, lon_nm='lon', lat_nm='lat', flux_nm='flux', **keywords)
read basis function (ensemble function from a netcdf file
Inputs:
 
 
Inputs:
--------------------------------------------------------
1. datapath:<str>: file path for aod data 
2. flnm: <flnm>: file name for aod file
3. yyyy: <int>:  year 
4. mm:<]int>:     month 
5. dd:<int>:     day 
6. lon_nm:<str>: name of longitude
7. lat_nm:<str>: name of latitude
8. flux_nm:<str>: name of flux
read_bf_to_dict(datapath, flnm, yyyy, mm, dd, varname_lst=['lon', 'lat', 'flux', 'map', 'area'], **keywords)
read basis function (ensemble function from a netcdf file
 
Inputs:
 
 
Inputs:
--------------------------------------------------------
1. datapath:<str>: file path for aod data 
2. flnm: <flnm>: file name for aod file
3. yyyy: <int>:  year 
4. mm:<]int>:     month 
5. dd:<int>:     day 
6. varname_lst:<list, t:str>: list of vars to be read
 
Returns:
----------------------------------------
var_dict:<dict>: dictionary for vars read from BF file
set_localization_wgt(grd_lon, grd_lat, olon, olat, wlen, threshold, by_relative, **keywords)
Set up weighting function for localization according to distance from 
observations. 
 
Usually, localization is necessary when a partial representation is used. 
 
Inputs:
---------------------------------------------
1. grd_lon:<array, (nlon)>: map longititude
2. grd_lat:<array, (nlat)>: map latititude
3. olon, olat:<array, (nlat)>:
4. wlen:<float>: length 
5. threshold:<float>: threshold above which wgt will be set to 1.0 (see Note 1)
6. by_relative:<T/F>: if true, threshold will be interprested as percentage
7. keyword:<dict>: dictionary extra inputs
 
Returns:
-------------------------------------------
1. wmap:<array, (nlon, nlat)>: wmap 
 
 
Notes:
-----------------------------------------
1. threshold normally should be less than 1.0