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

Open
@atteggiani

Description

@atteggiani

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

Metadata

Metadata

Assignees

No one assigned

    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