Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Eva Schiffer
UW-Glance
Commits
98ff730b
Commit
98ff730b
authored
Feb 28, 2022
by
Eva Schiffer
Browse files
don't choke when loading netcdf string variables
parent
0df97f13
Changes
1
Hide whitespace changes
Inline
Side-by-side
pyglance/glance/io.py
View file @
98ff730b
...
...
@@ -300,6 +300,12 @@ class nc (object):
# get our data, save the dtype, and make sure it's a more flexible dtype for now
variable_object
.
set_auto_maskandscale
(
False
)
# for now just do the darn calculations ourselves
temp_input_data
=
variable_object
[:]
# if we have a string, just stop now because Glance can't handle strings usefully
if
isinstance
(
temp_input_data
,
str
,)
:
LOG
.
warning
(
"Variable '"
+
name
+
"' has a data type of 'string'. This type of data cannot be "
"analyzed by Glance. This variable will not be analyzed."
)
raise
IONonnumericalTypeError
(
"Variable '"
+
name
+
"' is of data type 'string'. "
"This program can't analyze non-numerical data."
)
LOG
.
debug
(
"Native input dtype: "
+
str
(
temp_input_data
.
dtype
))
# if this is object data, stop because we can't run our regular analysis on that kind
if
temp_input_data
.
dtype
==
object
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment