Skip to content

Conversation

@trhille
Copy link
Collaborator

@trhille trhille commented Aug 21, 2025

Fix bug introduced by commit e51fcd1 that switched the variable names ds and ds_out in several places.

Checklist

  • Document (in a comment titled Testing in this PR) any testing that was used to verify the changes

Fix bug introduced by commit e51fcd1 that switched the variable
names `ds` and `ds_out` in several places.
@trhille
Copy link
Collaborator Author

trhille commented Aug 21, 2025

Testing

Without these changes, the landice/ismip6_forcing/atmosphere test case errors out immediately:

Calling the remapping function...
Creating a mapping file. Mapping method used: bilinear
Mapping file does not exist. Building one based on the input/output meshes
Creating temporary scrip files for source and destination grids...
      Failed
Exception raised while running the steps of the test case
Traceback (most recent call last):
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/run/serial.py", line 322, in _log_and_run_test
    _run_test(test_case, available_resources)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/run/serial.py", line 419, in _run_test
    _run_step(test_case, step, test_case.new_step_log_file,
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              available_resources)
              ^^^^^^^^^^^^^^^^^^^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/run/serial.py", line 470, in _run_step
    step.run()
    ~~~~~~~~^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/atmosphere/process_smb_racmo.py", line 113, in run
    self.remap_source_smb_to_mali(racmo_file_temp1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
                                  remapped_file_temp,
                                  ^^^^^^^^^^^^^^^^^^^
                                  mali_mesh_name,
                                  ^^^^^^^^^^^^^^^
                                  mali_mesh_file,
                                  ^^^^^^^^^^^^^^^
                                  method_remap)
                                  ^^^^^^^^^^^^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/atmosphere/process_smb_racmo.py", line 190, in remap_source_smb_to_mali
    build_mapping_file(self.config, self.ntasks, self.logger,
    ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       input_file, mapping_file,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
                       scrip_from_latlon=True,
                       ^^^^^^^^^^^^^^^^^^^^^^^
                       mali_mesh_file=mali_mesh_file,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       method_remap=method_remap)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/create_mapfile.py", line 71, in build_mapping_file
    create_scrip_from_latlon(ismip6_grid_file, source_grid_scripfile)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/create_mapfile.py", line 166, in create_scrip_from_latlon
    np.ones(ds.sizes["grid_size"], dtype="int32"), dims=("grid_size",)
            ~~~~~~~~^^^^^^^^^^^^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/xarray/core/utils.py", line 466, in __getitem__
    return self.mapping[key]
           ~~~~~~~~~~~~^^^^^
KeyError: 'grid_size'

The other ismip6_forcing test cases passed, since they do not call create_scrip_from_latlon().

After this fix, the process_smb_racmo step no longer crashes. However, the process_smb step crashes after a few minutes (when using 8km input data) with this error:

  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/atmosphere/process_smb.py", line 153, in run
    write_netcdf(input_file_combined, combined_file_temp)
<lots of other traceback pointing to xarray and scipy libraries, ending with>
OverflowError: Python integer 22653214272 out of bounds for int32

Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

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

@trhille, sorry about that! Looks right to me now.

@xylar
Copy link
Collaborator

xylar commented Aug 21, 2025

The process_smb error looks like a problem -- a bad value that's bigger than the maximum allowed integer -- and seemingly not related to this PR.

@trhille
Copy link
Collaborator Author

trhille commented Aug 21, 2025

The process_smb error looks like a problem -- a bad value that's bigger than the maximum allowed integer -- and seemingly not related to this PR.

Yes, I'm working on tracking that down now, but I agree that it's not related to the bug in build_mapping_file().

@matthewhoffman matthewhoffman merged commit fbc7ea6 into MPAS-Dev:main Aug 21, 2025
6 checks passed
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.

3 participants