From 1b6ac0e2cd06013de20d1fdcfc7b9b618f625240 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Fri, 12 Jan 2024 19:10:00 -0700 Subject: [PATCH] Update mksurfdata_esmf/Makefile to work with modify_smallville.sh Tested: modify_smallville.sh Not tested: Makefile --- tools/mksurfdata_esmf/Makefile | 21 ++++++++----------- tools/modify_input_files/modify_smallville.sh | 17 ++++++++------- 2 files changed, 18 insertions(+), 20 deletions(-) diff --git a/tools/mksurfdata_esmf/Makefile b/tools/mksurfdata_esmf/Makefile index 60b3bb32b2..c6c55a7e47 100644 --- a/tools/mksurfdata_esmf/Makefile +++ b/tools/mksurfdata_esmf/Makefile @@ -46,6 +46,7 @@ SUBSETDATA_1X1_SMALL := --lat 40.6878 --lon 267.0228 --site 1x1_smallvilleIA \ --pctpft 6.5 1.5 1.6 1.7 1.8 1.9 1.5 1.6 1.7 1.8 1.9 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 1.5 # NOTE: The 1850 smallvilleIA site is constructed to start with 100% natural vegetation, so we can test transition to crops SUBSETDATA_1X1_SMALL1850 := --lat 40.6878 --lon 267.0228 --site 1x1_smallvilleIA --dompft 13 --pctpft 100 +SUBSETDATA_1X1_SMALLTRANSIENT := --lat 40.6878 --lon 267.0228 --site 1x1_smallvilleIA MEXICOCITY_TMP_FNAME := surfdata_1x1_mexicocityMEX_hist_2000_78pfts.nc MEXICOCITY_FNAME := surfdata_1x1_mexicocityMEX_hist_2000_78pfts_c$(CDATE).nc @@ -82,7 +83,7 @@ CROP = \ crop-global-1850-ne16np4 \ crop-global-1850-ne120np4 \ crop-global-future -all : standard tropics crop urban landuse-timeseries all-subset +all : standard tropics crop urban all-subset all-subset : \ 1x1_brazil-tropics-present \ @@ -92,6 +93,7 @@ all-subset : \ crop-numa-historical \ crop-smallville \ crop-smallville-historical \ + crop-smallville-transient \ urban-present urban-alpha DEBUG: @@ -205,6 +207,12 @@ crop-smallville : FORCE crop-smallville-historical : FORCE $(SUBSETDATA_POINT) --create-surface $(SUBSETDATA_1X1_SMALL1850) --cfg-file default_data_1850.cfg +# Note (slevis): The next line makes the landuse.timeseries from 1850 to 2015, so also run +# modify_smallville.sh to generate three modified landuse.timeseries files needed for testing. +crop-smallville-transient : FORCE + $(SUBSETDATA_POINT) --create-landuse $(SUBSETDATA_1X1_SMALLTRANSIENT) +../modify_input_files/modify_smallville.sh + # # Crop with future scenarios # @@ -311,17 +319,6 @@ urban-alpha : FORCE $(MODIFYSURF) modify_1x1_urbanc_alpha.cfg -i $(URBALPHA_TMP2_FNAME) -o $(URBALPHA_FNAME) $(RM) $(URBALPHA_TMP_FNAME) $(URBALPHA_TMP2_FNAME) -# -# landuse timeseries with subset data -# -landuse-timeseries : landuse-timeseries-smallville -# NOTE: TODO: This needs to be chagned to use subset_data when transient configurations are resolved (see Issue #1673 -landuse-timeseries-smallville : FORCE -# $(MKSURFDATA) -no_surfdata -glc_nec 10 -y 1850-1855 -r 1x1_smallvilleIA \ -# -pft_idx 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78 \ -# -pft_frc 6.5,1.5,1.6,1.7,1.8,1.9,1.5,1.6,1.7,1.8,1.9,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5,1.5 \ -# -dynpft single_point_dynpft_files/landuse_timeseries_smallvilleIA_hist_simyr1850-1855.txt \ -# $(BACKGROUND) # # clean up the working directory by removing generated files diff --git a/tools/modify_input_files/modify_smallville.sh b/tools/modify_input_files/modify_smallville.sh index 1205cc23e3..8f1ab8384b 100755 --- a/tools/modify_input_files/modify_smallville.sh +++ b/tools/modify_input_files/modify_smallville.sh @@ -3,23 +3,24 @@ # Script that prepares landuse files for smallvilleIA. # Load the nco module and run the script in the ctsm_pylib environment: module load nco -module load conda -conda activate ctsm_pylib -# Subset a global landuse file with 78 pfts, i.e. with crops -../site_and_regional/subset_data point --lat 40.6878 --lon 267.0228 --site 1x1_smallvilleIA --create-surface --create-landuse --crop +file_to_2015="subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-2015_c$(date +%y%m%d).nc" +file_to_1855="subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-1855_c$(date +%y%m%d).nc" +file_lake="subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynLakes_c$(date +%y%m%d).nc" +file_urban="subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynUrban_c$(date +%y%m%d).nc" +file_pft="subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynPft_c$(date +%y%m%d).nc" # Trim the file to just the years 1850-1855 -ncks -d time,0,5 subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-2015_c240103.nc subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-1855_c240103.nc +ncks -d time,0,5 $file_to_2015 $file_to_1855 # Replace all values in the LAKE and CROP variables -ncap2 -s "PCT_LAKE=array(0.,0.,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.} ; PCT_LAKE_MAX=array(50.,50.,PCT_CROP_MAX); PCT_CROP=array(0.,0.,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}; PCT_CROP_MAX=array(25.,25.,PCT_LAKE_MAX)" subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-1855_c240103.nc subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynLakes_c240103.nc +ncap2 -s "PCT_LAKE=array(0.,0.,PCT_CROP); PCT_LAKE={0.,50.,25.,25.,25.,25.} ; PCT_LAKE_MAX=array(50.,50.,PCT_CROP_MAX); PCT_CROP=array(0.,0.,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}; PCT_CROP_MAX=array(25.,25.,PCT_LAKE_MAX)" $file_to_1855 $file_lake # Replace all values in the URBAN and CROP variables -ncap2 -s "PCT_URBAN=array(0.,0.,PCT_URBAN); PCT_URBAN={0.,0.,0.,20.,15.,0.,10.,8.,0.,10.,8.,0.,10.,8.,0.,10.,8.,0.} ; PCT_URBAN_MAX=array(0.,0.,PCT_URBAN_MAX); PCT_URBAN_MAX={20.,15.,0.}; PCT_CROP=array(0.,0.,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}; PCT_CROP_MAX=array(25.,25.,PCT_LAKE_MAX)" subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-1855_c240103.nc subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynUrban_c240103.nc +ncap2 -s "PCT_URBAN=array(0.,0.,PCT_URBAN); PCT_URBAN={0.,0.,0.,20.,15.,0.,10.,8.,0.,10.,8.,0.,10.,8.,0.,10.,8.,0.} ; PCT_URBAN_MAX=array(0.,0.,PCT_URBAN_MAX); PCT_URBAN_MAX={20.,15.,0.}; PCT_CROP=array(0.,0.,PCT_LAKE); PCT_CROP={0.,25.,12.,12.,12.,12.}; PCT_CROP_MAX=array(25.,25.,PCT_LAKE_MAX)" $file_to_1855 $file_urban # Update values in the pft, cft, harvest, and grazing variables as posted here: # https://github.com/ESCOMP/CTSM/issues/1673#issuecomment-1879156989 -ncap2 -s "PCT_NAT_PFT=array(0.,0.,PCT_NAT_PFT); PCT_NAT_PFT={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,50.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,50.,0.,25.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,75.,0.} ; PCT_NAT_PFT_MAX=array(0.,0.,PCT_NAT_PFT_MAX); PCT_NAT_PFT_MAX={100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.}; PCT_CFT=array(0.,0.,PCT_CFT); PCT_CFT={100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,1.,1.,1.,1.,1.,1.,1.,1.,1.,91.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,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,0.}; HARVEST_SH2=array(0.,0.,HARVEST_SH2); HARVEST_SH2={0.,0.,0.,0.,0.,0.}; HARVEST_SH3=array(0.,0.,HARVEST_SH3); HARVEST_SH3={0.,0.,0.,0.,0.,0.}; HARVEST_VH1=array(0.,0.,HARVEST_VH1); HARVEST_VH1={0.,0.,0.,0.,0.,0.}; HARVEST_VH2=array(0.,0.,HARVEST_VH2); HARVEST_VH2={0.,0.,0.,0.,0.,0.}; GRAZING=array(0.,0.,GRAZING); GRAZING={0.,0.,0.,0.,0.,0.}" subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78_CMIP6_1850-1855_c240103.nc subset_data_single_point/landuse.timeseries_1x1_smallvilleIA_hist_78pfts_1850-1855_dynPft_c240103.nc +ncap2 -s "PCT_NAT_PFT=array(0.,0.,PCT_NAT_PFT); PCT_NAT_PFT={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,50.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,50.,0.,25.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,75.,0.} ; PCT_NAT_PFT_MAX=array(0.,0.,PCT_NAT_PFT_MAX); PCT_NAT_PFT_MAX={100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,100.,0.}; PCT_CFT=array(0.,0.,PCT_CFT); PCT_CFT={100.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.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2.,3.,3.,4.,4.,5.,5.,91.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.}; PCT_CROP=array(0.,0.,PCT_CROP); PCT_CROP={0.,0.,100.,100.,50.,25.}; PCT_CROP_MAX=array(100.,100.,PCT_CROP_MAX); HARVEST_SH1=array(0.,0.,HARVEST_SH1); HARVEST_SH1={0.,0.,0.,0.,0.,0.}; HARVEST_SH2=array(0.,0.,HARVEST_SH2); HARVEST_SH2={0.,0.,0.,0.,0.,0.}; HARVEST_SH3=array(0.,0.,HARVEST_SH3); HARVEST_SH3={0.,0.,0.,0.,0.,0.}; HARVEST_VH1=array(0.,0.,HARVEST_VH1); HARVEST_VH1={0.,0.,0.,0.,0.,0.}; HARVEST_VH2=array(0.,0.,HARVEST_VH2); HARVEST_VH2={0.,0.,0.,0.,0.,0.}; GRAZING=array(0.,0.,GRAZING); GRAZING={0.,0.,0.,0.,0.,0.}" $file_to_1855 $file_pft exit