barronh / pseudonetcdf

PseudoNetCDF like NetCDF except for many scientific format backends
GNU Lesser General Public License v3.0
77 stars 35 forks source link

GEOS Chem Hg #9

Closed JiaoyanHuang closed 8 years ago

JiaoyanHuang commented 8 years ago

Hey Dr. Henderson,

Do you know anyone use this code to convert GEOSChem_Hg data to CMAQ_Hg icon and bcon? I am running to a problem, that for Fullchemistry, the code seems working OK, the reasonable size and data structure. However, when I try to generate CMAQ-Hg icon and bcon there is no variable related to Hg. I guess I have to add Hg in global2cmaq.py myself, I am thinking somewhere after this "if 'cb05' in option:", GCLIST and AELIST. Could you please help me on this?

Thank you

Joey

barronh commented 8 years ago

After you generate the mapping.json file, you can edit it directly.

JiaoyanHuang commented 8 years ago

Dr. Barron,

I have a question about where or how to do the unit conversion in the code. I searched around and I got confused and lost in the code. I would like to make sure my GEOS-chem outputs have same units as yours, especially, Hg has different unit which is ppt and I think other species have unit of ppb in GEOSchem output. I just want to make sure these unit conversions are correct in my modified mapping.json.

Thank you

Joey

barronh commented 8 years ago

There are three things working together here: tracerinfo.dat, the bpch reader, and pncglobal2cmaq.py.

  1. In tracerinfo.dat from a mercury run, you should see a line like the one below. This states that the data is stored as v/v and can be scaled by 1e12 to make pptv.
Hg0      Hg0 tracer                     2.010E-01  1        1 1.000E+12 pptv
  1. PseudoNetCDF automatically applies scaling consistent with the tracer info.dat

3) Then the pncglobal2cmaq.py script converts units it expects (ppbv and ppbC) to appropriate CMAQ units.

There are three easy ways to handle this: 1) You could simply update pncglobal2cmaq.py to duplicate the automatic fix for ppbv and ppbC. (around line 1405) 2) Modify your tracerinfo.dat file to update the Hg0, Hg2, and HgP SCALE and UNIT values to be appropriate for ppbv 3) Use the manual_unit option and do your own unit conversion. (e.g., "expression": "Hg0*1e-6", "manual_unit": true,). Remember, the manual_unit is applied after any scaling.

JiaoyanHuang commented 8 years ago

Dr. Barron,

Thank you for your response, just have some further questions based on your answers.

There are three easy ways to handle this: 1) You could simply update pncglobal2cmaq.py to duplicate the automatic fix for ppbv and ppbC. (around line 1405)

This is where I get lost, so I might not use this method.

2) Modify your tracerinfo.dat file to update the Hg0, Hg2, and HgP SCALE and UNIT values to be appropriate for ppbv

If I understand correctly, after changing tracerinfo, I have to re-run GEOS-chem, because GEOS-Chem data are provided by other group, so I will not select this solution.

3) Use the manual_unit option and do your own unit conversion. (e.g., "expression": "Hg0*1e-6", "manual_unit": true,). Remember, the manual_unit is applied after any scaling.

_Therefore, this is the only way I can do. In the very beginning of you code, a comment says, I don't have to worry about ppb to microgram/m3, so do not include this in expression. After turn on the manual_unit, if I understand this correctly, I still do not have to worry about the ppbv to mircrogram/m3 thing. Could you please clarify "the manualunit is applied after any scaling." a bit more?

Thank you

Joey

barronh commented 8 years ago

You do not have to re-run GEOS-Chem after you update the tracerinfo.dat file.

When GEOS-Chem saves data to the bpch file, it does not save it as ppt. It saves it as volume_i/volume_air. When you read a bpch file with PseudoNetCDF or with GAMAP, the reader automatically applies the scaling factor from tracerinfo.dat. So if you modify the tracerinfo.dat, pncglobal2cmaq.py will automatically recognize the change -- without re-running GEOS-Chem.

Do you understand?

JiaoyanHuang commented 8 years ago

OK I think I get it. Thank you !