Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

CAM and CLM output frequency

San Diego WX

fdesales
New Member
Hi there. I am new to CESM and need help figuring out how to control output frequency. I am doing a 1-yr FHIST run and would like output for get daily average precipitation and daily average near-surface temperature. Below are my edits so far

1) added these lines to user_nl_cam
fincl2='PRECC','PRECL'
nhtfrq=0,-24
mfilt=1,1

2) added this to user_nl_clm
hist_fincl2 = 'TSA'
hist_nhtfrq = 0,-24
hist_mfilt = 1,1

I can build and run the model but I am not sure I am getting what I wanted. Are my changes correct? Am I getting daily averages or instantaneous values?
Thank you!
 

hannay

Cecile Hannay
AMWG Liaison
Staff member
Yes, this will give you daily output of the variable of the variables
'PRECC' and 'PRECL' for CAM
'TSA' for CLM

If you want to make sure to have daily average you can add the flag ':A'
Also, I recommend that you increase mfilt for the daily output. The current setting will give one file per day. It will be many files and it is not the best way to handle the space.

for instance, you could try:

Code:
fincl2='PRECC:A','PRECL:A'
nhtfrq=0,-24
mfilt=1,30

2) added this to user_nl_clm
Code:
hist_fincl2 = 'TSA:A'
hist_nhtfrq = 0,-24
hist_mfilt = 1,30
 

zarzycki

New Member
hist_nhtfrq=0 means monthly output, so that is what you would expect. See @hannay's example again, the first integer in hist_nhtfrq, hist_mfilt, corresponds to the fincl1 (h0) files, the second integer corresponds to the fincl2 (h1) files, etc.

Code:
hist_fincl2 = 'TSA:A'
hist_nhtfrq = 0,-24
hist_mfilt = 1,30
 

CGL

CGL
Member
Yes, I want to output a netCDF file that contains 12 month for 1 year. But the code seems didn't work.
hist_mfilt=12 ,hist_nhtfrq=0
 

zarzycki

New Member
The monthly averaged files (nhtfrq=0) are hardcoded to have one timestamp by default. I do not know the formal origin of this decision, but I assume it has to do with the diagnostics packages that are used to evaluate the model.

E.g., in cam_history.F90.

Code:
        ! Only one time sample allowed per monthly average file
        !
        if (nhtfrq(t) == 0) then
          mfilt(t) = 1
        end if

I see two viable options.
1.) Make sourcemods to remove this restriction on monthly average files.
2.) Use a tool such as ncrcat to "glue" monthly averages files together as a postprocessing step.

Code:
module load nco # or conda install nco -c conda-forge
ncrcat mycamfiles.h0.*nc myconcatenatedfile.nc

The latter is probably easiest (and preferred).
 

zarzycki

New Member
FYI, the relevant code in CTSM (histFileMod.F90)

Code:
  integer, public :: &
       hist_mfilt(max_tapes) = (/ 1, (30, ni=2, max_tapes)/)        ! namelist: number of time samples per tape
 

CGL

CGL
Member
The monthly averaged files (nhtfrq=0) are hardcoded to have one timestamp by default. I do not know the formal origin of this decision, but I assume it has to do with the diagnostics packages that are used to evaluate the model.

E.g., in cam_history.F90.

Code:
        ! Only one time sample allowed per monthly average file
        !
        if (nhtfrq(t) == 0) then
          mfilt(t) = 1
        end if

I see two viable options.
1.) Make sourcemods to remove this restriction on monthly average files.
2.) Use a tool such as ncrcat to "glue" monthly averages files together as a postprocessing step.

Code:
module load nco # or conda install nco -c conda-forge
ncrcat mycamfiles.h0.*nc myconcatenatedfile.nc

The latter is probably easiest (and preferred).
You are right. I see the hist_mfilt must equal 1 when we set the hist_nhtfrq=0 in the Tutorials. The ncrcat may be the best way.
 
Top