Skip to content

Merge COMPASS contents from MPAS-Dev/MPAS-Model/develop - #1

Merged
xylar merged 9 commits into
MPAS-Dev:masterfrom
xylar:develop
Nov 6, 2020
Merged

xylar merged 9 commits into
MPAS-Dev:masterfrom
xylar:develop

Conversation

@xylar

@xylar xylar commented Nov 6, 2020

Copy link
Copy Markdown
Collaborator

pwolfram and others added 9 commits June 24, 2019 08:51
Python3 treats supprocess.check_output as a byte,
which is no longer strictly equivalent to a string
as in python2.  Consequently, conversion is needed
for equivalence between the strings for the python3
migration.
This is needed for copying config files that may then be altered
by the user within a test case.

Since there is a significant amount of redundant code between this
and and support for the `add_link` tag, a helper function has been
added to encapsulate the redundancy.

Some error messages have been modified to raise exceptions.
This merge makes a dict of test cases, each with a dict of info:
core, configuration, resolution, test, procs and treads.

This will be useful later on in both determining whether
prerequisite tasks are present and in determining how to run
many tests in parallel
Make sure they are also in the test suite
This prevents variables being in global scope that we may not
want.
This is specified either in the config file or at the command
line.
This will allow different cores to be synced with different
versions of the compass conda environment and will allow each
core to update the version its develop branch as needed.
@xylar

xylar commented Nov 6, 2020

Copy link
Copy Markdown
Collaborator Author

@mark-petersen and @matthewhoffman, I don't think this one needs a review because not many commits are involved and they have already been reviewed on MPAS-Model. I'm going to merge.

@xylar
xylar merged commit 5e0ac42 into MPAS-Dev:master Nov 6, 2020
@xylar
xylar deleted the develop branch November 6, 2020 09:47
trhille added a commit to trhille/compass that referenced this pull request Sep 26, 2026
Addressed review comments MPAS-Dev#1, MPAS-Dev#2, MPAS-Dev#3, MPAS-Dev#4, MPAS-Dev#5, MPAS-Dev#6, MPAS-Dev#7, MPAS-Dev#8 from the Copilot
review. Deferred MPAS-Dev#9 (Dask dependency) and MPAS-Dev#10 (test suite) as low priority.

CODE FIXES:

region) to the nearest region by great-circle distance (cKDTree), instead of
silently assigning them to basin 1 via argmax. Overlapping cells (multiple
regions) still pick the first matching region. Added lat/lon parameters to
build_basin_ids and updated the call site in load_mesh_and_basins.

greenland_3d.py so only the public API (Config and run) remains non-
underscored. This satisfies the repository convention that non-underscore
module-scope symbols should be documented in api.rst.

ice) with a finite JSON target would crash calibrate_gamma0 instead of being
excluded. Now NaN out empty regions in the target array before calibration, so
active_regions correctly excludes both NaN targets and empty regions.

DOC FIXES:

(it uses forcing_interval_annual). GrIS 3D stays in Monthly (correct).

{mesh}_2dThermalForcing_*.nc (GrIS) and {mesh}_3dThermalForcing_*.nc
(AIS; optional GrIS), and fixed lowercase smb→SMB.

locations (user/dev ismip7_forcing.rst) since the checked-in JSON requests 20
levels and it's configurable.

NETCDF3_64BIT" to "netCDF4 engine → nccopy -k nc6 for CDF-2" (actual
implementation uses netCDF4 + nccopy conversion).

block (required by ismip7_run as melt_params_path but was undocumented).

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
trhille added a commit to trhille/compass that referenced this pull request Sep 29, 2026
…d; document validation helper

Copilot findings MPAS-Dev#1-4 were valid:

1. Source version not in filename (HIGH): The forcing archive versions each
   source (e.g. v1, v2, v2.1) as a directory, and ForcingSource.version
   carries it, but output filenames omitted it. Upgrading from v1 to v2 in
   the archive caused the 'skip if exists' guard to reuse stale v1 output.

2. 3-D guard mishandles partial runs (HIGH): The first_chunk guard skipped
   the whole step when only the first chunk existed, leaving later chunks
   unwritten after a timeout. greenland_3d already has its own PER-CHUNK
   skip logic that correctly resumes partial runs.

3. Overwrite config ignored (MEDIUM): The first_chunk guard ran before the
   JSON was loaded, defeating a user's 'overwrite=true' request.
   greenland_3d's own logic honors cfg.overwrite.

4. netcdf_file_is_valid missing from API (LOW): Function had a complete
   docstring but was not registered in the Sphinx autosummary.

Changes:
- Embed source.version (or job.version) in all output filenames, placed
  BEFORE the year range: {mesh}_SMB_{model}_{scenario}_{version}_{start}-
  {end}.nc. Placement before the year range preserves trailing patterns
  that downstream regexes anchor to (_\d{4}-\d{4}$, _(\d{4})\.nc$), so no
  changes needed in greenland_3d.py or ismip7_run/set_up_experiment.py.
- Remove the step-level first_chunk guard from build_3d_thermal_forcing.py
  (the redundant/conflicting guard added in commit 90fc71a). Delegate to
  greenland_3d's own per-chunk skip/overwrite logic, which is finer-grained
  (handles partial runs correctly) and overwrite-aware (honors the JSON
  cfg.overwrite flag).
- Add remap.netcdf_file_is_valid to docs/developers_guide/landice/api.rst
  (before remap.extrapolate_source, following source order).

Affected filenames (10 steps):
- Atmosphere: {version}_{start}-{end}.nc for SMB, temperature, runoff,
  gradients
- Ocean: {version}_{start}-{end}.nc for 2D/3D thermal forcing; climatology
  already embedded version (unchanged)
- Fracture: {stem}_{version}{ext} (no year range)

Downstream globs (*SMB*.nc, *2dThermalForcing_*.nc) still match; no regex
changes needed. Now a version bump produces a new filename -> guard doesn't
fire -> output regenerates (fixes staleness hazard). The GrIS 3-D path now
honors overwrite and resumes partial runs correctly.

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
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.

2 participants