Skip to content

landice/ismip6_forcing/atmosphere fails with an overflow error #919

@trhille

Description

@trhille

The landice/ismip6_forcing/atmosphere fails with an overflow error (full traceback at the end of this), with the relevant lines being:

  File "/global/cfs/cdirs/m4288/users/trhille/compass/compass/landice/tests/ismip6_forcing/atmosphere/process_smb.py", line 154, in run
    write_netcdf(input_file_combined, combined_file_temp)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

and

OverflowError: Python integer 5670752832 out of bounds for int32

The only int32 variable in the dataset being written is year. I tested with input_file_combined.drop_vars(['year']) before the call to write_netcdf and it failed with the same error, so apparently that is not the issue. So, it is unclear what variable is causing the error.

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.py", line 154, in run
    write_netcdf(input_file_combined, combined_file_temp)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/mpas_tools/io.py", line 156, in write_netcdf
    ds.to_netcdf(
    ~~~~~~~~~~~~^
        out_filename, encoding=encodingDict, format=format, engine=engine
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/xarray/core/dataset.py", line 2109, in to_netcdf
    return to_netcdf(  # type: ignore[return-value]  # mypy cannot resolve the overloads:(
        self,
    ...<10 lines>...
        auto_complex=auto_complex,
    )
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/xarray/backends/api.py", line 2100, in to_netcdf
    store.close()
    ~~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/xarray/backends/scipy_.py", line 298, in close
    self._manager.close()
    ~~~~~~~~~~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/xarray/backends/file_manager.py", line 234, in close
    file.close()
    ~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 298, in close
    self.flush()
    ~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 411, in flush
    self._write()
    ~~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 423, in _write
    self._write_var_array()
    ~~~~~~~~~~~~~~~~~~~~~^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 471, in _write_var_array
    self._write_var_metadata(name)
    ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 510, in _write_var_metadata
    self._pack_int(vsize)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/global/cfs/cdirs/fanssie/users/trhille/miniforge3/envs/dev_compass_1.8.0-alpha.2/lib/python3.13/site-packages/scipy/io/_netcdf.py", line 785, in _pack_int
    self.fp.write(array(value, '>i').tobytes())
                  ~~~~~^^^^^^^^^^^^^
OverflowError: Python integer 5670752832 out of bounds for int32

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions