Skip to content

Commit

Permalink
Convert outgoing netCDF arrays to big-endian
Browse files Browse the repository at this point in the history
Changeset 76a983e removed the explicit conversion of all outgoing
datatypes into big-endian format (e.g. see page 10 of
http://earthdata.nasa.gov/sites/default/files/esdswg/spg/rfc/esds-rfc-011/ESDS-RFC-011v1.00.pdf)

This changeset converts the type to big-endian during the array
creation in createVariable by calling the dtype.newbyteorder
function with the argument "B" for Big endian.
  • Loading branch information
Christopher Lee committed Mar 15, 2013
1 parent 2619f0c commit d2b5014
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scipy/io/netcdf.py
Expand Up @@ -290,7 +290,7 @@ def createVariable(self, name, type, dimensions):
if (typecode, size) not in REVERSE:
raise ValueError("NetCDF 3 does not support type %s" % type)

data = empty(shape_, dtype=type)
data = empty(shape_, dtype=type.newbyteorder("B")) #convert to big endian always for NetCDF 3
self.variables[name] = netcdf_variable(data, typecode, size, shape, dimensions)
return self.variables[name]

Expand Down

0 comments on commit d2b5014

Please sign in to comment.