Skip to content
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

New soiltex for ctsm5.2.mksurfdata #1732

Merged
merged 38 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a849f95
new soil texture dataset
Mar 23, 2022
8de015d
new soil texture file
Mar 29, 2022
c79e8fc
Merge branch 'feature/new_mksurfdata' into feature/new_mksurfdata_soi…
Mar 29, 2022
3da0c0a
more changes to mksoiltexnewMod.F90
Mar 30, 2022
98c78b1
more updates to mksoiltexnewMod.F90
Mar 30, 2022
048dc94
fixes to get mapunits mapped and generated correctly
Mar 30, 2022
2491f62
more updates to get PCT_SAND and PCT_CLAY output for new soil dataset
Apr 7, 2022
f855eff
turned on other fields
Apr 8, 2022
c5e496b
revert any changes to original mksoiltexMod.F90
Apr 8, 2022
82c3924
Merge branch 'feature/new_mksurfdata' into feature/new_mksurfdata_soi…
Apr 8, 2022
191803f
fixed order in calls of mksurfdata
Apr 8, 2022
d7e2da6
%sand and %clay are now being computed without any zero values
Apr 13, 2022
057714f
mksurfdata now generates the entire surface dataset
Apr 13, 2022
474cd95
moved soiltexnewMod.F90 to soiltexMod.F90
Apr 21, 2022
3e6d2f2
Merge remote-tracking branch 'escomp/ctsm5.2.mksurfdata' into feature…
slevis-lmwg Apr 27, 2022
0216669
Change jobscript to point to /bld instead of /src
slevis-lmwg Apr 29, 2022
cd04245
Merge branch 'cmake_bld_branch' into feature/new_mksurfdata_soiltex
slevis-lmwg Apr 29, 2022
1d7bbc1
Merge remote-tracking branch 'escomp/ctsm5.2.mksurfdata' into new_soi…
slevis-lmwg May 4, 2022
9ca5228
Remove hardwiring of new soil texture mapunit and lookup files
slevis-lmwg May 5, 2022
efd5ca2
Update .xml with renamed mksrf_soitex* files
slevis-lmwg May 6, 2022
d53d1b9
Update .xml with renamed mksrf_soitex* files after review comments
slevis-lmwg May 6, 2022
2e7fc48
Add the --hires_soitex option to gen_mksurfdata_namelist.py
slevis-lmwg May 6, 2022
195ae0d
Untested mods to obtain ORGANIC from the new soil dataset
slevis-lmwg May 16, 2022
c1bde16
Clean-up in code & README; the code runs but ORGANIC is wrong
slevis-lmwg May 21, 2022
6c8ef8b
Define .nc variable ORGANIC as float instead of double
slevis-lmwg May 23, 2022
f7c80ec
Set organic to 0 when mapunit = 0 or lookup returns negative value
slevis-lmwg May 25, 2022
ba8d426
Added to fsurdat: BULK, CFRAG, PHAQ, ORGC (and ORGANIC temporarily)
slevis-lmwg May 27, 2022
c55575c
Merge remote-tracking branch 'escomp/ctsm5.2.mksurfdata' into new_soi…
slevis-lmwg Sep 15, 2022
73950a3
Update .xml file with new glacier, new lakedepth files, rm merge_gis opt
slevis-lmwg Sep 16, 2022
9b37f01
Upd .xml file w new hist data (1850-2015) w the new absolute values
slevis-lmwg Sep 20, 2022
e0fd2b1
Merge remote-tracking branch 'escomp/ctsm5.2.mksurfdata' into new_soi…
slevis-lmwg Sep 28, 2022
1cc1fad
Add "_cdf5_" to transient urban rawdata file names
slevis-lmwg Sep 28, 2022
59785d4
Read lakedepth & %lake separately to get the latter from transient files
slevis-lmwg Sep 29, 2022
94b844b
Update .xml with "rimport" locations of most new files
slevis-lmwg Sep 29, 2022
e4ad556
Of two calculation options for ORGANIC, switch to the preferred option
slevis-lmwg Oct 3, 2022
7c05469
Default do_transient_urban & _lakes to .true. for transient compsets
slevis-lmwg Oct 3, 2022
ac53754
Correcting typo from the last commit
slevis-lmwg Oct 4, 2022
ea5dbae
Change variable haslake to pct_lake_max throughout
slevis-lmwg Oct 4, 2022
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
35 changes: 19 additions & 16 deletions tools/mksurfdata_esmf/README
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
Build Requirements:
===================

mksurfdata_esmf is an distributed memory parallel program (using Message Passing Interface -- MPI) that utilizes
both ESMF (Earth System Modelling Framework) for regridding as well as PIO (Parallel I/O) and NetCDF output. As
such libraries must be built for the following:
mksurfdata_esmf is a distributed memory parallel program (using Message Passing
Interface -- MPI) that utilizes both ESMF (Earth System Modelling Framework)
for regridding as well as PIO (Parallel I/O) and NetCDF output. As
such, libraries must be built for the following:

1) MPI
2) NetCDF
Expand All @@ -13,42 +14,43 @@ such libraries must be built for the following:

In addition for the build: python, bash-shell, CMake and GNU-Make are required

These libraries need to be built such that they can all work together in the same executable. Hence, the above
order may be required in building them.
These libraries need to be built such that they can all work together in the
same executable. Hence, the above order may be required in building them.

=========================================
Use cime to manage the build requirements
=========================================

For users working on cime machines you can use the build
script to build the tool for you. On other machines you'll need to do a port to cime
and tell how to build for that machine. That's talked about in the cime documentation.
For users working on cime machines you can use the build script to build the
tool. On other machines you'll need to do a port to cime and tell how to build
for that machine. That's talked about in the cime documentation.
And you'll have to make some modifications to the build script.

https://github.com/ESMCI/cime/wiki/Porting-Overview

Machines that already run CTSM or CESM have been ported to cime. So if you can run the model
on your machine you will be able to build the tool there.
Machines that already run CTSM or CESM have been ported to cime. So if you can
run the model on your machine, you will be able to build the tool there.

To get a list of the machines that have been ported to cime:

cd ../../cime/scripts
./query_config --machines

NOTE:
In addition to having a port to cime, the machine also needs to have PIO built and able
to be referenced with the env variable PIO which will need to be in the porting instructions
for the machine. Currently an independent PIO library is not available on cime ported machines.
In addition to having a port to cime, the machine also needs to have PIO built
and able to be referenced with the env variable PIO which will need to be in
the porting instructions for the machine. Currently an independent PIO library
is not available on cime ported machines.

=======================
building the executable
Building the executable
=======================

> cd tools/mksurfdata_esmf
> ./gen_mksurfdata_build.sh # For machines with a cime build

=======================
running for a single submission:
Running for a single submission:
=======================
> cd ../
# to generate your target namelist:
Expand All @@ -60,7 +62,7 @@ running for a single submission:
> qsub mksurfdata_jobscript_single

=======================
running for the generation of multiple datasets
Running for the generation of multiple datasets
=======================
# Note that gen_mksurfdata_jobscript_multi.py runs ./gen_mksurfdata_namelist.py
> ./gen_mksurfdata_jobscript_multi.py --help
Expand All @@ -76,6 +78,7 @@ slevis HAS RUN THESE CASES and HAS LISTED ISSUES ENCOUNTERED
------------------------------------------------------------
REMEMBER TO compare against existing fsurdat files in
/glade/p/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/release-clm5.0.18
0) New 30-sec raw data for soil texture fails. Try requesting more mem.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this README file, this is the only substantial change (others just improve the formatting):
It documents that I haven't run successfully with the new 30-sec soil-texture data.

