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

Functions for reading  Cloud PDF file 
 
Authors: L. Feng, Edinburgh University
History: v0.9, 2012.06.28
History: v0.95, 2013.02.26
 
Functions
=================================================
 
# file access
 
1. get_cld_column_name:  check names of columns in AK file
2. get_cld_surface_type: check names of surface types
 
3. cld_rescale: rescale CLD axis 
 
4. open_cloud_file: set up class file_desc_cl for file access
5. read_cloud_file: read cloud   data into class file_desc_cl
6. close_cloud_file: delete class file_desc_cl
7. get_data: get cloud data at given locations
 
# file (dataset) manage
 
8. get_cloud_file_ref: check file reference
9. add_cloud_data: add cloud data to the 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_cloud_data(fdesc, ref, **keywords)
add the cloud 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
 
Returns:
=====================================
1. idx:<int>: index of the data set with reference =ref.
close_cloud_file(fdesc)
Close fdesc file 
 
Inputs:
--------------------------------------------------
1. fdesc:<file_desc_cl>: class for file access
 
Returns:
1. None
get_cld_column_name()
check column names defined in cloud file 
 
Returns
---------------------------------------
1. fl_colnm_lst:<list, str>: name of columns in file
get_cld_file_ref(yyyy, mm, dd, **keywords)
check file reference
for cloud 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.
get_cloud_data(fdesc, olon, olat, oyyyy, omm, odd, osec, do_debug=False, **keywords)
read cloud 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. 
 
Returns:
================================================
cld:<array, (nob, )>: cloud at the (olon, olat, otime)
open_cloud_file(datapath, flnm, yyyy, mm, dd, **keywords)
setup fdesc for average kernal data
 
Inputs:
-----------------------------------------------------------
1. flnm:<str>:   name of file (reserved for future use )
2. datapath:<str>: file path
3. yyyy: <int>: year
4. mm:<int>: month
5. dd: <int>: day 
6:  keywords:<dict>: extra for reading file
 
---Reserved Words:
--->'fl_colnm_lst': <list, t:str>: names of all 
   columns in the cloud file 
 
--->'delim':<str>: separator in the columns 
 
Returns:
--------------------------------------------------------
1. fdesc:<file_desc_cl>: class for file access
read_cloud_file(fdesc, **keywords)
Read cloud  data into fdesc
 
Inputs:
--------------------------------------------------
1. fdesc:<grdfile_desc_cl>: class for file access
2. keywords:<dict>: extra for data reading. 
 
---Reserved Entries
--->replaces: <dict, old:new>: texts should be replaced. 
---> zname: <str>: axis name for vertical (e.g.,  log10(pressure)) axis
---> zval: <array, (nz,)>: vertical axis 
---> ax_colnm_lst: <list, t:str>: column name for horizontal axis
---> fl_colno_lst:<lst, t:int>: columns to be read 
    
 
Returns:
-------------------------------------
1. fdesc:<grdfile_desc_cl>: file access 
 
Notes:
-------------------------------------
1.fdesc.grd_lst and fdesc.gdata_lst will store 1) grid; and 2) gridded data

 
Data
        cld_axis_name = ['lon', 'lat']
cld_data_start = 0
cld_filename_format = 'meancloud_frac_XMONTHX_landsea.dat'
cld_header_start = -1
cld_varname_dict = {'cloud': 'val', 'lat': 'lat', 'lon': 'lon'}
cld_zname = None
cld_zval = None
def_cld_colnm_lst = ['lat', 'lon', 'val']
def_cld_colno_lst = [0, 1, 2]
def_cld_lvl = array([ 0. , 0.05, 0.1 , 0.15, 0.2 , 0.25,... 0.7 , 0.75, 0.8 , 0.85, 0.9 , 0.95])
def_cld_replaces = {'-9999.0': '-999.0'}