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

Np dtype #36

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions ibmpairs/paw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,7 +1693,7 @@ def set_timestamp_column(self, timeName):
if self._isOnlineQuery:
try:
if self.vdf is not None and isinstance(self.vdf, pandas.DataFrame) \
and self.vdf[timeName].dtype in (numpy.float, numpy.int):
and self.vdf[timeName].dtype in (numpy.float64, numpy.int64):
self.vdf[timeName] = self.vdf[timeName].apply(
lambda t: t if numpy.isnan(t) else datetime.datetime.fromtimestamp(
t/1e3, tz=pytz.UTC
Expand All @@ -1720,7 +1720,7 @@ def set_timestamp_column(self, timeName):
# convert timestamp column
try:
if self.vdf is not None and isinstance(self.vdf, pandas.DataFrame) \
and self.vdf[timeName].dtype in (numpy.float, numpy.int):
and self.vdf[timeName].dtype in (numpy.float64, numpy.int64):
self.vdf[timeName] = self.vdf[timeName].apply(
lambda t: datetime.datetime.fromtimestamp(t, tz=pytz.UTC)
)
Expand Down Expand Up @@ -2123,7 +2123,7 @@ def create_layer(self, fileName, layerMeta, defaultExtension=u''):
tempFilePath = tf.name
# directly read from data path
ds = gdal.Open(tf.name)
a = numpy.array(ds.GetRasterBand(1).ReadAsArray(), dtype=numpy.float)
a = numpy.array(ds.GetRasterBand(1).ReadAsArray(), dtype=numpy.float64)
ds = None
# try to expliticly remove the temporary file used to load the data
if tempFilePath is not None:
Expand Down Expand Up @@ -2167,7 +2167,7 @@ def create_layer(self, fileName, layerMeta, defaultExtension=u''):
"No pixel data type identified from query meta data, default to 4 bytes floating point numbers."
)
im.mode=u'F'
a = numpy.array(im).astype(numpy.float)
a = numpy.array(im).astype(numpy.float64)
# try to expliticly remove the temporary file used to load the data
if tempFilePath is not None:
try:
Expand All @@ -2182,12 +2182,12 @@ def create_layer(self, fileName, layerMeta, defaultExtension=u''):
self._closeDataSource()
# mask no-data value
if 'details' in layerMeta and 'pixelNoDataVal' in layerMeta['details']:
a[a==numpy.float(layerMeta['details']['pixelNoDataVal'])] = numpy.nan
a[a==numpy.float64(layerMeta['details']['pixelNoDataVal'])] = numpy.nan
else:
logger.warning(
"Unable to identify pixel no-data value, using default '{}'.".format(PAIRS_DEFAULT_NODATA_VALUE)
)
a[a==numpy.float(PAIRS_DEFAULT_NODATA_VALUE)] = numpy.nan
a[a==numpy.float64(PAIRS_DEFAULT_NODATA_VALUE)] = numpy.nan
# assign loaded data to object's data dictionary
self.data[fileName] = a
# load vector data (note: CSV file format assumed)
Expand Down