Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c1fe8fb
I've itterated with Claude Opus 5.5 Medium all day on this script to …
ekluzek Oct 3, 2026
2b8dc0d
Always output the lat/lon variables, and have Claude bring in some ge…
ekluzek Oct 5, 2026
f99f9f1
Rename script
ekluzek Oct 6, 2026
92d7bfd
Asked Claude to modularize and put into smaller functions
ekluzek Oct 7, 2026
b1ac65d
Add a comment option so that write_part2 can be used in other contexts
ekluzek Oct 7, 2026
9614c10
Remove the old tester status files, add a general match for batch fil…
ekluzek Oct 7, 2026
1dbb07d
Have Claude convert the bash script to python in our existing python …
ekluzek Oct 7, 2026
366ae4e
Remove the bash script now that I trust the new python script
ekluzek Oct 7, 2026
29efae6
Add more comments and metadata, also abort if the outfile already exi…
ekluzek Oct 10, 2026
6f51a69
Run black and get it to pass through pylint
ekluzek Oct 10, 2026
7fe2d46
OK these are the changes from Claude to fix problems I introduced, I …
ekluzek Oct 10, 2026
a127194
Add long_name, standard_name and axis, as well as host and tweak some…
ekluzek Oct 11, 2026
cb0f6fa
Some adjustments from Claude to get it closer to CF-Convention compli…
ekluzek Oct 11, 2026
bd1eb5f
Get the compliance-checker to pass for CF-1.11, tweak some of the met…
ekluzek Oct 12, 2026
5cc51c7
Run black and make sure passes pylint
ekluzek Oct 12, 2026
f0b6c26
Add a comment that the doi is the CESM2 one and should be updated whe…
ekluzek Oct 12, 2026
724d94e
Recommendations from Claude
ekluzek Oct 12, 2026
0aec3e7
Updates from Claude so that the final lat/lon variables on the file d…
ekluzek Oct 12, 2026
b1426fa
Up the number of jobs for batch to 64 and 16 for interactive
ekluzek Oct 12, 2026
5b1e4a6
Have Claude add INTERACTIVE_JOBS and set it to 12 as that's the numbe…
ekluzek Oct 12, 2026
58b88c8
Update python/ctsm/cplhist/daily_to_monthly_clim.py
ekluzek Oct 12, 2026
8b61577
Update python/ctsm/cplhist/daily_to_monthly_clim.py
ekluzek Oct 12, 2026
1590542
Merge branch 'b4b-dev' into aero_daily_to_monthly_clim_script
ekluzek Oct 15, 2026
9f77e59
There was one field that was missing and I also added an attribute to…
ekluzek Oct 16, 2026
8797607
Add compliance-checker to the ctsm_pylib env so that a CF compliance …
ekluzek Oct 16, 2026
6082a59
Merge branch 'aero_daily_to_monthly_clim_script' of github.com:ekluze…
ekluzek Oct 16, 2026
b22f86e
unit and sys tests from Claude Opus 5.5 medium for the new tool, this…
ekluzek Oct 24, 2026
6e5ecf4
Change short local name from dtm to d2mc for daily_to_monthly_climato…
ekluzek Oct 25, 2026
1903f6a
Clarify some error messages, and add some comments to explain what's …
ekluzek Oct 25, 2026
1e99820
Small black commit from last edit
ekluzek Oct 26, 2026
cb0f4af
Got through the new unit test and add comments to explain things bett…
ekluzek Oct 26, 2026
3633b07
Fix the error messages so the unit test now passes, passes both black…
ekluzek Oct 26, 2026
c308ef3
Add a comment that this unit test does I/O
ekluzek Oct 26, 2026
d31b1c2
Fixes from Claude on the changes I made, fixing typos and other clari…
ekluzek Oct 26, 2026
fe8bd71
Two other things commented on from Claude, remove the backwards compa…
ekluzek Oct 26, 2026
63b0b10
Run black
ekluzek Oct 26, 2026
0d114b4
Change local shortname from dtm to d2mc
ekluzek Oct 26, 2026
2515276
Add the compliance checker and get the tests to pass with it, which r…
ekluzek Oct 26, 2026
8eef6a8
I asked Claude to change it to an Object Oriented programming paradig…
ekluzek Oct 28, 2026
c23d39f
Merge branch 'b4b-dev' into aero_daily_to_monthly_clim_script
ekluzek Oct 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ buildnmlc
/bld/unit_testers/user_nl_ctsm_real_parameters*
/bld/unit_testers/env_run.xml

