NGEET / fates-containers

Repository for containerized version of fates for use in future tutorials
6 stars 7 forks source link

Providing a customizable example 1x1 Brazil case script #31

Closed serbinsh closed 3 years ago

serbinsh commented 3 years ago

Description:

A new 1x1 Brazil example with command-line customizable options

Details

Example of running the script with the new options, including setting start year, number of years, default met years to use , compset, output variables, and output frequency

docker run -t -i --hostname=docker --user $(id -u):$(id -g) -v ~/scratch/ctsm_fates:/output \
-v /Volumes/data/Model_Data/cesm_input_datasets:/inputdata -v ~/Data/GitHub/docker-fates-tutorial/scripts:/scripts/ \
ngeetropics/fates-ctsm-gcc650:latest /scripts/ctsm_fates_docker_1x1brazil.sh --compset=I2000Clm50FatesGs \
--start_year='2010-01-01' --num_years=5 --run_type=startup --met_start=2010 --met_end=2014 --output_vars=output_vars.txt \
--output_freq=H --descname=1x1brazil --debug=FALSE

Collaborators:

Docker image component versions

Base OS: Host land model: CTSM FATES tag: release-clm5.0.30-143-gabcd593; Cabcd593-F3248e63

Checklist:

Test results

Build test on personal repo: NA Test case results: NA

serbinsh commented 3 years ago

Final steps: provide updated documentation on how to use the new script and customize the options, including how to edit the output_vars.txt file to allow expansion or modification of output variables.

serbinsh commented 3 years ago

Added in the ability to customize output variables, to a certain extent, by using the new output_vars.txt (name can be changed by the user as long as they use the cmd flag to define it) file to select desired output variables. Also the user can select either hourly or monthly outputs but we should probably eventually make it so we have more flexibility in this.

Running the script produces this initial feedback on settings:

Current directory: /
Model compset  = I2000Clm50FatesGs
Model simulation start year  = 2010-01-01
Number of simulation years  = 5
Run type = startup
DATM_CLMNCEP_YR_START: 2010
DATM_CLMNCEP_YR_END: 2014
Selected output variables: 'NEP','GPP','NPP','AR','HR','AGB','TLAI','ALBD','QVEGT', 'EFLX_LH_TOT','ED_biomass','ED_bleaf','ED_balive','NET_C_UPTAKE_CNLF', 'WIND','ZBOT','FSDS','RH','TBOT','PBOT','QBOT','RAIN','FLDS'
Selected output frequency: H
Descriptive case name: 1x1brazil
Running with CTSM location: /CTSM
*** start: 2020-10-30_18-18-25
*** Building CASE: /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25
Calling create_newcase
Compset longname is 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV
Compset specification file is /CTSM/cime/../cime_config/config_compsets.xml
Compset forcing is 1972-2004
ATM component is  Data driven ATM  GSWP3v1 data set
LND component is clm5.0:FATES (Functionally Assembled Terrestrial Ecosystem Simulator) Ecosystem Demography model: (experimental)
ICE component is Stub ice component
OCN component is Stub ocn component
ROF component is MOSART: MOdel for Scale Adaptive River Transport
GLC component is Stub glacier (land ice) component
WAV component is Stub wave component
ESP component is
Pes     specification file is /CTSM/cime/../cime_config/config_pes.xml
Could not find machine match for 'docker' or 'docker'
Machine is docker
Pes setting: grid match    is l%1x1|l%CLM_USRDAT
Pes setting: grid          is a%1x1_brazil_l%1x1_brazil_oi%null_r%null_g%null_w%null_m%null
Pes setting: compset       is 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV
Pes setting: tasks       is {'NTASKS_ATM': 1, 'NTASKS_ICE': 1, 'NTASKS_CPL': 1, 'NTASKS_LND': 1, 'NTASKS_WAV': 1, 'NTASKS_ROF': 1, 'NTASKS_OCN': 1, 'NTASKS_GLC': 1}
Pes setting: threads     is {'NTHRDS_ICE': 1, 'NTHRDS_ATM': 1, 'NTHRDS_ROF': 1, 'NTHRDS_LND': 1, 'NTHRDS_WAV': 1, 'NTHRDS_OCN': 1, 'NTHRDS_CPL': 1, 'NTHRDS_GLC': 1}
Pes setting: rootpe      is {'ROOTPE_OCN': 0, 'ROOTPE_LND': 0, 'ROOTPE_ATM': 0, 'ROOTPE_ICE': 0, 'ROOTPE_WAV': 0, 'ROOTPE_CPL': 0, 'ROOTPE_ROF': 0, 'ROOTPE_GLC': 0}
Pes setting: pstrid      is {}
Pes other settings: {}
Pes comments: none
 Compset is: 2000_DATM%GSWP3v1_CLM50%FATES_SICE_SOCN_MOSART_SGLC_SWAV
 Grid is: a%1x1_brazil_l%1x1_brazil_oi%null_r%null_g%null_w%null_m%null
 Components in compset are: ['datm', 'clm', 'sice', 'socn', 'mosart', 'sglc', 'swav', 'sesp', 'drv', 'dart']
No project info available
No charge_account info available, using value from PROJECT
No project info available
cesm model version found: release-clm5.0.30-143-gabcd593
Batch_system_type is none
 Creating Case directory /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25
Changing to case directory:  /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25
...

And this new output when finished building the case

MODEL BUILD HAS FINISHED SUCCESSFULLY
*** Finished building new case in CASE: /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25 ***

*****************************************************************************************************
If you built this case interactively then:
To submit the case change directory to /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25 and run ./case.submit

If you built this case non-interactively then change your Docker run command to:

docker run -t -i --hostname=docker --user $(id -u):$(id -g) --volume /path/to/host/inputs:/inputdata \
--volume /path/to/host/outputs:/output docker_image_tag /bin/sh -c 'cd /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25 && ./case.submit'

Where:
/path/to/host/inputs is your host input path, such as /Volumes/data/Model_Data/cesm_input_datasets
/path/to/host/outputs is your host output path, such as ~/scratch/ctsm_fates
/path/to/host/outputs is the docker image tag on your host machine, e.g. ngeetropics/fates-ctsm-gcc650:latest

Alternatively, you can use environmental variables to define the constants, e.g.:
export input_data=/Volumes/data/Model_Data/cesm_input_datasets
export output_dir=~/scratch/ctsm_fates
export docker_tag=ngeetropics/fates-ctsm-gcc650:latest

And run the case using:
docker run -t -i --hostname=docker --user $(id -u):$(id -g) --volume ${input_data}:/inputdata \
--volume ${output_dir}:/output ${docker_tag} /bin/sh -c 'cd /output/1x1brazil.fates.docker.Cabcd593-F3248e63.2020-10-30_18-18-25 && ./case.submit'
*****************************************************************************************************