models/clm/work/workshop_setup.csh

Is not specifically intended to be run in a workshop setting! The models/run_tests.csh script checks for the existence of a workshop_setup.csh

and runs that instead of a predefined sequence of tests. Since CLM requires the clm_to_dart and dart_to_clm, I put the expected sequence

of execution into a workshop_setup.csh and modified the input.nml.testing namelist accordingly. The data files and input.nml.testing are

in the test_build_datasets.tar file.  As an overview, workshop_setup.csh runs (in the proper order):

  • quickbuild.csh
  • clm_to_dart
  • perfect_model_obs
  • fill_inflation_restart
  • filter
  • dart_to_clm



Crude test of whether the indeterminate values were getting replaced correctly.

  • get any clm_restart.nc and a clm_history.nc file, the smaller, the better.
  • dump the input CLM restart file into a text file using the 'Fortran' format:    ncdump -f F clm_restart.nc > original_with_indeterminate.cdl

  • copy the clm_restart.nc to clm.nc as expected by clm_to_dart
  • run clm_to_dart
  • dump the modified copy into a text file using the 'Fortran' format:    ncdump -f F clm.nc > input_to_dart.cdl
  • rename clm.nc to dart_posterior.nc as expected by dart_to_clm  (the expected input filename is clm_restart.nc)
  • run dart_to_clm  (which updates clm_restart.nc)
  • dump the updated file:    ncdump -f F clm_restart.nc > output_from_dart.cdl
  • do a three-way diff:   diffuse original_with_indeterminate.cdl   input_to_dart.cdl  output_from_dart.cdl



Using the models/clm/shell_scripts/cesm2_2 scripts (29 June 2021):

There is an initial ensemble in /glade/p/cisl/dares/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop that can be used

to test assimilation experiments. The ctsm_2011-01-01-00000 directory has 80 ensemble members from clm5.0.06 at 

f09_f09_mg17 resolution (compset: 2000_DATM%GSWP3v1_CLM50%BGC-CROP_SICE_SOCN_MOSART_SGLC_SWAV).

The CASEROOT for the experiment that created the ensemble has been copied to 

/glade/p/cisl/dares/RDA_strawman/CESM_ensembles/CLM/CLM5BGC-Crop/ctsm_2011-01-01-00000/CASEROOT/


The observations being used by the scripts are minimal, to say the least. The pmo observations in the directories specified by DART_params.csh

setenv pmo_input_baseobsdir   /glade/p/cisl/dares/Observations/land/pmo/input
setenv pmo_output_baseobsdir  /glade/p/cisl/dares/Observations/land/pmo/output

contain precisely 4 observations that are very widely separated. It would be a great improvement if the gridcells that contain the observation 

locations were somehow 'interesting' in that maybe they could contain multiple columns, multiple PFTs, etc.  When I made the observations

I did not think of those implications at all. I put BIOMASS in the Amazon,  MODIS_SNOWCOVER_FRAC in Siberia, SOIL_TEMPERATURE in Australia, etc.


The observations for the filter experiment are set by

setenv baseobsdir             /glade/p/cisl/dares/Observations/land

which (for 201101) is just a link to the 4 observations from the pmo output.


The composition of the DART vector is chosen to be a good case to exercise many of the paths through the code, it is NOT

a recommendation for a scientifically interesting configuration!


Be aware that the obs_def_tower_mod.f90 is still orphaned. These forward operators were specifically to test assimilating fluxes from tower locations.

The whole thing should be rewritten in terms of precomputed forward operators (something that did not exist at the time). The obs_def_tower_mod.f90

required knowledge of CLM history files (a direct violation of DART philosophy) and actually opened and read netCDF files and

extracted the desired flux from the timestep nearest the observation time. This was slow and expensive - but there are not that many flux towers,

so it was acceptable. Again - this capability has been dropped. 




A collection of orphaned modifications to CLM-DART capabilities:

/glade/p/cisl/dares/thoar/CLM_variants is a directory full of routines that provide various capabilities - from (very slowly)

assimilating brightness temperatures to updating snow, modifying the depth to the water table, etc.

These have come from various collaborators through the years and probably still have some useful code in them. 



Less Crude test of an assimilation.

The intent is to test with a coarse resolution global version of CLM. When asked what the CLM developers use, Bill Sacks indicated (on 26 May 2021):

