Skip to content

remove _check_safecast #59

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

Merged
merged 1 commit into from
Sep 11, 2024
Merged
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
19 changes: 0 additions & 19 deletions src/pnetcdf/_Variable.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -698,25 +698,6 @@ cdef class Variable:
dataput=np.array(dataput,dataput.dtype)
self._put(dataput,a,b,c)

def _check_safecast(self, attname):
# check to see that variable attribute exists
# and can be safely cast to variable data type.
msg="""WARNING: %s not used since it
cannot be safely cast to variable data type""" % attname
if hasattr(self, attname):
att = np.array(self.get_att(attname))
else:
return False
try:
atta = np.array(att, self.dtype)
except ValueError:
is_safe = False
warnings.warn(msg)
return is_safe
is_safe = _safecast(att,atta)
if not is_safe:
warnings.warn(msg)
return is_safe

def _put_var1(self, value, tuple index, bufcount, Datatype buftype, collective = True):
cdef int ierr, ndims
Expand Down
Loading