1) Soil color & texture and ag fire peak month outputs too high in .log
TODO? Change frac_o from always 1.
2) Pct lake has chged in the .log bc the old diagnostic omitted mask_i frac_o
Expand Down
28 changes: 26 additions & 2 deletions tools/mksurfdata_esmf/gen_mksurfdata_namelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,19 @@ def get_parser():
[default: %(default)s]
""",
action="store_true",
dest="hres_flag",
dest="hres_pft",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed hres_flag to hres_pft to distinguish it from the new hres_soitex.

default=False,
)
parser.add_argument(
"--hires_soitex",
help="""
If you want to use the high-resolution soil texture dataset rather
than the default lower resolution dataset.
(Low resolution is 5x5min, high resolution 30-second)
[default: %(default)s]
""",
action="store_true",
dest="hres_soitex",
default=False,
)
parser.add_argument(
Expand Down Expand Up @@ -245,7 +257,8 @@ def main ():
potveg = args.potveg_flag
glc_nec = args.glc_nec
merge_gis = args.merge_gis
if args.hres_flag:

if args.hres_pft:
if (start_year == 1850 and end_year == 1850) or \
(start_year == 2005 and end_year == 2005):
hires_pft = 'on'
Expand All @@ -254,6 +267,12 @@ def main ():
sys.exit(5)
else:
hires_pft = 'off'

if args.hres_soitex:
hires_soitex = 'on'
else:
hires_soitex = 'off'

verbose = args.verbose

if force_model_mesh_file != 'none':
Expand Down Expand Up @@ -319,6 +338,7 @@ def main ():

# create attribute list for parsing xml file
attribute_list = {'hires_pft':hires_pft,
'hires_soitex':hires_soitex,
'pft_years':pft_years,
'pft_years_ssp':pft_years_ssp,
'ssp_rcp':ssp_rcp,
Expand Down Expand Up @@ -390,6 +410,10 @@ def main ():
new_key = f"{child1.tag}_urban"
rawdata_files[new_key] = os.path.join(input_path, item.text)

if item.tag == 'lookup_filename':
new_key = f"{child1.tag}_lookup"
rawdata_files[new_key] = os.path.join(input_path, item.text)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needed for the newly introduced soil texture lookup file.


# determine output mesh
tree2 = ET.parse('../../ccs_config/component_grids_nuopc.xml')
root = tree2.getroot()
Expand Down
17 changes: 8 additions & 9 deletions tools/mksurfdata_esmf/gen_mksurfdata_namelist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,9 @@
</mksrf_flai>

<!-- ======================== -->
<!-- soil properties: forganic, fmax, soil-texture and soil color-->
<!-- soil properties: fmax, soil-texture (sand/clay, orgc), and soil color-->
<!-- ======================== -->

<mksrf_forganic>
<entry>
<data_filename>lnd/clm2/rawdata/mksrf_organic_10level_5x5min_ISRIC-WISE-NCSCD_nlev7_c120830.nc</data_filename>
<mesh_filename>lnd/clm2/mappingdata/grids/UNSTRUCTgrid_5x5min_nomask_c200129.nc</mesh_filename>
</entry>
</mksrf_forganic>

<!-- <mksrf_firrig> -->
<!-- <entry> -->
<!-- <data_filename>lnd/clm2/rawdata/mksrf_irrig_2160x4320_simyr2000.c110527.nc</data_filename> -->
Expand All @@ -50,9 +43,15 @@

<mksrf_fsoitex>
<entry>
<data_filename>lnd/clm2/rawdata/mksrf_soitex.10level.c010119.nc</data_filename>
<data_filename>lnd/clm2/rawdata/mksrf_soil_mapunits_5x5min_WISE.c220330.nc</data_filename>
<lookup_filename>lnd/clm2/rawdata/mksrf_soil_lookup.10level.WISE.c220330.nc</lookup_filename>
<mesh_filename>lnd/clm2/mappingdata/grids/UNSTRUCTgrid_5x5min_nomask_c200129.nc</mesh_filename>
</entry>
<entry hires_soitex='on'>
<data_filename>lnd/clm2/rawdata/mksrf_soil_mapunits_30sec_WISE.c220330.nc</data_filename>
<lookup_filename>lnd/clm2/rawdata/mksrf_soil_lookup.10level.WISE.c220330.nc</lookup_filename>
<mesh_filename>lnd/clm2/rawdata/mksrf_soil_mapunits_30sec_WISE.c220330.nc</mesh_filename>
</entry>
</mksrf_fsoitex>

<mksrf_fmax>
Expand Down
1 change: 0 additions & 1 deletion tools/mksurfdata_esmf/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ set(SRCFILES mkagfirepkmonthMod.F90
mkinputMod.F90
mklaiMod.F90
mklanwatMod.F90
mkorganicMod.F90
mkpeatMod.F90
mkpioMod.F90
mkpftMod.F90
Expand Down
14 changes: 6 additions & 8 deletions tools/mksurfdata_esmf/src/mkfileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ subroutine mkfile_define_atts(pioid, dynlanduse)
rcode = pio_put_att(pioid, pio_global, 'mesh_soil_texture_file', trim(str))
str = get_filename(mksrf_fsoicol_mesh)
rcode = pio_put_att(pioid, pio_global, 'mesh_soil_color_file', trim(str))
str = get_filename(mksrf_forganic_mesh)
rcode = pio_put_att(pioid, pio_global, 'mesh_soil_organic_file', trim(str))
str = get_filename(mksrf_furban_mesh)
rcode = pio_put_att(pioid, pio_global, 'mesh_urban_file', trim(str))
str = get_filename(mksrf_fmax_mesh)
Expand Down Expand Up @@ -216,11 +214,11 @@ subroutine mkfile_define_atts(pioid, dynlanduse)
str = get_filename(mksrf_fsoicol)
rcode = pio_put_att(pioid, pio_global, 'soil_color_raw_data_file_name', trim(str))
str = get_filename(mksrf_fsoitex)
rcode = pio_put_att(pioid, pio_global, 'soil_texture_raw_data_file_name', trim(str))
rcode = pio_put_att(pioid, pio_global, 'soil_texture_mapunit_raw_data_file_name', trim(str))
str = get_filename(mksrf_fsoitex_lookup)
rcode = pio_put_att(pioid, pio_global, 'soil_texture_lookup_raw_data_file_name', trim(str))
str = get_filename(mksrf_fmax)
rcode = pio_put_att(pioid, pio_global, 'fmax_raw_data_file_name', trim(str))
str = get_filename(mksrf_forganic)
rcode = pio_put_att(pioid, pio_global, 'organic_matter_raw_data_file_name', trim(str))
str = get_filename(mksrf_fvocef)
rcode = pio_put_att(pioid, pio_global, 'VOC_EF_raw_data_file_name', trim(str))
end if
Expand Down Expand Up @@ -261,18 +259,18 @@ subroutine mkfile_define_vars(pioid, dynlanduse)
call mkpio_def_spatial_var(pioid=pioid, varname='SOIL_COLOR', xtype=PIO_INT, &
long_name='soil color', units='unitless')

call mkpio_def_spatial_var(pioid=pioid, varname='PCT_SAND', xtype=xtype, &
call mkpio_def_spatial_var(pioid=pioid, varname='PCT_SAND', xtype=PIO_REAL, &
lev1name='nlevsoi', &
long_name='percent sand', units='unitless')

call mkpio_def_spatial_var(pioid=pioid, varname='PCT_CLAY', xtype=xtype, &
call mkpio_def_spatial_var(pioid=pioid, varname='PCT_CLAY', xtype=PIO_REAL, &
lev1name='nlevsoi', &
long_name='percent clay', units='unitless')

call mkpio_def_spatial_var(pioid=pioid, varname='mapunits', xtype=PIO_INT, &
long_name='soil texture map units', units='unitless')

call mkpio_def_spatial_var(pioid=pioid, varname='ORGANIC', xtype=xtype, &
call mkpio_def_spatial_var(pioid=pioid, varname='ORGANIC', xtype=PIO_REAL, &
lev1name='nlevsoi', &
long_name='organic matter density at soil levels', &
units='kg/m3 (assumed carbon content 0.58 gC per gOM)')
Expand Down
19 changes: 6 additions & 13 deletions tools/mksurfdata_esmf/src/mkinputMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ module mkinputMod
character(CX) , public :: mksrf_fhrvtyp = ' ' ! harvest data file name
character(CX) , public :: mksrf_fhrvtyp_mesh = ' ' ! harvest mesh file name

character(CX) , public :: mksrf_forganic = ' ' ! organic matter data file name
character(CX) , public :: mksrf_forganic_mesh = ' ' ! organic matter mesh file name

character(CX) , public :: mksrf_fsoicol = ' ' ! soil color data file name
character(CX) , public :: mksrf_fsoicol_mesh = ' ' ! soil color mesh file name

character(CX) , public :: mksrf_fsoitex = ' ' ! soil texture data file name
character(CX) , public :: mksrf_fsoitex = ' ' ! soil texture mapunit data file name
character(CX) , public :: mksrf_fsoitex_lookup = ' ' ! soil texture lookup data file name
character(CX) , public :: mksrf_fsoitex_mesh = ' ' ! soil texture mesh file name

character(CX) , public :: mksrf_fmax = ' ' ! fmax data file name
Expand Down Expand Up @@ -136,9 +134,8 @@ subroutine read_namelist_input()
mksrf_fhrvtyp, &
mksrf_fhrvtyp_mesh, &
mksrf_fsoitex, &
mksrf_fsoitex_lookup, &
mksrf_fsoitex_mesh, &
mksrf_forganic, &
mksrf_forganic_mesh, &
mksrf_fsoicol, &
mksrf_fsoicol_mesh, &
mksrf_fvocef, &
Expand Down Expand Up @@ -224,14 +221,12 @@ subroutine read_namelist_input()
call mpi_bcast (mksrf_fhrvtyp_mesh, len(mksrf_fhrvtyp_mesh), MPI_CHARACTER, 0, mpicom, ier)

call mpi_bcast (mksrf_fsoitex, len(mksrf_fsoitex), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_fsoitex_lookup, len(mksrf_fsoitex_lookup), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_fsoitex_mesh, len(mksrf_fsoitex_mesh), MPI_CHARACTER, 0, mpicom, ier)

call mpi_bcast (mksrf_fmax, len(mksrf_fmax), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_fmax_mesh, len(mksrf_fmax_mesh), MPI_CHARACTER, 0, mpicom, ier)

call mpi_bcast (mksrf_forganic, len(mksrf_forganic), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_forganic_mesh, len(mksrf_forganic_mesh), MPI_CHARACTER, 0, mpicom, ier)

call mpi_bcast (mksrf_fsoicol, len(mksrf_fsoicol), MPI_CHARACTER, 0, mpicom, ier)
call mpi_bcast (mksrf_fsoicol_mesh, len(mksrf_fsoicol_mesh), MPI_CHARACTER, 0, mpicom, ier)

Expand Down Expand Up @@ -347,12 +342,10 @@ subroutine write_namelist_input()
write(ndiag,'(a)')' inland wetland from: '//trim(mksrf_fwetlnd)
write(ndiag,'(a)')' mesh for wetland '//trim(mksrf_fwetlnd_mesh)
write(ndiag,*)
write(ndiag,'(a)')' soil texture from: '//trim(mksrf_fsoitex)
write(ndiag,'(a)')' soil texture mapunits from: '//trim(mksrf_fsoitex)
write(ndiag,'(a)')' soil texture (sand/clay, orgc) lookup: '//trim(mksrf_fsoitex_lookup)
write(ndiag,'(a)')' mesh for soil texture '//trim(mksrf_fsoitex_mesh)
write(ndiag,*)
write(ndiag,'(a)')' soil organic from: '//trim(mksrf_forganic)
write(ndiag,'(a)')' mesh for soil organic '//trim(mksrf_forganic_mesh)
write(ndiag,*)
write(ndiag,'(a)')' soil color from: '//trim(mksrf_fsoicol)
write(ndiag,'(a)')' mesh for soil color '//trim(mksrf_fsoicol_mesh)
write(ndiag,*)
Expand Down
Loading