"We use f10_f10_mg37 (in recent tags) or f10_f10_musgs (in tags older than a few months ago) for testing. That is 10 deg x 15 deg."

So Brett ran a couple single-instance cases that ran in month-long steps and started from Year 0.  Since CLM-DART requires dates from the 

Gregorian calendar, these dates had to be modified.  There is a way to set the start date in a CLM run, so a cleaner testing sequence should use that.

The models/clm/shell_scripts/simple.csh  does this (although it is not currently configured to run the tag or resolution that Bill recommended).


set BASE = /glade/scratch/bmraczka/CLM5.0.34/10x15

cp $BASE/clm5_tag34.clm2.r.0003-01-01-00000.nc  .
cp $BASE/clm5_tag34_average.clm2.h0.0002-01.nc clm5_tag34.clm2.h0.0002-01.nc
cp $BASE/clm5_tag34_vector.clm2.h0.0002-01.nc  clm5_tag34.clm2.h2.0002-01.nc

# I then manually modified the date in the restart to be something from this millenia

cp clm5_tag34.clm2.r.2003-01-01-00000.nc ../clm5_tag34.clm2_0001.r.2003-01-01-00000.nc
cp clm5_tag34.clm2.r.2003-01-01-00000.nc ../clm5_tag34.clm2_0002.r.2003-01-01-00000.nc
cp clm5_tag34.clm2.r.2003-01-01-00000.nc ../clm5_tag34.clm2_0003.r.2003-01-01-00000.nc

cp clm5_tag34.clm2.h0.0002-01.nc         ../clm5_tag34.clm2_0001.h0.0002-01.nc
cp clm5_tag34.clm2.h0.0002-01.nc         ../clm5_tag34.clm2_0002.h0.0002-01.nc
cp clm5_tag34.clm2.h0.0002-01.nc         ../clm5_tag34.clm2_0003.h0.0002-01.nc

cp clm5_tag34.clm2.h2.0002-01.nc         ../clm5_tag34.clm2_0001.h2.0002-01.nc
cp clm5_tag34.clm2.h2.0002-01.nc         ../clm5_tag34.clm2_0002.h2.0002-01.nc
cp clm5_tag34.clm2.h2.0002-01.nc         ../clm5_tag34.clm2_0003.h2.0002-01.nc

cd ..

foreach FILE ( clm5_tag34.clm2_000?.r.2003-01-01-00000.nc \
               clm5_tag34.clm2_000?.h0.0002-01.nc \
               clm5_tag34.clm2_000?.h2.0002-01.nc )

   cp $FILE clm.nc
   ./clm_to_dart  >& /dev/null
   set OFILE = $FILE:r:r
   mv clm.nc  ${OFILE}.nc
end

ls -1 clm5_tag34.clm2_000?.r.nc  >! restart_files.txt
ls -1 clm5_tag34.clm2_000?.h0.nc >! history_files.txt
ls -1 clm5_tag34.clm2_000?.h2.nc >!  vector_files.txt

# update the file in-place
cp restart_files.txt restart_files_out.txt
cp history_files.txt history_files_out.txt
cp  vector_files.txt  vector_files_out.txt


  • got the obs_seq.in from /glade/p/cisl/dares/DART_test_cases/test_build_datasets_preprocess.tar and hand-edited the time to coincide with the model time (2003 1 1 ....      0     146827)
  • edited the filter namelist to perturb from single instance (amplitude 0.2)
  • run perfect_model_obs
  • dump the input CLM restart file into a text file using the 'Fortran' format:    ncdump -f F clm5_tag34.clm2_0001.r.nc > original_with_indeterminate.cdl

  • run filter
  • run dart_to_clm on the updated clm5_tag34.clm2_0001.r.nc
  • dump the updated file into a text file and compare to original_with_indeterminate.cdl 


There are a couple FOs that are known not to work yet, but the SOIL_TEMPERATURE is interesting.

The DART state was constructed from the TSOI(time, levgrnd, lat, lon) history variable and the special 'get_close_state()' routine was not configured to consider anything

with the 'lat' or 'lon' dimension as something that could be close. Consequently, the posterior state of soil temperature was unchanged, even though the observation was assimilated successfully.


  • No labels