ESA.surface.spatial_cor
index
/home/lfeng/otool/ESA/surface/spatial_cor.py

Functions for generating error correlation matrix
 
    Authors: L. Feng, Edinburgh University
    History: v0.9, 2012.06.28
    History: v0.95, 2013.03.01
    
    
    Functionso:
    ===============================================
    1. construct_region_spatial_err_cov: Generate  error correlations between regions

 
Modules
       
ESA.util.great_circle_distance
ESA.util.gen_plots
ESA.util.otool_ncfile_io
numpy.linalg
numpy
pylab

 
Functions
       
construct_grid_spatial_err_cov(lon, lat, err, cor_length, scaling_factor, dist_threshold=4)
Generate  error correlations between select_grid boxes
 
Inputs:
------------------------------------------------------
1. olon:<array, (npt,)>: longitudes for selected points
2. olat:<array, (npt,)>: latitudes for selected points
3. err:<arry, (npt,)>: uncerntity 
4. cor_len:<float>: correlation length 
5. scaling_factor:<float>: scaling factor for off-diagonl terms
6. threshold:<float>: threshold for ratio distance/cor_length where correlations to be ignored
 
Return:
---------------------------------------------------------
1. err_cov:<array, (npt, npt)>: error spatial correlation matrix
construct_region_spatial_cor_factor(lon, lat, flux, area, cor_length, dist_threshold=4)
Generate  factor for spatial error correlations between regions
 
Inputs:
------------------------------------------------------
1. lon:<array, (nlon,)>: longitudes
2. lat:<array, (nlat,)>: latitudes
3. flux:<array, (nlon, nlat, nz)>: region flux
4. area:<array, (nlon, nlat)>: area
5. cor_len:<float>: correlation length 
6. threshold:<float>: threshold for ratio distance/cor_length where correlations to be ignored
 
Return:
---------------------------------------------------------
1. cor_factor:<array, (nz, nz)>: spatial correlation factor
construct_region_spatial_err_cov(lon, lat, reg_idx_lst, reg_err_lst, cor_length, scaling_factor, dist_threshold=4)
Generate  error correlations between regions
 
Inputs:
------------------------------------------------------
1. lon:<array, (nlon,)>: longitudes
2. lat:<array, (nlat,)>: latitudes
3. reg_idx_lst:<list>: list of cells in each regions
4. reg_err_lst:<list>: list of flux error in each regions
5. cor_len:<float>: correlation length 
6. scaling_factor:<float>: scaling factor for off-diagonl terms
7. threshold:<float>: threshold for ratio distance/cor_length where correlations to be ignored
 
Return:
---------------------------------------------------------
1. err_cov:<array>: error spatial correlation matrix
get_mean_location(lon, lat, flux, area)
get flux-mean location of regions
 
Inputs:
---------------------------------------------------
 
1. lon:<array, (nlon,)>: longitudes
2. lat:<array, (nlat,)>: latitudes
3. flux:<array, (nlon, nlat, nlayer)>: region flux
4. area:<array, (nlon, nlat)>: area
 
Returns
 
----------------------------------------------------
1. clon:<array, (nz)>: mean longitude
2. clat:<array, (nz)>: mean latitude