-
Notifications
You must be signed in to change notification settings - Fork 13
Converting Cubed Sphere Data to Lat Lon
The GEOSgcm model can output data directly on the Cubed-Sphere grid via the MAPL History component. Users have multiple options to convert this data to a lat-lon grid if they prefer to interact with the data in that manner. This will lay out all available options to users both on NASA HPC clusters and for those users outside of the NASA HPC framework.
As part of the build of the GEOSgcm fixture the MAPL library is built which contains a utility to convert GEOS Cubed-Sphere data to Lat-Lon. This does require MPI so it must be run on a compute node at NCCS or NAS if you are at those centers. The directions for use can be found here: https://github.com/GEOS-ESM/MAPL/wiki/Regrid_Util.x-User-Guide
The Cubed-Sphere output can also be regridded using python, ESMF and the NCO utilities.
If you are at NCCS or NAS a python with the proper modules installed and the needed utilities can be found in several ways. If you have built GEOS-5 then sourcing g5_modules will be sufficient to load a python that will work and get the ESMF and NCO in your path. From there you can run the python utilities described below.
If you have not have checkout of GEOS-5 or do not want to checkout GEOS-5 you can directly use baselibs by checking out the GEOS_env repository that is part of the GEOS-ESM at https://github.com/GEOS-ESM/ESMA_env.git. This will put you on the main branch and there should a g5_modules file there you can source that will load the necessary modules at either NCCS or NAS.
Finally your can load the Mamba python module at NCCS or NAS (be sure to purge your modules first).
If you are outside of NCCS the easiest way to obtain these is to use the Mamba python distribution that can be easily installed in user space on Linux and can be configured to include NCO and ESMF. To install Mamba Python do the following three steps:
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
bash Mambaforge-Linux-x86_64.sh -b -p /path/to/install
mamba install 'nco=4.9.9' 'esmf=8.1.1=*mpi*' netcdf4 scipy
Where /path/to/install is where you want to install it in a directory you have write access to. Once installed you need to make sure the mambpy bin directory from the installation is in your path.
Once you have this we have created some python utilities to convert a GEOS Cubed-Sphere file to a lat-lon gridded file. In brief these utilities automate the following steps:
- creating the scrip representation of the Cubed-Sphere grid from the input file
- converting the input file to the scrip format
- creating a descriptor file for the lat-lon grid
- running ESMF_RegridWeightGen to generate the regridding weights based on the previous two files
- using the weights to run ncremap to do the regridding with the converted input file
- running ncks to clean up unnecessary variables in the output.
- cleaning up temporary files
These python utilities can be obtained here by cloning the following repository: https://github.com/GMAO-SI-Team/regridding-tools.git Once you have cloned this you will find multiple python utilities, but the one you should use is convert_tool.py which given an input file will perform the required steps to obtain a lat-lon version of the file.
The tool has the following options:
- "-n", "--input_file" The input Cubed-Sphere file
- "-o", "--output_file" The output lat-lon file name
- "-i", "--im_world" The number of longitudinal points in the output lat-lon grid
- "-j", "--jm_world" The number of latitudinal points in the output lat-lon grid
- "-d", "--dateline" Either DC or DE, this controls whether the center or edge of the grid is on the dateline
- "-p", "--pole" Either PC or PE, this controls either the center of the pole point is at the pole or half a delta below the pole
- "-m", "--method" optional, default bilinear, other option conserve, this is the regrid method used
- "--grid_dir" optional, specify a path where the cubed-sphere grid descriptor and weights will be generated and stored. If the files are already found will not recompute. Recommended to save time when regridding multiple files. If not found created and then deleted in the current directory
- "--num_tasks" optional, default 1, if on a platform that allows it (i.e. a compute node as NCCS or NAS) use more than 1 mpi task when generating the weights.