Skip to content
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5d97143
Updating doc/source/users_guide/using-clm-tools/what-are-the-clm-tool…
slevis-lmwg Dec 6, 2023
42098c5
Draft update documentation for generating fsurdat/landuse files
slevis-lmwg May 29, 2025
4aba801
Merge remote-tracking branch 'escomp/b4b-dev' into documentation_wk
slevis-lmwg Mar 20, 2026
a3635da
Merge branch 'documentation_wk' into doc_mksurfdata_esmf
slevis-lmwg Mar 20, 2026
3683979
Remove creating-domain-files.rst as not needed with nuopc
slevis-lmwg Mar 23, 2026
0f16d7d
Remove references to creating-domain-files
slevis-lmwg Mar 23, 2026
9e00622
Remove reference to mknoocnmap.pl as obsolete
slevis-lmwg Mar 24, 2026
cf44eb3
Merge branch 'b4b-dev' into doc_mksurfdata_esmf
slevis-lmwg Apr 1, 2026
a6fccee
Merge branch 'b4b-dev' into doc_mksurfdata_esmf
slevis-lmwg Apr 2, 2026
27c3f3e
Rm mention of mapping files, replace SCRIP and corresp. tool with mesh
slevis-lmwg Apr 2, 2026
162a793
Add reference to Section 1.9 _how-to-make-mesh
slevis-lmwg Apr 3, 2026
547ffe9
Remove some figures not in use by the new documentation
slevis-lmwg Apr 3, 2026
af56462
Remove mknoocnmap.pl and mkunitymap.ncl
slevis-lmwg Apr 3, 2026
029f1c7
wrf-tools.rst: replace SCRIP with mesh, rm refs to deprecated scripts
slevis-lmwg Apr 3, 2026
577d2bc
Remove unnecessary references to SCRIP, domain, and mapping files
slevis-lmwg Apr 3, 2026
2c1640b
Remove some references to gen_domain
slevis-lmwg Apr 3, 2026
0855784
Merge remote-tracking branch 'escomp/b4b-dev' into doc_mksurfdata_esmf
slevis-lmwg Apr 10, 2026
f78930f
Mostly formatting improvements to wrf-tools.rst
slevis-lmwg Apr 15, 2026
a364961
Formatting corrections
slevis-lmwg Apr 16, 2026
94051ad
Add reference to building-the-clm-tools for gen_domain
slevis-lmwg Apr 16, 2026
d680881
Remove debugging comment
slevis-lmwg Apr 16, 2026
ade16d5
Merge remote-tracking branch 'escomp/b4b-dev' into doc_mksurfdata_esmf
slevis-lmwg May 5, 2026
2a5bbd2
Merge remote-tracking branch 'escomp/b4b-dev' into doc_mksurfdata_esmf
slevis-lmwg May 8, 2026
2a90905
Introduce wrapping lines in this file
slevis-lmwg May 8, 2026
f3fdafb
Remove redundant sections from tools/mksurfdata_esmf/README.md
slevis-lmwg May 8, 2026
e973c4f
Make User's Guide sections consistent with last README changes
slevis-lmwg May 8, 2026
2af2e5d
Update all README references to include the .md suffix
slevis-lmwg May 8, 2026
0d7fb50
Remove a couple of TODO placeholders
slevis-lmwg May 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README_on_CTSM.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ Important files in main directories (under $CTSMROOT):
- `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/*`

- `tools/mksurfdata_esmf`: Directory to build program to create surface dataset at any resolution
- `tools/mkmapgrids`: NCL script to create a SCRIP grid file for a regular lat/lon grid (deprecated)
- `tools/crop_calendars`: Tools to process and process and create crop calendar datasets for CTSM
- `tools/modify_input_files`: Script to modify existing CTSM input datasets in standard ways
- `tools/site_and_regional`: Scripts to create input datasets for single site and regional cases, primarily by modifying existing global datasets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ The first set of options in this file specifies key file names:

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

- ``fsurdat`` also must be specified. This file specifies a variety of spatially-varying
properties. This file is grid-specific, but can be created from grid-independent files
Expand Down
50 changes: 5 additions & 45 deletions doc/source/lilac/specific-atm-models/wrf-tools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,21 @@ Before this step, make sure you have successfully created geo_em* files for
your specific WRF domain using WPS. Instructions on how to run ``geogrid.exe``
is described in here.

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

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

This creates two files that are complements of each other only in the mask field

2. Create mapping files by using ``mkmapdata`` code under
``CTSM/tools/mkmapdata/``.

Using environment variables set the following environment varibales needed
by ``mkunitymap.ncl`` code::

setenv GRIDFILE1 wrf2clm_ocean_noneg.nc
setenv GRIDFILE2 wrf2clm_land_noneg.nc
setenv MAPFILE wrf2clm_mapping_noneg.nc
setenv PRINT TRUE

ncl mkunitymap.ncl

.. warning::

This will throw some git errors if not run in a repository.

3. Create ESMF mapping files by running ``regridbatch.sh``::

qsub regridbatch.sh

4. In your ctsm repository directory, build::

../../../configure --macros-format Makefile --mpilib mpi-serial

.. todo::
Update the below, as domain files aren't needed with nuopc.

