Closed FeiYao-Edinburgh closed 5 years ago
Use xESMF! See this notebook for steps: https://github.com/geoschem/GEOSChem-python-tutorial/blob/master/Chapter03_regridding.ipynb
We are now doing everything in Python. IDL needs a license and is hard to install on EC2.
Use xESMF! See this notebook for steps: https://github.com/geoschem/GEOSChem-python-tutorial/blob/master/Chapter03_regridding.ipynb
We are now doing everything in Python. IDL needs a license and is hard to install on EC2.
I am also a big fan of Python user. Will learn according to your tutorial!
Use xESMF! See this notebook for steps: https://github.com/geoschem/GEOSChem-python-tutorial/blob/master/Chapter03_regridding.ipynb
We are now doing everything in Python. IDL needs a license and is hard to install on EC2.
Although this tutorial is very convenient to follow, it cannot be directly applied on initial_GEOSChem_rst.2x25_complexSOA_SVPOA.nc. This is because initial_GEOSChem_rst.2x25_complexSOA_SVPOA.nc contains some variables that do not have longitude or latitude like "hyam". So I just simply keep these variables when regridding but unsure if it is fine to do that way since I got error when run following nested GEOS-Chem, which indicates associations with restart files or met fields.
This is because initial_GEOSChem_rst.2x25_complexSOA_SVPOA.nc contains some variables that do not have longitude or latitude like "hyam".
hyam
is simply a 1D vertical coordinate that does not need regridding. You should be able to just add it to the new nested grid file. Something like ds_nested['hyam'] = ds_global['hyam']
will do.
This is because initial_GEOSChem_rst.2x25_complexSOA_SVPOA.nc contains some variables that do not have longitude or latitude like "hyam".
hyam
is simply a 1D vertical coordinate that does not need regridding. You should be able to just add it to the new nested grid file. Something likeds_nested['hyam'] = ds_global['hyam']
will do.
OK. Something confirmed. Thanks.
BTW, when do conservative regridding, could you help me understand the following parameters? global_grid_with_bounds = {'lon': ds['lon'].values, 'lat': ds['lat'].values, 'lon_b': np.linspace(-180-5/2, 175+5/2, 73), 'lat_b': np.linspace(-92, 92, 47).clip(-90, 90), # fix half-polar cells } I know -180 and 175 are the start and end of the longitude, so by ±5/2, we got 72+1=73 grids. But this could produce longitude less than -180, is it OK?
How about latitude? Where do -92 and 92 come from (-90-4/2,90+4/2)? When comes to 2x25 global simulation, how? I see start and end latitude during these two grids are -89,89 and -89.5,89.5, respectively. I am not very sure about these calculations.
How about latitude? Where do -92 and 92 come from (-90-4/2,90+4/2)?
This comes from GEOS-Chem's (somewhat confusing) half-polar grids (grid boxes around the poles are half in latitude): http://wiki.seas.harvard.edu/geos-chem/index.php/GEOS-Chem_horizontal_grids
How about latitude? Where do -92 and 92 come from (-90-4/2,90+4/2)?
This comes from GEOS-Chem's (somewhat confusing) half-polar grids (grid boxes around the poles are half in latitude): http://wiki.seas.harvard.edu/geos-chem/index.php/GEOS-Chem_horizontal_grids
Thanks for the hint included in the bracket. Although still confusing, I guess I have figured out where were -92 and 92 calculated from.
-89-4/2-4/2/2=-92
89+4/2+4/2/2=92
Similarly, if for 2x25 grid, it would be:
-89.5-2/2-2/2/2=-91
89.5+2/2+2/2/2=91
Sorry for disturbing you again. I just wonder how to maintain attribute information with xESMF?
I have run Chapter03_regridding step by step but found the final regridded restart file missed attribute information contained in the original restart files (You can easily see this by running ds_result['lon'],ds['lon']
). As such, the nested GEOS-Chem will complain with the following information.
HEMCO ERROR: illegal longitude unit in ./GEOSChem.Restart.20160701_0000z.nc4 - Must be `degrees_east`.
I believe it is must be very easy to maintain those attribute information by using Python. Would be greatly grateful if you could give some hints. Thanks in advance!
I believe it is must be very easy to maintain those attribute information by using Python.
ds['lon'].attrs['units'] = 'degrees_east'
will do. Sorry for this unsmooth experience -- xESMF is a general-purpose tool that is not geared to GEOS-Chem restart files. If time allows we should add a high-level regridding function in https://github.com/geoschem/gcpy
Closing if no further questions
It seems that IDL has not been installed on ami-0ee8892ae47c31be1. Are there any other tools that can regrid and crop restart files in preparation for nested simulation?