-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JRA55 dataset tool and documentation #582
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,25 +161,25 @@ To add a new test (for example newtest), several files may be needed, | |
Generating a new test, particularly the **test_newtest.script** usually takes some iteration before | ||
it's working properly. | ||
|
||
.. _dev_compliance: | ||
.. _dev_validation: | ||
|
||
Code Compliance Script | ||
Code Validation Script | ||
---------------------- | ||
|
||
The code compliance test validates non bit-for-bit model changes. The directory | ||
**configuration/scripts/tests/QC** contains scripts related to the compliance testing, | ||
and this process is described in :ref:`compliance`. This section will describe a set | ||
of scripts that test and validate the code compliance process. This should be done | ||
when the compliance test or compliance test scripts (i.e., ``cice.t-test.py``) are modified. | ||
Again, this section **documents a validation process for the compliance scripts**; it does not | ||
describe to how run the compliance test itself. | ||
The code validation (QC) test validates non bit-for-bit model changes. The directory | ||
**configuration/scripts/tests/QC** contains scripts related to the validation testing, | ||
and this process is described in :ref:`validation`. This section will describe a set | ||
of scripts that test and validate the code validation process. This should be done | ||
when the validation test or validation test scripts (i.e., ``cice.t-test.py``) are modified. | ||
Again, this section **documents a validation process for the validation scripts**; it does not | ||
describe to how run the validation test itself. | ||
|
||
Two scripts have been created to automatically validate the code compliance script. | ||
Two scripts have been created to automatically validate the code validation script. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of "validate the code validation script", maybe "validate the QC script"? This is probably why we used 'compliance' before. (also in other files) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. |
||
These scripts are: | ||
|
||
* ``gen_qc_cases.csh``, which creates the 4 test cases required for validation, | ||
builds the executable, and submits to the queue. | ||
* ``compare_qc_cases.csh``, which runs the code compliance script on three combinations | ||
* ``compare_qc_cases.csh``, which runs the code validation script on three combinations | ||
of the 4 test cases and outputs whether or not the correct response was received. | ||
|
||
The ``gen_qc_cases.csh`` script allows users to pass some arguments similar | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
: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** | ||
eclare108213 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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) | ||
- argparse | ||
- datetime | ||
|
||
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 signin. 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 on the model grid are included in "JRA-55 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not on the model grid... on the JRA55 grid? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cleaned that up. |
||
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 | ||
eclare108213 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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 | ||
************************* | ||
|
||
**configuration/tools/jra55_datasets/interp_jra55_ncdf_bilinear.py** is run to | ||
convert 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 weight, 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. | ||
|
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 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Define what QC is, if it's not defined above, e.g. "The code validation (Quality Control, QC) test..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I have updated the documentation to mix validation and QC better. I was looking at the documentation and got confused about the word compliance. "code compliance" sounded like coding syntax, format, interfaces, and similar. That's why I switched to "code validation".