Modify CAM output#
Create a case called b1850_high_freq using the compset B1850C_LTso at resolution ne16pg3_t201. Use --run-unsupported because the 2 degree resolution is not supported at this stage.
We will interpolate CAM history output to a regular 2° × 2° latitude–longitude grid.
In addition to the monthly h0 output, tell CAM to output:
Instantaneous values of
T,Q,U, andVevery 24 hours.Time-averaged values of
T,Q,U, andVevery 3 hours.
Set the namelist so that you produce:
one
h1ifile with all the daily instantaneous output for the monththirty-one
h2afiles, one for each day of the month, with 3-hourly time-averaged output
Basically, your goal is to produce:
one
h1ifile with 31 time samplesthirty-one
h2afiles with 8 time samples each
Set the run length to 1 month and make a 1-month run.
Click here for hints
# How do I compile?
You can compile with the command:
qcmd -- ./case.build
# How do I control the output?
Use CAM namelist variables:
nhtfrq
mfilt
fincl
Use the CAM interpolation settings to interpolate history output to a regular 2° × 2° latitude–longitude grid.
Look at the online documentation for these variables.
Click here for the solution
# Create a new case
Create a new case b1850_high_freq with the command:
cd /glade/u/home/$USER/code/my_cesm_code/cime/scripts/
./create_newcase --case ~/cases/b1850_high_freq \
--compset B1850C_LTso \
--res ne16pg3_t201 \
--run-unsupported
# Setup
Invoke case.setup with the command:
cd ~/cases/b1850_high_freq
./case.setup
# Customize namelists
Edit the file user_nl_cam and add the lines:
nhtfrq = 0, -24, -3
mfilt = 1, 31, 8
fincl2 = 'T:I','Q:I','U:I','V:I'
fincl3 = 'T','Q','U','V'
interpolate_output = .true.
interpolate_nlat = 91
interpolate_nlon = 180
Note: For fincl3, you could write:
fincl3 = 'T:A','Q:A','U:A','V:A'
But since averaging :A is the default for these variables, it is not necessary to specify it explicitly.
# Set run length
Change the run length:
./xmlchange STOP_N=1,STOP_OPTION=nmonths
# Change the job queue and account number
If needed, change job queue and account number.
For instance, to run in the queue tutorial and the project number UESM0016 (You should use the project number given for this tutorial), use the command:
./xmlchange JOB_QUEUE=tutorial,PROJECT=UESM0016 --force
# Build and submit
Build the model and submit your job:
qcmd -- ./case.build
./case.submit
# Look at your solution
When the run is complete, go to the archive directory:
cd /glade/derecho/scratch/$USER/archive/b1850_high_freq/atm/hist
ls
In CESM3, CAM history files are separated into averaged and instantaneous files using the suffixes a and i.
You should see files like:
- h0
b1850_high_freq.cam.h0a.0001-01.nc
b1850_high_freq.cam.h0i.0001-02-01-00000.nc
- h1
b1850_high_freq.cam.h1i.0001-01-02-00000.nc
- h2
b1850_high_freq.cam.h2a.0001-01-01-10800.nc
...
b1850_high_freq.cam.h2a.0001-01-31-10800.nc
b1850_high_freq.cam.h2i.0001-01-01-10800.nc
...
b1850_high_freq.cam.h2i.0001-01-31-10800.nc
The important files for this exercise are:
h1i: daily instantaneous output requested withfincl2 = 'T:I','Q:I','U:I','V:I'h2a: 3-hourly averaged output requested withfincl3 = 'T:A','Q:A','U:A','V:A'
You will also see companion instantaneous or averaged files, such as h0i or h2i. This is expected in CESM3 because CAM history streams are split into a and i files.
For this exercise, focus on checking:
ncdump -h b1850_high_freq.cam.h1i.0001-01-02-00000.nc
ncdump -h b1850_high_freq.cam.h2a.0001-01-01-10800.nc
The h1i file should contain the instantaneous fields. These variables should have:
cell_methods = "time: point" ;
The h2a files should contain the time-averaged fields. These variables should include:
cell_methods = "time: mean"
Check the number of time samples:
ncdump -h b1850_high_freq.cam.h1i.0001-01-02-00000.nc | grep time
ncdump -h b1850_high_freq.cam.h2a.0001-01-01-10800.nc | grep time
The h1i file should contain 31 time samples.
Each h2a file should contain 8 time samples.
You can also check file sizes with:
du -skh /glade/derecho/scratch/$USER/archive/b1850_high_freq/atm/hist/*
# Why do some filenames end with 00000 while others end with 10800?
The last field in a CAM history filename is the number of seconds since midnight associated with the output time.
For example:
00000corresponds to 00:00:00 UTC (midnight).10800corresponds to 03:00:00 UTC (3 × 3600 seconds = 3 hours).
For this exercise:
The
h1istream contains one instantaneous sample per day. The sample is written at the beginning of the day, so the filename ends with00000.The
h2astream contains 3-hourly time-averaged output. The first average represents the interval from 00:00 to 03:00, so the timestamp corresponds to the end of the averaging period, giving10800(03:00 UTC).
Similarly, the remaining time samples in each h2a file correspond to averages ending at 06:00, 09:00, …, up to 24:00.
Notice that there is also an h2i file. It contains the corresponding instantaneous output at the same sampling frequency, with timestamps matching the same output times.