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

Update cdms2 to deal with all common datatypes (uint8, uint16, char, str etc) #63

Closed
chaosphere2112 opened this issue Nov 22, 2016 · 1 comment
Assignees
Labels
Milestone

Comments

@chaosphere2112
Copy link
Contributor

chaosphere2112 commented Nov 22, 2016

It appears that UV-CDAT 2.0 beta doesn't play nicely with the unsigned integer data types, and it would appear this is a hangover from numeric data types a long time ago:

Taking a look in https://github.com/UV-CDAT/cdms/blob/master/Lib/cdmsNode.py#L23-65 do not include these unsigned types:

# Data types

CdChar = CDML.CdChar
CdByte = CDML.CdByte
CdShort = CDML.CdShort
CdInt = CDML.CdInt
CdLong = CDML.CdLong
CdInt64 = CDML.CdInt64
CdFloat = CDML.CdFloat
CdDouble = CDML.CdDouble
CdString = CDML.CdString
CdFromObject = CDML.CdFromObject
CdAny = CDML.CdAny
CdDatatypes = [CdChar,CdByte,CdShort,CdInt,CdLong,CdInt64,CdFloat,CdDouble,CdString]

CdScalar = CDML.CdScalar
CdArray = CDML.CdArray

NumericToCdType = {numpy.sctype2char(numpy.float32):CdFloat,
                   numpy.sctype2char(numpy.float):CdDouble,
                   numpy.sctype2char(numpy.int16):CdShort,
                   numpy.sctype2char(numpy.int32):CdInt,
                   numpy.sctype2char(numpy.int):CdLong,
                   numpy.sctype2char(numpy.int64):CdInt64,
                   numpy.sctype2char(numpy.intc):CdLong,
                   numpy.sctype2char(numpy.int8):CdByte,
                   'c':CdChar,
                   'B':'B',
                   'H':'H',
                   'L':'L',
                   'q':CdInt64,
                   'Q':'Q',
                   'S':'S'
                   }

CdToNumericType = {CdChar:'c',
                   CdByte:numpy.int8,
                   CdShort:numpy.int16,
                   CdInt:numpy.int32,
                   CdLong:numpy.int,
                   CdInt64:numpy.int64,
                   CdFloat:numpy.float32,
                   CdDouble:numpy.float}

It would be great to include these, as netcdf 4 also includes these types as NC_ubyte (uint8; unsigned byte), NC_ushort (uint16; unsigned short), NC_uint (uint32; unsigned int), NC_uint64 (uint64; unsigned long long)

Migrated from: CDAT/cdat#537

@dnadeau4
Copy link
Contributor

Implemented in 2.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants