Skip to content

Commit dd76b2e

Browse files
authored
Merge pull request #3199 from slevis-lmwg/doc_mksurfdata_esmf
Update documentation for generating fsurdat/landuse files
2 parents 2d755d8 + 0d7fb50 commit dd76b2e

25 files changed

Lines changed: 71 additions & 1113 deletions

README_on_CTSM.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ Important files in main directories (under $CTSMROOT):
120120
- `cime_config/usermods_dirs/clm`: Directories of sets of user-modification subdirs; these are directories that add specific user modifications to simulations created using `cime/scripts/create_newcase --user-mods-dir clm/*`
121121

122122
- `tools/mksurfdata_esmf`: Directory to build program to create surface dataset at any resolution
123-
- `tools/mkmapgrids`: NCL script to create a SCRIP grid file for a regular lat/lon grid (deprecated)
124123
- `tools/crop_calendars`: Tools to process and process and create crop calendar datasets for CTSM
125124
- `tools/modify_input_files`: Script to modify existing CTSM input datasets in standard ways
126125
- `tools/site_and_regional`: Scripts to create input datasets for single site and regional cases, primarily by modifying existing global datasets

doc/source/lilac/obtaining-building-and-running/setting-ctsm-runtime-options.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The first set of options in this file specifies key file names:
106106

107107
- ``lnd_domain_file`` must be specified. This file specifies CTSM's grid and land
108108
mask. The general process for creating this file is described in section
109-
:numref:`creating-domain-files`.
109+
:numref:`building-the-clm-tools`.
110110

111111
- ``fsurdat`` also must be specified. This file specifies a variety of spatially-varying
112112
properties. This file is grid-specific, but can be created from grid-independent files

doc/source/lilac/specific-atm-models/wrf-tools.rst

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,61 +16,21 @@ Before this step, make sure you have successfully created geo_em* files for
1616
your specific WRF domain using WPS. Instructions on how to run ``geogrid.exe``
1717
is described in here.
1818

19-
1. Create SCRIP grid file from WRF ``geo_em*`` files, using the following ncl
20-
script::
19+
1. Create ESMF mesh file from WRF ``geo_em*`` files, using the make_mesh tool. Details in section :numref:`how-to-make-mesh`.
2120

22-
ncl create_scrip_file.ncl
21+
2. Create surface datasets in ``tools/mksurfdata_esmf``. Details in section :numref:`creating-surface-datasets`.
2322

24-
This creates two files that are complements of each other only in the mask field
25-
26-
2. Create mapping files by using ``mkmapdata`` code under
27-
``CTSM/tools/mkmapdata/``.
28-
29-
Using environment variables set the following environment varibales needed
30-
by ``mkunitymap.ncl`` code::
31-
32-
setenv GRIDFILE1 wrf2clm_ocean_noneg.nc
33-
setenv GRIDFILE2 wrf2clm_land_noneg.nc
34-
setenv MAPFILE wrf2clm_mapping_noneg.nc
35-
setenv PRINT TRUE
36-
37-
ncl mkunitymap.ncl
38-
39-
.. warning::
40-
41-
This will throw some git errors if not run in a repository.
42-
43-
3. Create ESMF mapping files by running ``regridbatch.sh``::
44-
45-
qsub regridbatch.sh
46-
47-
4. In your ctsm repository directory, build::
48-
49-
../../../configure --macros-format Makefile --mpilib mpi-serial
50-
51-
.. todo::
52-
Update the below, as domain files aren't needed with nuopc.
53-
54-
5. Generate CTSM domain files using ``get_domain`` tool::
55-
56-
./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg
57-
58-
.. todo::
59-
Update the below, as ``mksurfdata.pl`` no longer exists.
60-
61-
6. Create surface datasets in ``tools/mksurfdata_esmf``::
62-
63-
./mksurfdata.pl -res usrspec -usr_gname "nldas" -usr_gdate "190124" -usr_mapdir "/glade/work/$USER/ctsm/nldas_grid/map" -y 2000 -exedir "/glade/u/home/$USER/src/ctsm/ctsm_surfdata/tools/mksurfdata_esmf" -no-crop
6423

6524
Merge WRF initial conditions into an existing CTSM initial condition file
6625
--------------------------------------------------------------------------
6726

68-
The following procedure is if you'd wish to merget WRF inital conditions from
27+
The following procedure is if you'd wish to merge WRF inital conditions from
6928
``wrfinput`` file into CTSM initial condition file ::
7029

30+
module load ncl
7131
ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"'
7232

7333
.. todo::
7434

75-
Sam, can you please make the above ncl script available.
35+
Versions of the transfer_wrfinput ncl script are available in /glade/work/slevis/git_wrf/ctsm_init/.
7636

doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg

Lines changed: 0 additions & 3 deletions
This file was deleted.

doc/source/users_guide/using-clm-tools/LegendCLMToolDataFlow.jpeg

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1+
.. include:: ../substitutions.rst
2+
3+
.. _building-the-clm-tools:
4+
15
========================
26
Building the CLM tools
37
========================
48

5-
.. include:: ../substitutions.rst
6-
7-
.. todo::
8-
Update the below, as domain files aren't needed with nuopc.
9-
10-
The tools **cprnc** and **gen_domain** use the CIME configure/build system which is described in the next section.
9+
The tool **cprnc** uses the CIME configure/build system which is described in the next section.
1110

1211
The only CLM FORTRAN tool is mksurfdata_esmf which has it's own build system that takes advantage of the cime build.
1312

1413
================================================================
1514
Building the CLM tools that use the CIME configure/build system
1615
================================================================
1716

18-
.. todo::
19-
Update the below, as domain files aren't needed with nuopc.
20-
21-
``cprnc`` and ``gen_domain`` both use the CIME configure/build system rather than the CLM specific version described above.
17+
``cprnc`` uses the CIME configure/build system rather than the CLM specific version described above.
2218

2319
See `CIME documentation on adding grids <http://esmci.github.io/cime/users_guide/grids.html?highlight=gen_domain#adding-grids>`_ for more information on adding grids, creating mapping files, and running ``gen_domain``. Also see the CIME file: ``$CTSMROOT/tools/mapping/gen_domain_files/INSTALL`` for how to build ``gen_domain``.
2420

doc/source/users_guide/using-clm-tools/creating-domain-files.rst

Lines changed: 0 additions & 40 deletions
This file was deleted.

doc/source/users_guide/using-clm-tools/creating-input-for-surface-dataset-generation.rst

Lines changed: 3 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -6,105 +6,10 @@
66
Creating input for surface dataset generation
77
*********************************************
88

9-
Generating SCRIP grid files
9+
Generating ESMF mesh files
1010
==================================
1111

12-
The utility ``mkmapdata.sh`` requires SCRIP format input files to describe the input and output grids that maps are generated for. CLM provides a utility, ``mkmapgrids`` that generates those files. The program converts old formats of CAM or CLM grid files to SCRIP grid format. There is also a NCL script (``mkscripgrid.ncl``) to create regular latitude longitude regional or single-point grids at the resolution the user desires.
12+
The ``mksurfdata_esmf`` tool requires ESMF mesh files to describe the input and output grids used for generating fsurdat and landuse files. CLM provides the ``mesh_maker`` tool for generating such files. See section :numref:`how-to-make-mesh` for details.
1313

14-
SCRIP grid files for all the standard model resolutions and the raw surface datasets have already been done and the files are in the XML database. Hence, this step doesn't need to be done -- EXCEPT WHEN YOU ARE CREATING YOUR OWN GRIDS.
14+
ESMF mesh files for all the standard model resolutions and the raw surface datasets already exist and the files are in the XML database. Hence, you may skip this step -- UNLESS YOU ARE CREATING YOUR OWN GRIDS.
1515

16-
.. _using-mkocnmap:
17-
18-
Using mknocnmap.pl to create grid and maps for single-point regional grids
19-
--------------------------------------------------------------------------
20-
21-
.. todo::
22-
Update the below, as domain files aren't needed with nuopc.
23-
24-
If you want to create a regular latitude/longitude single-point or regional grid, we suggest you use ``mknoocnmap.pl`` in ``$CTSMROOT/tools/mkmapdata`` which will create both the SCRIP grid file you need (using ``$CTSMROOT/tools/mkmapgrids/mkscripgrid.ncl``) AND an identity mapping file assuming there is NO ocean in your grid domain. If you HAVE ocean in your domain you could modify the mask in the SCRIP grid file for ocean, and then use ``ESMF_RegridWeightGen`` to create the mapping file, and ``gen_domain`` to create the domain file. Like other tools, ``./mkmapdata/mknoocnmap.pl`` has a help option with the following:
25-
::
26-
27-
SYNOPSIS
28-
mknoocnmap.pl [options] Gets map and grid files for a single land-only point.
29-
REQUIRED OPTIONS
30-
-centerpoint [or -p] <lat,lon> Center latitude,longitude of the grid to create.
31-
-name [-or -n] <name> Name to use to describe point
32-
33-
OPTIONS
34-
-dx <number> Size of total grid in degrees in longitude direction
35-
(default is 0.1)
36-
-dy <number> Size of total grid in degrees in latitude direction
37-
(default is 0.1)
38-
-silent [or -s] Make output silent
39-
-help [or -h] Print usage to STDOUT.
40-
-verbose [or -v] Make output more verbose.
41-
-nx <number> Number of longitudes (default is 1)
42-
-ny <number> Number of latitudes (default is 1)
43-
44-
See :numref:`Figure mknoocnmap.pl` for a visual representation of this process.
45-
46-
Creating mapping files for mksurfdata_esmf
47-
==============================================
48-
49-
``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF).
50-
51-
The bash shell script ``$CTSMROOT/tools/mkmapgrids/mkmapdata.sh`` uses ``ESMF_RegridWeightGen`` to create a list of maps from the raw datasets that are input to ``mksurfdata_esmf``. Each dataset that has a different grid, or land-mask needs a different mapping file for it, but many different raw datasets share the same grid/land-mask as other files. Hence, there doesn't need to be a different mapping file for EACH raw dataset---just for each raw dataset that has a DIFFERENT grid or land-mask. See :numref:`Figure mkmapdata.sh` for a visual representation of how this works. The bash script figures out which mapping files it needs to create and then runs ``ESMF_RegridWeightGen`` for each one. You can then either enter the datasets into the XML database (see Chapter :numref:`adding-new-resolutions-section`), or leave the files in place and use the ``-res usrspec -usr_gname -usr_gdate`` options to ``mksurfdata_esmf``. ``mkmapdata.sh`` has a help option with the following
52-
::
53-
54-
../../tools/mkmapdata/mkmapdata.sh
55-
56-
**********************
57-
usage on derecho:Figure mkmapdata.sh
58-
./mkmapdata.sh
59-
60-
valid arguments:
61-
[-f|--gridfile <gridname>]
62-
Full pathname of model SCRIP grid file to use
63-
This variable should be set if this is not a supported grid
64-
This variable will override the automatic generation of the
65-
filename generated from the -res argument
66-
the filename is generated ASSUMING that this is a supported
67-
grid that has entries in the file namelist_defaults_clm.xml
68-
the -r|--res argument MUST be specied if this argument is specified
69-
[-r|--res <res>]
70-
Model output resolution (default is 10x15)
71-
[-t|--gridtype <type>]
72-
Model output grid type
73-
supported values are [regional,global], (default is global)
74-
[-b|--batch]
75-
Toggles batch mode usage.
76-
If you want to run in batch mode
77-
you need to have a separate batch script for a supported machine
78-
that calls this script interactively - you cannot submit this
79-
script directory to the batch system
80-
[-l|--list]
81-
List mapping files required (use check_input_data to get them)
82-
also writes data to clm.input_data_list
83-
[-d|--debug]
84-
Toggles debug-only (don't actually run mkmapdata just echo what would happen)
85-
[-h|--help]
86-
Displays this help message
87-
[-v|--verbose]
88-
Toggle verbose usage -- log more information on what is happening
89-
90-
You can also set the following env variables:
91-
ESMFBIN_PATH - Path to ESMF binaries
92-
(default is /contrib/esmf-5.3.0-64-O/bin)
93-
CSMDATA ------ Path to CESM input data
94-
(default is /glade/p/cesm/cseg/inputdata)
95-
MPIEXEC ------ Name of mpirun executable
96-
(default is mpirun.lsf)
97-
REGRID_PROC -- Number of MPI processors to use
98-
(default is 8)
99-
100-
**pass environment variables by preceding above commands
101-
with 'env var1=setting var2=setting '
102-
**********************
103-
104-
.. _Figure mkmapdata.sh:
105-
106-
.. figure:: mkmapdata_details.jpeg
107-
108-
Details of running mkmapdata.sh
109-
110-
Each of the raw datasets for ``mksurfdata_esmf`` needs a mapping file to map from the output grid you are running on to the grid and land-mask for that dataset. This is what ``mkmapdata.sh`` does. To create the mapping files you need a SCRIP grid file to correspond with each resolution and land mask that you have a raw data file in ``mksurfdata_esmf``. Some raw datasets share the same grid and land mask -- hence they can share the same SCRIP grid file. The output maps created here go into ``mksurfdata_esmf`` see :numref:`Figure Workflow of CLM5 Land Use Data Tool and mksurfdata_esmf Tool`.

0 commit comments

Comments
 (0)