Skip to content

Conversation

@samsrabin
Copy link
Owner

Just a mirror of ESCOMP#3264, but pointing at my subset_data-lon-fixes branch so we can see just the diffs from that.


import pandas as pd
# Get the ctsm tools
_CTSM_PYTHON = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "python"))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace .. with pardir

parser.add_argument(
"--16pft",
help="Create and/or modify 16-PFT surface datasets (e.g. for a FATES run) ",
"--78pft",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to --crop for consistency with flags in other scripts.

"""
Given a number, check whether it represents a valid PFT
"""
return pft_num >= 1
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to 0; bare ground is OK.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check that it's <= 78 (as read in as constant).

#ATM_NCPL is specified so that the time step of the model matches the time interval specified by the atm forcing data.
#longitudes must be in the range [-180,180]
,Site,Lat,Lon,pft1,pft1-%,pft1-cth,pft1-cbh,pft2,pft2-%,pft2-cth,pft2-cbh,start_year,end_year,RUN_STARTDATE,START_TOD,ATM_NCPL
26,Invalid-Pft,51.309166, 4.520560,0,19.22,21.00,10.50,7,80.78,21.00,12.08,2004,2014,2003-12-31,82800,48
Copy link
Owner Author

@samsrabin samsrabin Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change invalid PFT to -1, because 0 will soon be valid.

# Check
self.assertEqual(n_files_expected, n_files)

def test_plumber2_surf_wrapper_78pft(self):
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Combine shared code between this and above.


def test_plumber2_surf_wrapper_78pft(self):
"""
Run the entire tool with --78pft.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add testing: Should abort if given PFT > 16 in a 16-pft run.

@samsrabin
Copy link
Owner Author

  • Look into updating equivalent NEON script too.

@samsrabin samsrabin force-pushed the plumber2_surf_wrapper-fixes branch from 722504e to 63d61f4 Compare June 20, 2025 22:08
@samsrabin samsrabin closed this Jun 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant