Visualizing data in Cubed-Sphere grid: Difference between revisions

Created page with "#==== in progress ==== == Cubed-Sphere grid background == The GEOS-5 now has products that are stored natively in cubed-sphere grid. The utilities listed here may help users..."
 
No edit summary
 
(34 intermediate revisions by 2 users not shown)
Line 1: Line 1:
#==== in progress ====
{{rightTOC}}
 
 
== Cubed-Sphere grid  background ==
== Cubed-Sphere grid  background ==


The GEOS-5 now has products that are stored natively in cubed-sphere grid. The utilities listed here may help users visualize the data in cubed-sphere grid or map the data to lat-lon grid.
Several GEOS-5 products are now produced on the native cubed-sphere computational grid.   Although this format may be less familiar, this choice has several advantages for some user communities.  In particular, the Chemical Transport Modeling (CTM) community can use native mass-flux products to significantly improve conservation properties when running with GEOS-5. To minimize transition difficulties for GEOS-5 data consumers, this page provides instructions for visualizing cubed-sphere data products using a variety of common packages:  python, Matlab, IDL, and GRaDS, and Panoply. This page also provides instructions for downloading and building an executable that can regrid cubed-sphere products onto a traditional lat-lon grid.


== Fortran ==
== Fortran ==


To map the cubed-sphere grid data to lat-lon gird data, the program c2l_CFIO_offline.x  is built with AGCM at src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/FVdycoreCubed_GridComp. The example configure file c2l_CFIO_offline.rc is also generated. It should be run as mpirun –np 6 ./c2l_CFIO_offline.x. This will produce a lat-lon grid data file whose name is configured in c2l_CFIO_offline.rc  
To map the cubed-sphere grid data to lat-lon gird data, the program c2l_CFIO_offline.x  is built with AGCM at src/GEOSgcs_GridComp/GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSsuperdyn_GridComp/FVdycoreCubed_GridComp. The example configure file c2l_CFIO_offline.rc is also generated. It should be run as mpirun –np 6 ./c2l_CFIO_offline.x. This will produce a lat-lon grid data file whose name is configured in c2l_CFIO_offline.rc. Users then can use their familiar tools to visualize the lat-lon grid data.


== Matlab ==
== Matlab ==
Users can find a “GridUtils” package in MATLAB ( R2015b and R2016a) at http://wiki.seas.harvard.edu/geos-chem/index.php/GEOS-Chem_HP_Output_Data#MATLAB_.28Cubed-sphere_and_regular_data.29 . The instructions are straight forward. Although it is intended for GCHP, it can be used for all the other outputs that uses the same formats as that of GCHP.
Users can find a “GridUtils” package in MATLAB ( R2015b and R2016a or above) at http://wiki.seas.harvard.edu/geos-chem/index.php/GEOS-Chem_HP_Output_Data#MATLAB_.28Cubed-sphere_and_regular_data.29 . The instructions are straight forward. Although it is intended for GCHP, it can be used for all the other outputs that use the same formats as that of GCHP. For the new format of the output, users can use the matlab codes here to transform the data to lat-lon grid and visualize the products.
 
#Download source codes and save them as driver.m, CSnative.m, extendFace1.m,extendFace3.m, extendFace4.m, extendFace6.m, and the example data file respectively to the same folder. The extendFace(1-6).m are used to fill the seam between cubed-sphere faces. Face2 and Face5 are not necessary to be  extended because they are redundant.
#Users should specify the time, level , variable’s name and file name in driver.m. The test data file can be downloaded [[Media:TEST7.geosgcm_prog.20000415_0000z.nc4]]
#Run with Matlab: % driver
 
==== [[Recipe: Matlab program  driver for visualization| driver.m]] ====
==== [[Recipe: Matlab program  converts cubed-sphere to latlon| CSnative.m]] ====
==== [[Recipe: Matlab program  fills the seam| extendFace1.m]] ====
==== [[Recipe: Matlab program  fills the seam3| extendFace3.m]] ====
==== [[Recipe: Matlab program  fills the seam4| extendFace4.m]] ====
==== [[Recipe: Matlab program  fills the seam6| extendFace6.m]] ====
 
