Skip to content

Coordinate reset to int32 should only be performed if netCDF3 output format is selected (or any format that doesn't support int64) #188

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

Open
2 tasks
atteggiani opened this issue Feb 11, 2025 · 0 comments

Comments

@atteggiani
Copy link
Collaborator

Overview

In the current implementation, within the process_cubes function, there is the following line that resets the coordinates to int32 in case they are int64:

# Check whether any of the coordinates is a pseudo-dimension with integer values and
# if so, reset to int32 to prevent problems with possible later conversion to netCDF3
for coord in c.coords():
if coord.points.dtype == np.int64:
coord.points = coord.points.astype(np.int32)

I think there are a few issues with this portion:

  • The portion could be turn to a function to better explain its intent and be easily tested
  • This portion might not be needed if the output netCDF supports int64 coordinates

Solution

  • Turn the portion of code to a function (convert_coordinates_to_32_bit)
  • Embed the whole code within an if condition that checks if the netcdf output format specified is not compatible with int64
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

No branches or pull requests

1 participant