5. Generate CTSM domain files using ``get_domain`` tool::

./gen_domain -m /glade/work/$USER/ctsm/nldas_grid/scrip/wrf2clm_mapping_noneg.nc -o wrf2clm_ocn_noneg -l wrf2clm_lnd_noneg

.. todo::
Update the below, as ``mksurfdata.pl`` no longer exists.

6. Create surface datasets in ``tools/mksurfdata_esmf``::

./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

Merge WRF initial conditions into an existing CTSM initial condition file
--------------------------------------------------------------------------

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

module load ncl
ncl transfer_wrfinput_to_ctsm_with_snow.ncl 'finidat="the_existing_finidat_file.nc"' 'wrfinput="your_wrfinput_file"' 'merged="the_merged_finidat_file.nc"'

.. todo::

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

3 changes: 0 additions & 3 deletions doc/source/users_guide/using-clm-tools/GlobalDomain.jpeg

This file was deleted.

This file was deleted.

16 changes: 6 additions & 10 deletions doc/source/users_guide/using-clm-tools/building-the-clm-tools.rst
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
.. include:: ../substitutions.rst

.. _building-the-clm-tools:

========================
Building the CLM tools
========================

.. include:: ../substitutions.rst

.. todo::
Update the below, as domain files aren't needed with nuopc.

The tools **cprnc** and **gen_domain** use the CIME configure/build system which is described in the next section.
The tool **cprnc** uses the CIME configure/build system which is described in the next section.

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

================================================================
Building the CLM tools that use the CIME configure/build system
================================================================

.. todo::
Update the below, as domain files aren't needed with nuopc.

``cprnc`` and ``gen_domain`` both use the CIME configure/build system rather than the CLM specific version described above.
``cprnc`` uses the CIME configure/build system rather than the CLM specific version described above.

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``.

40 changes: 0 additions & 40 deletions doc/source/users_guide/using-clm-tools/creating-domain-files.rst
Comment thread
slevis-lmwg marked this conversation as resolved.
Outdated

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,105 +6,10 @@
Creating input for surface dataset generation
*********************************************

Generating SCRIP grid files
Generating ESMF mesh files
==================================

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.
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.

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.
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.

.. _using-mkocnmap:

Using mknocnmap.pl to create grid and maps for single-point regional grids
--------------------------------------------------------------------------

.. todo::
Update the below, as domain files aren't needed with nuopc.

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:
::

SYNOPSIS
mknoocnmap.pl [options] Gets map and grid files for a single land-only point.
REQUIRED OPTIONS
-centerpoint [or -p] <lat,lon> Center latitude,longitude of the grid to create.
-name [-or -n] <name> Name to use to describe point

OPTIONS
-dx <number> Size of total grid in degrees in longitude direction
(default is 0.1)
-dy <number> Size of total grid in degrees in latitude direction
(default is 0.1)
-silent [or -s] Make output silent
-help [or -h] Print usage to STDOUT.
-verbose [or -v] Make output more verbose.
-nx <number> Number of longitudes (default is 1)
-ny <number> Number of latitudes (default is 1)

See :numref:`Figure mknoocnmap.pl` for a visual representation of this process.

Creating mapping files for mksurfdata_esmf
==============================================

``mkmapdata.sh`` uses the above SCRIP grid input files to create SCRIP mapping data files (uses ESMF).

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
::

../../tools/mkmapdata/mkmapdata.sh

**********************
usage on derecho:Figure mkmapdata.sh
./mkmapdata.sh

valid arguments:
[-f|--gridfile <gridname>]
Full pathname of model SCRIP grid file to use
This variable should be set if this is not a supported grid
This variable will override the automatic generation of the
filename generated from the -res argument
the filename is generated ASSUMING that this is a supported
grid that has entries in the file namelist_defaults_clm.xml
the -r|--res argument MUST be specied if this argument is specified
[-r|--res <res>]
Model output resolution (default is 10x15)
[-t|--gridtype <type>]
Model output grid type
supported values are [regional,global], (default is global)
[-b|--batch]
Toggles batch mode usage.
If you want to run in batch mode
you need to have a separate batch script for a supported machine
that calls this script interactively - you cannot submit this
script directory to the batch system
[-l|--list]
List mapping files required (use check_input_data to get them)
also writes data to clm.input_data_list
[-d|--debug]
Toggles debug-only (don't actually run mkmapdata just echo what would happen)
[-h|--help]
Displays this help message
[-v|--verbose]
Toggle verbose usage -- log more information on what is happening

You can also set the following env variables:
ESMFBIN_PATH - Path to ESMF binaries
(default is /contrib/esmf-5.3.0-64-O/bin)
CSMDATA ------ Path to CESM input data
(default is /glade/p/cesm/cseg/inputdata)
MPIEXEC ------ Name of mpirun executable
(default is mpirun.lsf)
REGRID_PROC -- Number of MPI processors to use
(default is 8)

**pass environment variables by preceding above commands
with 'env var1=setting var2=setting '
**********************

.. _Figure mkmapdata.sh:

.. figure:: mkmapdata_details.jpeg

Details of running mkmapdata.sh

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`.
Loading
Loading