Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FatesPFTIndexSwapper IndexError #1242

Open
glemieux opened this issue Aug 26, 2024 · 3 comments
Open

FatesPFTIndexSwapper IndexError #1242

glemieux opened this issue Aug 26, 2024 · 3 comments
Labels
type: tools This PR adds or updates support tools. No regression testing necessary.

Comments

@glemieux
Copy link
Contributor

glemieux commented Aug 26, 2024

Attempting to run the tool from the elm-fates container is generating a python error code:

Creating Variable:  fates_canopy_closure_thresh
Traceback (most recent call last):
  File "/E3SM/components/elm/src/external_models/fates/tools/./FatesPFTIndexSwapper.py", line 296, in <module>
    main(sys.argv)
  File "/E3SM/components/elm/src/external_models/fates/tools/./FatesPFTIndexSwapper.py", line 207, in main
    out_var.assignValue(float(fp_in.variables.get(key).data))
  File "/usr/local/lib/python3.9/dist-packages/scipy/io/_netcdf.py", line 943, in assignValue
    self.data[:] = value
IndexError: too many indices for array: array is 0-dimensional, but 1 were indexed
sys:1: RuntimeWarning: Cannot close a netcdf_file opened with mmap=True, when netcdf_variables or arrays referring to its data still exist. All data arrays obtained from such files refer directly to data on disk, and must be copied before the file can be cleanly closed. (See netcdf_file docstring for more information on mmap.)

I suspect this is likely an issue with python dependency versioning. The dockerfile simply runs pip install on the necessary dependencies per this line: https://github.com/NGEET/tutorial-containers/blob/18f32cecfb07f1772245a86fc172aea53a239459/docker/baseos/gcc1120/Dockerfile#L170

@glemieux glemieux changed the title FatesPFTIndexSwapper Indexing Error FatesPFTIndexSwapper IndexError Aug 26, 2024
@glemieux glemieux transferred this issue from NGEET/fates-tutorial Aug 28, 2024
@glemieux glemieux added the type: tools This PR adds or updates support tools. No regression testing necessary. label Aug 28, 2024
@glemieux
Copy link
Contributor Author

glemieux commented Aug 28, 2024

I was able to replicate this issue via a new conda environment with the following versions:

  • python: 3.9.3
  • netCDF4: 1.7.1 (using library 4.9.2)
  • numpy: 2.0.2
  • scipy: 1.13.1

Testing this with an older conda environement I have results in the tool successfully completing:

  • python: 3.7.3
  • netCDF4: 1.5.1.2 (using library 4.6.2)
  • numpy: 1.12.6
  • scipy: 1.5.3

@glemieux
Copy link
Contributor Author

@ckoven noted this is probably due to the switch to numpy 2.0, which apparently introduced breaking changes.

@glemieux
Copy link
Contributor Author

glemieux commented Aug 28, 2024

This appears to be an issue with scipy. The maximum version that appears to work is 1.11.4. To discover this, I built minimum conda environments only installing scipy at a specific version and incrementing the version for each build. The numpy version conda solved for is 1.26.4. Note that this version was also solved for with the next newer version of scipy that failed.

glemieux added a commit to NGEET/tutorial-containers that referenced this issue Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: tools This PR adds or updates support tools. No regression testing necessary.
Projects
Status: ❕Todo
Development

No branches or pull requests

5 participants
@glemieux and others