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

Functions for write file to GEOS-Chem BPCH2 file 
 
Authors: L. Feng, Edinburgh University
History: v0.9, 2012.10.12
History: v0.95, 2013.02.01
 
 
Functions:
==========================================================
1. open_flux_bpch2_file: open file to write
2. write_flux_record: save flux data into bpch2 file
3. close_flux_bpch2_file: close bpch2 file 
4. write_ens_flux_ml: save ensemble fluxes to bpch2 file 
5. write_ens_map_ml: save map for ensemble fluxes to bpch2 file

 
Modules
       
ESA.util.bpch2_rw_py
ESA.atmosphere.compute_gc_grid
ESA.util.gen_plots
numpy
pylab
ESA.util.time_module

 
Functions
       
close_flux_bpch2_file(funit)
open_flux_bpch2_file(flnm, funit, title='flux')
open the flux file to write 
 
Inputs:
-------------------------------------------
1. flnm:<str>: file name
2. funit:<int>: file unit
3. title:<str>: title for flux data
 
Returns:
--------------------------------------------
1. funit:<int>: file unit
write_ens_flux_ml(fname, regflux, lon, lat, nz, tau0, tau1, ntracer, modelname='geos5', category='CO2_FLUX', unit='mole/s')
Save map for ensemble  to bpch2 file 
 
Inputs:
============================================
1. flnm:<str>: file name to be save 
2. regflux:<array, (nlon, nlat, [nlayer])>: emission ensemble 
3. lon:<array, (nlon)>: longitude  grid
4. lat:<array, (nlat)>: latitude  grid
5. nz:<int>: nlayer 
6. category:<str>: category of the data 
7. unit:<str>: unit of the data 
 
Returns:
============================
1. stat:<int>: status
write_ens_map_ml(flnm, regmap, lon, lat, nz, modelname='geos5', category='LANDMAP')
Save map for ensemble  to bpch2 file 
 
Inputs:
============================================
1. flnm:<str>: file name to be save 
2. regmap:<array, (nlon, nlat, [nlayer])>: emission map
3. lon:<array, (nlon)>: longitude  grid
4. lat:<array, (nlat)>: latitude  grid
5. nz:<int>: nlayer 
6. category:<str>: category of the data
write_flux_record(funit, flux, lon, lat, tau0, tau1, ntracer, modelname, category='CO2_FLUX', unit='mole/s', ifirst=1, jfirst=1, lfirst=1, centre180=None, lonres=None, latres=None)
Save emission to bpch2 file
 
Inputs:
============================================
1.funit:<int>: file unit
2.flux:<array, (nlon, nlat, [nlayer])>: emission flux
3. lon:<array, (nlon)>: longitude  grid
4. lat:<array, (nlat)>: latitude  grid
5. tau0:<float>:  starting time 
6. tau1:<float>:  end time 
7. ntracer:<int>: tracer id
8. modelname:<str>: the source of the data
9. category:<str>: category of the data 
10. unit:<str>: unit of the flux
11. ifirst: <int>: first longitude location 
12. jfirst: <int>: first latitude location
13. lfirst: <int>: first vertical location 
14. lonres: <float>: longitude resolution 
14. latres: <float>: latitude resolution 
15. centre180:<int>: central location of longitude grid 
 
 
Returns:
========================================
1. stat:<int>: status