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

Functions for reading  AOD PDF file 
 
Authors: L. Feng, Edinburgh University
History: v0.9, 2012.06.28
History: v0.95, 2013.02.24
 
Functions
=================================================
1. get_aod_column_name:  check names of columns in AOD file.
2. get_aod_surface_type: check names of surface types.
3. aod_rescale: rescale AOD axis values.
4. open_aod_file: set up class file_desc_cl for file access.
5. read_aod_file: read AOD  data into class file_desc_cl.
6. close_aod_file: delete class file_desc_cl.
7. get_aod_file_ref: check file reference
8. get_aod_data: get aod data at given locations
9. add_aod_data: add AOD data to the data list

 
Modules
       
ESA.util.gen_plots
ESA.util.message_m
numpy
ESA.util.otool_grdfile_io
ESA.util.otool_obj
pylab
ESA.util.time_module

 
Functions
       
add_aod_data(fdesc, ref, **keywords)
add AOD data defined by ref to the fdesc
 
Inputs:
=====================================
1. fdesc:<grdfile_io_cl>: class for file access
2. ref:<str/numeric>: reference for data sets read from file 
3. keywords:<dict>: extra parameters
 
--->ax_colnm_lst:<list, t:str>: column names for 'horizontal' (such as lon and lat) axises     
--->zname: <str>: axis name for vertical (i.e, log10(pressure)) axis
--->zval: <array, (nz,)>: vertical axis 
--->'replaces':<dict>: words to be replaced when decoding line 
 
Returns:
=====================================
1. idx:<int>: index of the data set with reference =ref.
close_aod_file(fdesc)
Close fdesc file 
 
Inputs:
--------------------------------------------------
1. fdesc:<file_desc_cl>: class for file access
 
Returns:
1. None
get_aod_column_name()
check column names defined in AK file 
    
Returns
---------------------------------------
1. fl_colnm_lst:<list, str>: name of columns in file
get_aod_data(fdesc, olon, olat, oyyyy, omm, odd, osec, do_debug=False, **keywords)
read aod data at given point 
Inputs:
---------------------------------------
1. fdesc:<grdfile_io_cl>: file access 
2. olon: <array, (nob,)>: longitude
3. olat: <array, (nob,)>: latitude
4. oyyyy:<array (nob)>: year (for future use)
--- oyyyy can also be a single value 
 
5. omm: <int/array (nob)>: month 
--- omm can also be a single value 
 
6. odd:<int/array (nob)>: day (for future use)
7. osec:<float/array (nob)>: seconds   (for future use)
 
8. keywords:<dict>: extra inputs
 
---Reserved Entries
---common_ref:<str/numeric>: the reference shared by observations. 
--->ax_colnm_lst:<list, t:str>: column names for 'horizontal' (such as sza and aod) axises  
--->zname: <str>: axis name for vertical (i.e, log10(pressure)) axis
--->zval: <array, (nz,)>: vertical axis 
--->'replaces':<dict>: words to be replaced when decoding line 
 
 
Returns:
================================================
1.zval:<array, (nob,nz)>: aod values
2.aod_pb:<array, (nob,nz)>: aod PDF at the (olon, olat, otime)
get_aod_file_ref(yyyy, mm, dd, **keywords)
check file reference
for aod climatology, the reference number is 
climatology months [1, 4, 7, 10]
    
Inputs:
----------------------------------------------------
1. yyyy:<array, (ntime,)>: year
2. mm: <array, (ntime,)>: month
3. dd:<array, (ntime,)>: dd
4. keywords:<dict>: extra information
 
Returns:
------------------------------------------------------
1. ref:<int>: reference number 
--- ref can be [1, 4, 7 or  10] for climatology month.
open_aod_file(datapath, flnm, yyyy, mm, dd, **keywords)
setup fdesc for aerosol optical depth file
Inputs:
-----------------------------------------------------------
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. yyyy: <int>: year
6. doy: <int>: day of year 
7. keywords:<dict>: extra for reading file 
---Reserved words
---fl_colnm_lst:<list, t:str>: names of all columns in the averaging kernel file 
 
Returns:
--------------------------------------------------------
1. fdesc:<file_desc_cl>: class for file access
read_aod_file(fdesc, **keywords)
Read averaging kernel data into fdesc
 
Inputs:
--------------------------------------------------
1. fdesc:<file_desc_cl>: class for file access
2. keywords:<dict>: extra for file reading 
---Reserved keys
 
--->ax_colnm_lst:<list, t:str>: column names for 'horizontal' (such as sza and aod) axises  
--->zname: <str>: axis name for vertical (i.e, log10(pressure)) axis
--->zval: <array, (nz,)>: vertical axis 
--->'replaces':<dict>: words to be replaced when decoding line 
 
Returns:
-------------------------------------
1. ndata:<int>: size of AK table 
 
 
Notes:
-------------------------------------
1.fdesc.grd and fdesc.gdata will store 1) grid; and 2) gridded table

 
Data
        aod_axis_name = ['lon', 'lat']
aod_data_start = 0
aod_filename_format = 'modis_misr_ccm_histo_XMONTHX.dat'
aod_header_start = -1
aod_varname_dict = {'aod': 'aod', 'lat': 'lat', 'lon': 'lon'}
aod_zname = 'aod'
aod_zval = array([ 0. , 0.05, 0.1 , 0.15, 0.2 , 0.25,... 0.75, 0.8 , 0.85, 0.9 , 0.95, 1. ])
def_aod_colnm_lst = ['lat', 'lon']
def_aod_colno_lst = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, ...]
def_aod_lvl = array([ 0. , 0.05, 0.1 , 0.15, 0.2 , 0.25,... 0.75, 0.8 , 0.85, 0.9 , 0.95, 1. ])
def_aod_replaces = {}