-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JRA55 dataset tool and documentation (#582)
* Add JRA55 dataset tool Add configuration/tools/jra55_datasets directory and scripts Move convert_restarts to configuration/tools/cice4_restart_conversio Add tools section to the developer guide Update tested compiler versions Change "compliance" to "validation" in documentation when discussing QC testing. * update documentation
- Loading branch information
Showing
8 changed files
with
683 additions
and
24 deletions.
There are no files selected for viewing
File renamed without changes.
441 changes: 441 additions & 0 deletions
441
configuration/tools/jra55_datasets/interp_jra55_ncdf_bilinear.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/csh | ||
# ----- | ||
# This is a script that worked on NCAR's cheyenne in March, 2021. | ||
# It converts raw JRA55 datasets to a format that CICE can use. | ||
# This tools is documented in the CICE user guide. The | ||
# tool interpolates to a CICE grid and does things like convert units. | ||
# ----- | ||
# The interp_jra55_ncdf_bilinar.py script was placed in "scripts_dir" | ||
# The raw JRA55 datasets were placed in "jra55_data_dir" | ||
# The CICE grid files were places in "jra55_data_dir" | ||
# The model output was created in "output_data_dir" | ||
# ----- | ||
#PBS -N make_forcing | ||
#PBS -q regular | ||
#PBS -l select=1:ncpus=4:mpiprocs=4 | ||
#PBS -l walltime=06:00:00 | ||
#PBS -A P93300665 | ||
|
||
set scripts_dir = "/glade/work/tcraig/cice-consortium/cice.jra55_tool/configuration/tools/jra55_datasets" | ||
set jra55_data_dir = "/glade/scratch/dbailey/JRA_DATA/" | ||
set output_data_dir = "/glade/scratch/tcraig/JRA_DATA_output" | ||
set grid = "gx3" | ||
set cice_grid_file = "grid_gx3.nc" | ||
|
||
module load python/3.7.9 | ||
source /glade/u/apps/opt/ncar_pylib/ncar_pylib.csh default | ||
module load nco | ||
|
||
mkdir -p ${output_data_dir} | ||
cd ${output_data_dir} | ||
|
||
ln -s ${jra55_data_dir}/fcst_*.nc . | ||
ln -s ${jra55_data_dir}/grid_*.nc . | ||
|
||
ln -s ${scripts_dir}/interp_jra55_ncdf_bilinear.py . | ||
|
||
#foreach year ( 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 ) | ||
foreach year ( 1997 ) | ||
|
||
./interp_jra55_ncdf_bilinear.py ${year}010100_${year}033121 ${cice_grid_file} JRA55_${grid}_03hr_forcing_${year}-q1.nc | ||
./interp_jra55_ncdf_bilinear.py ${year}040100_${year}063021 ${cice_grid_file} JRA55_${grid}_03hr_forcing_${year}-q2.nc | ||
./interp_jra55_ncdf_bilinear.py ${year}070100_${year}093021 ${cice_grid_file} JRA55_${grid}_03hr_forcing_${year}-q3.nc | ||
./interp_jra55_ncdf_bilinear.py ${year}100100_${year}123121 ${cice_grid_file} JRA55_${grid}_03hr_forcing_${year}-q4.nc | ||
|
||
ncrcat JRA55_${grid}_03hr_forcing_${year}-??.nc JRA55_${grid}_03hr_forcing_${year}.nc | ||
|
||
/bin/rm -f ${jra55_data_dir}/JRA55_${grid}_03hr_forcing_${year}-??.nc | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
:tocdepth: 3 | ||
|
||
.. _tools: | ||
|
||
Tools | ||
============= | ||
|
||
|
||
.. _cice4restart: | ||
|
||
CICE4 restart conversion | ||
------------------------- | ||
|
||
There is a Fortran program in **configuration/tools/cice4_restart_conversion** | ||
that will help convert a CICE4 restart file into a CICE5 restart file. | ||
There is a bit of documentation contained in that source code about how | ||
to build, use, and run the tool. A few prognostic variables were changed | ||
from CICE4 to CICE5 which fundamentally altered the fields saved to | ||
the restart file. See | ||
**configuration/tools/cice4_restart_conversion/convert_restarts.f90** | ||
for additional information. | ||
|
||
|
||
.. _jra55datasettool: | ||
|
||
JRA55 forcing datasets | ||
------------------------ | ||
|
||
This section describes how to generate JRA55 forcing data for the CICE model. | ||
Raw JRA55 files have to be interpolated and processed into input files specifically | ||
for the CICE model. A tool exists in **configuration/tools/jra55_datasets** | ||
to support that process. | ||
The raw JRA55 data is obtained from the NCAR/UCAR Research Data Archive and | ||
the conversion tools are written in python. | ||
|
||
Requirements | ||
********************* | ||
|
||
Python3 is required, and the following | ||
python packages are required with the tested version number in parenthesis. These | ||
versions are not necessarily the only versions that work, they just indicate what | ||
versions were used when the script was recently run. | ||
|
||
- python3 (python3.7.9) | ||
- numpy (1.18.5) | ||
- netCDF4 (1.5.5) | ||
- ESMPy (8.0.0) | ||
- xesmf (0.3.0) | ||
|
||
NCO is required for aggregating the output files into yearly files. | ||
|
||
- netcdf (4.7.4) | ||
- nco (4.9.5) | ||
|
||
Raw JRA55 forcing data | ||
************************* | ||
|
||
The raw JRA55 forcing data is obtained from the UCAR/NCAR Research Data Archive, | ||
https://rda.ucar.edu/. You must first register (free) and then sign in. The | ||
"JRA-55 Reanalysis Daily 3-Hourly and 6-Hourly Data" is ds628.0 and can be found here, | ||
https://rda.ucar.edu/datasets/ds628.0. | ||
|
||
The "Data access" tabs will provide a list of product categories. | ||
The JRA55 data of interest are located in 2 separate products. Winds, air | ||
temperature, and specific humidity fields are included in "JRA-55 | ||
3-Hourly Model Resolution 2-Dimensional Instantaneous Diagnostic Fields". | ||
Precipitation and downward radiation fluxes are found in "JRA-55 3-Hourly | ||
Model Resolution 2-Dimensional Average Diagnostic Fields". (Note the | ||
difference between instantaneous and averaged data products. There are several | ||
JRA55 datasets available, you will likely have to scroll down the page to find | ||
these datasets.) Data are also available on a coarser 1.25° grid, but the tools | ||
are best used with the native TL319 JRA55 grid. | ||
|
||
The fields needed for CICE are | ||
|
||
- specific humidity (3-hourly instantaneous), Qa | ||
- temperature (3-hourly instantaneous), Tair | ||
- u-component of wind (3-hourly instantaneous), uatm | ||
- v-component of wind(3-hourly instantaneous), vatm | ||
- downward longwave radiation flux (3 hourly average), flw | ||
- downward solar radiation flux (3 hourly average), fsw | ||
- total precipitation (3 hourly average), fsnow | ||
|
||
To customize the dataset for download, choose the “Get a Subset” option. Select | ||
the desired times in the “Temporal Selection” section, then click on desired parameters | ||
(see list above). After clicking continue, select Output Format "Converted to NetCDF". | ||
|
||
Once the data request is made, an email notification will be sent with a dedicated | ||
URL that will provide a variety of options for downloading the data remotely. | ||
The data will be available to download for 5 days. | ||
The raw data consists of multiple files, each containing three months of data for | ||
one field. | ||
|
||
|
||
Data conversion | ||
************************* | ||
|
||
The script, **configuration/tools/jra55_datasets/interp_jra55_ncdf_bilinear.py**, | ||
converts the raw data to CICE input files. | ||
|
||
The script uses a bilinear regridding algorithm to regrid from the JRA55 grid to | ||
the CICE grid. The scripts use the Python package ‘xesmf’ to generate bilinear | ||
regridding weights, and these regridding weights are written to the file defined by | ||
the variable "blin_grid_name" in **interp_jra55_ncdf_bilinear.py**. This filename | ||
can be modified by editing **interp_jra55_ncdf_bilinear.py**. | ||
The weights file can be re-used if interpolating different data on the same grid. | ||
Although not tested in this version of the scripts, additional regridding options | ||
are available by xesmf, including ‘conservative’ and ‘nearest neighbor’. These | ||
methods have not been tested in the current version of the scripts. The reader | ||
is referred to the xESMF web page for further documentation | ||
(https://xesmf.readthedocs.io/en/latest/ last accessed 5 NOV 2020). | ||
|
||
To use the **interp_jra55_ncdf_bilinear** script, do :: | ||
|
||
python3 interp_jra55_ncdf_bilinear.py –h | ||
|
||
to see the latest interface information :: | ||
|
||
usage: interp_jra55_ncdf_bilinear.py [-h] JRADTG gridout ncout | ||
|
||
Interpolate JRA55 data to CICE grid | ||
|
||
positional arguments: | ||
JRADTG JRA55 input file date time group | ||
gridout CICE grid file (NetCDF) | ||
ncout Output NetCDF filename | ||
|
||
optional arguments: | ||
-h, --help show this help message and exit | ||
|
||
Sample usage is :: | ||
|
||
./interp_jra55_ncdf_bilinear.py 1996010100_1996033121 grid_gx3.nc JRA55_gx3_03hr_forcing_1996-q1.nc | ||
./interp_jra55_ncdf_bilinear.py 1996040100_1996063021 grid_gx3.nc JRA55_gx3_03hr_forcing_1996-q2.nc | ||
./interp_jra55_ncdf_bilinear.py 1996070100_1996093021 grid_gx3.nc JRA55_gx3_03hr_forcing_1996-q3.nc | ||
./interp_jra55_ncdf_bilinear.py 1996100100_1996123121 grid_gx3.nc JRA55_gx3_03hr_forcing_1996-q4.nc | ||
|
||
In this case, the 4 quarters of 1996 JRA55 data is going to be interpolated to the gx3 grid. | ||
NCO can be used to aggregate these files into a single file :: | ||
|
||
ncrcat JRA55_gx3_03hr_forcing_1996-??.nc JRA55_${grid}_03hr_forcing_1996.nc | ||
|
||
NOTES | ||
|
||
- The scripts are designed to read a CICE grid file in netCDF format. This is the "grid_gx3.nc" file above. The NetCDF grid names are hardcoded in **interp_jra55_ncdf_bilinear.py**. If you are using a different grid file with different variable names, this subroutine needs to be updated. | ||
- All files should be placed in a common directory. This includes the raw JRA55 input files, the CICE grid file, and **interp_jra55_ncdf_bilinear.py**. The output files will be written to the same directory. | ||
- The script **configuration/tools/jra55_datasets/make_forcing.csh** was used on the NCAR cheyenne machine in March, 2021 to generate CICE forcing data. It assumes the raw JRA55 is downloaded, but then sets up the python environment, links all the data in a common directory, runs **interp_jra55_ncdf_bilinear.py** and then aggregates the quarterly data using NCO. | ||
- The new forcing files can then be defined in the **ice_in** namelist file using the input variables, ``atm_data_type``, ``atm_data_format``, ``atm_data_dir``, ``fyear_init``, and ``ycycle``. See :ref:`forcing` for more information. | ||
- The total precipitation field is mm/day in JRA55. This field is initially read in as snow, but prepare_forcing in **ice_forcing.F90** splits that into rain or snow forcing depending on the air temperature. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,5 +17,6 @@ Developer Guide | |
dg_forcing.rst | ||
dg_icepack.rst | ||
dg_scripts.rst | ||
dg_tools.rst | ||
dg_other.rst | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters