ESA.instrument.ak_m
index
/home/lfeng/otool/ESA/instrument/ak_m.py

class for scene-dependent  averaging kernel   
 
Authors: L. Feng, Edinburgh University
History: v0.9, 2012.06.28
History: v0.95, 2013.02.24
 
Classes:
==========================================
1. ak_cl: class for ak data

 
Modules
       
ESA.instrument.ak_file_m
ESA.util.geo_constant
ESA.util.gp_grid_m
numpy
ESA.util.otool_obj
ESA.util.time_module

 
Classes
       
ak_cl

 
class ak_cl
    class for ak data 
Members:
-------------------------------------------
1. flnm:<str>: file name (reserved for future use)
2 .datapath:<str>: file path 
 
# current time
3. yyyy=yyyy
4. mm=mm
5.dd=dd
 
# observation
 
6. viewmode_dict:<dict>: dictionary for viewmode and its ID
7. surf_type_dict:<dict>: dictionary for surface type and its ID
 
# AK file access function
    
8.  fopen:<func>: open file 
9.  fread;<func>: read file 
10. fclose:<func>: close file 
11. fget:<func>: read data in
 
  Methods defined here:
__init__(self, viewtype, datapath, flnm, yyyy, mm, dd, viewmode_dict={'glint': 1, 'nadir': 0}, surf_type_dict={'conifer': 1, 'desert': 4, 'ocean': 0, 'snow': 2, 'soil': 3}, fopen=<function open_ak_file>, fread=<function read_ak_file>, fclose=<function close_ak_file>, fget=<function get_ak_data>, fio_keywords={}, **keywords)
initialization 
 
Inputs:
------------------------------------------------------
1. viewtype:<str>: instrument type (or name)
2. datapath:<str>: file path for AK data 
3. flnm: <flnm>: file name for AK data
4. yyyy: <int>:  year 
5. mm:<int>:     month 
6. dd:<int>:     day 
7. viewmode_dict:<dict>: dictionary for view modes
8. surf_type_dict:<dict>: dictionary for surface type
 
9. fopen:<func>: open data file 
10. fread:<func>: read data into 
11. fclose:<func>: close file 
12. fget: <func>: get ak values
 
13. rw_keywords:<dict>: additional parameters for AK file read/write
14. keywords:<dict>: attributes
get_data(self, osza, oaod, iviewmode, isurf_type, **keywords)
get ak for observation conditions (osza and oaod)
 
Inputs:
-------------------------------------------------------
1.osza:<array, (nob)>: solar zenith angle 
2.oaod:<array, (nob)>: aerosol optical depth 
3.iviewmode:<array, (nob)/integer>:  view mode
4.isurf_type:<array, (nob)/integer>: surface type 
5. keywords:<dict>: 
---Reserved Entries
---common_ref:<str/numeric>: the reference shared by observations. 
--->'ak_viewmode_dict':<dict>: dictionary for view mode
--->'ak_surf_type_dict': <dict>: dictionary for surface type
---> ax_colnm_lst: <list, t:str>: column name for horizontal axis
---> zname: <str>: axis name for vertical (e.g.,  log10(pressure)) axis
---> zval: <array, (nz,)>: vertical axis 
--->'replaces': <dict>: words to be replaced when decoding line 
 
 
        
 
Returns:
--------------------------------------------------
1. lgp:<array, (nob, nz)>: log10(pres) values
2. ak: <array,  (nob, nz)>: averaging kernels
get_surf_type_id(self, surf_type, surf_type_dict=None)
find ID for surface type
 
 
Inputs:
-----------------------------------------
1.viewmode:<array/obj>: viewmodes to be checked against viewmode_dict
2.viewmode_dict:<dict>: dictionary in the form of {viewmode:id}
---if surf_type_dict==None, self.surf_type_dict will be used
 
Returns:
------------------------------------------
vid_lst:<array/obj>: id of the given surface types
get_viewmode_id(self, viewmode, viewmode_dict=None)
find ID for viewmode 
Inputs:
-----------------------------------------
1.viewmode:<array/obj>: viewmodes to be checked against viewmode_dict
2.viewmode_dict:<dict>: dictionary in the form of {viewmode:id}
---if viewmode_dict==None, self.viewmode will be used
 
 
Returns:
------------------------------------------
vid_lst:<array/obj>: id of the given viewmodes
load_data(self, flnm, datapath, viewtype, viewmode, surface, yyyy, mm, dd, **keywords)
Construct fdesc and read AK file in 
 
 
1. flnm:<str>:   name of file (reserved for future use )
2. datapath:<str>: file path
3. viewtype:<str>: instrument type 
4. viewmode:<str>: nadir or glint view
5. surface:<str>: surface type
6. yyyy: <int>: year
7. mm: <int>: month
8. dd:<int>: day 
9. keywords:<dict>: extra inputs for file reading 
----Reserved words
--->'fl_colnm_lst':<list, t:str>: names of all columns in the
--->'ak_viewmode_dict':<dict>: dictionary for view mode
--->'ak_surf_type_dict': <dict>: dictionary for surface type
--->'delim':<str>: splitor in averaging kernel (text) file
 ---> zname: <str>: axis name for vertical (e.g.,  log10(pressure)) axis
 ---> zval: <array, (nz,)>: vertical axis 
 --->'replaces': <dict>: words to be replaced when decoding line 
 
 Returns:
 -----------------------------------------
 1. is_ready:<T/F>: True when the file has been opened successfully 
 
 
 Notes:
 1. self.fdesc will be constructed by functions self.fopen
 
 2. Its data memebers will be updated by self.fread.