# tools testing output
td.*.status
td.*.log
td.*.status.xFail

# mksurfdata output
surfdata_*.log
*.namelist
Expand All @@ -76,7 +71,6 @@ ctsm.input_data_list
ctsm.input_data_list.previous
*.stdout.txt.o*
/tools/mksurfdata_esmf/PET*
/tools/mksurfdata_esmf/job_name.o*
/tools/mksurfdata_esmf/mksurfdata_in
/tools/mksurfdata_esmf/surfdata_*.nc
/tools/mksurfdata_esmf/landuse.timeseries_*.nc
Expand Down Expand Up @@ -116,6 +110,9 @@ core.*
*.pyc
Depends

# Batch output files (both Derecho and Izumi)
*.o[0-9]+

# Docs build and testing output
_build*/
_publish*/
Expand Down
1 change: 1 addition & 0 deletions python/conda_env_ctsm_py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- black=25.1.0
- cartopy=0.24.0
- matplotlib=3.10.1
- compliance-checker=6.1.0
- pip=25.0.1

# For VS code
Expand Down
Empty file added python/ctsm/cplhist/__init__.py
Empty file.
79 changes: 79 additions & 0 deletions python/ctsm/cplhist/aero_1850_monthly_clim.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""
Create a 12-month climatology of the aerosol deposition fields from daily CMEPS coupler history
(CPLHIST) files, for use by DATM.

The input files are the daily averaged atmosphere coupler history files:

ARCHDIR/CASE/cpl/hist/CASE.cpl.hx.atm.24h.avrg.YYYY-MM-DD-00000.nc

for the years BEGYEAR to ENDYEAR. The steps are:

1. Average the daily files of each month of each year (ncra)
2. Average each calendar month over all the years (ncra), and put the 12 months in one
file (ncrcat)
3. Set the time axis to the middle of each month of YEAR (noleap calendar)

The output file is:

OUTDIR/CASE/proc/CASE.cpl.hx.atm.monclim.BEGYEAR-ENDYEAR_cYYYYMMDD.nc

This needs the NCO commands ncra, ncrcat and ncatted (on Derecho: module load nco).
With --batch, the input is checked and then this tool is submitted to the PBS batch queue.

The general code is in cplhist_monthly_clim.py, this sets what's specific to aerosols for 1850.

A previous version of this for CESM2 is in NCL and here on Derecho by Keith Oleson:
/glade/u/home/oleson/misc_programs/CLM5Dev/CMIP6/CreateAeroDepFile_Task5B.ncl
It did 5 year averages over the historical period and then did a linear interpolation
between the 5-year averages. It also used CPLHIST output from several ensemble members and
averged them together with ncea. This is something that will have to be done in the future
in this tool as well.

Another example for Nitrogen deposition is here from Simone Tilmes and Mike Mills:
https://svn.code.sf.net/p/codescripts/code/trunk/ncl/cam_forcing/CreateDepositionFile.ncl

Neither were quite right for what's needed here. And both are in NCL which is well after
end of life now.

Also there is code in LDF to create monthly climatologies, but it's not setup to bring in ensemble
averages and not specialized to create datafiles for DATM aerosol forcing.
"""

import os

from ctsm.cplhist.cplhist_monthly_clim import CplhistMonthlyClim


class Aero1850MonthlyClim(CplhistMonthlyClim):
"""
Monthly climatology of the aerosol deposition fields for 1850
"""

DEFAULT_VARS = [
"atmImp_Faxa_bcph1",
"atmImp_Faxa_bcph2",
"atmImp_Faxa_bcph3",
"atmImp_Faxa_ocph1",
"atmImp_Faxa_ocph2",
"atmImp_Faxa_ocph3",
"atmImp_Faxa_dstwet1",
"atmImp_Faxa_dstdry1",
"atmImp_Faxa_dstwet2",
"atmImp_Faxa_dstdry2",
"atmImp_Faxa_dstwet3",
"atmImp_Faxa_dstdry3",
"atmImp_Faxa_dstwet4",
"atmImp_Faxa_dstdry4",
]
DEFAULT_YEAR = 1850
PBS_JOBNAME = "aero_1850_monthly_clim"
WRAPPER = os.path.join("tools", "cplhist", "aero_1850_monthly_clim")
TITLE = "Monthly Climatology of Daily Averaged Atmosphere Coupler History Files"
COMMENT = "Monthly climatology created from daily averaged CPLHIST files for DATM"


def main():
"""
Main program for aero_1850_monthly_clim
"""
Aero1850MonthlyClim.main()
Loading
Loading