== Python ==
For the new format of the output, users can use the python codes here to transform the data to lat-lon grid and visualize the products:
#Install python 3 (or above) and the modules numpy, netcdf4, matplotlib and mpl_toolkits  on your computer.
#Download source codes CSnative.py, example1.py, example2.py and the example data file  [[Media:TEST7.geosgcm_prog.20000415_0000z.nc4]] the same folder.
#To show example 1, $python example1.py
#To show example 2, $python example2.py
 
==== [[Recipe: python program  reads cubed-sphere data| CSnative.py]]====
==== [[Recipe: python program  example1 | example1.py]] ====
==== [[Recipe: python program  example2| example2.py]] ====


== IDL ==
== IDL ==
To use IDL codes and the pbs scripts to visualize a large number of GEOS-5 cubed-sphere products:
#Download the codes and save them as cube_to_latlon.pro, winds_cube_to_latlon.pro, convert_latlon.j (pbs script) , idlstart ( environment ) and README.
#The README file explains all the scripts and the steps visualizing the data. Although all the examples and data are on discover, it is not difficult for users to make changes to run the programs on the other systems.
==== [[Recipe: README| README]] ====
==== [[Recipe: environment | idlstart]]====
==== [[Recipe: pbs script | Ops12KM_R_to_latlon.j]]====


Dr. Bill Putman has created many IDL programs to visualize GEOS-5’s outputs. Users may find some useful tools at  /discover/nobackup/projects/gmao/osse2/IDL3 . The program read_and_interpolate_cube.pro can read data in the cube-sphere grid in NetCDF file, interpolate the data , map the data in Lat-Lon format and plot. The program cube_to_latlon.pro can use read_and_interpolate_cube.pro to convert the variables in cube-sphere grid to lat-lon grid and write the variable to NetCDF files.
==== [[Recipe: cube_lat_laon |cube_to_latlon.pro]]====
==== [[Recipe: winds | winds_cube_to_latlon.pro]]====


== GrAds ==
== GrADS ==


To  use GRADS to display cube-sphere grid data in a NetCDF file, the path should be in the PATH environment:
To  use GrADS to display cube-sphere grid data in a NetCDF file, the path should be in the PATH environment:
/discover/nobackup/projects/gmao/share/dasilva/opengrads/Contents/grads
/discover/nobackup/projects/gmao/share/dasilva/opengrads/Contents/grads


Then the users can follow the steps:
Then the users can follow the steps. First, we assume a version of GEOS-5 is available.
1) run src/GMAO_Shared/GEOS_Util/plots/configure. This will produce a .quickplotrc in that directory
# run $ESMADIR/src/GMAO_Shared/GEOS_Util/plots/configure. This will produce a .quickplotrc in that directory
2) source .quickplotrc
# source $ESMADIR/src/GMAO_Shared/GEOS_Util/plots/.quickplotrc
3) run grads.  
# run grads
4) run command dc to plot the cube-sphere grid NetCDF file. Users can get help by just run dc without any argument.
# sdfopen file.nc4
# run command <tt>dc</tt> to plot the cube-sphere grid NetCDF file. Users can get help by just run dc without any argument.
 
==Panoply==
Now the Panoply after version 4.7.0 can view the native cubed-sphere products. This software can be downloaded from https://www.giss.nasa.gov/tools/panoply/
 
==Converting (interpolating) cubed-sphere data to Lat-Lon data==
 
For some purposes it will be impractical to adapt existing analysis tools to directly work with MERRA cubed-sphere products.  In such cases, users will need to build an executable that can interpolate cubed-sphere data to a set of predefined lat-lon resolutions.  (Note that special care must be taken for vector data, e.g., (u,v).)
 
The building requirements and instruction can be found here  https://geos5.org/wiki/index.php?title=Building_Baselibs . The executable program cube2laton can be used to convert (or interpolate) the data
 
 
Converting data:
 
%  cube2latlon <in-file> <out-file> <target-resolution>
 
E.g.,
 
% cube2latlon  merra.nc  latlon.nc  4x5