Skip to content

Commit

Permalink
Fixed the last two py3 Cython issues -- and fixed a few warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisBarker-NOAA committed Jun 14, 2021
1 parent fd64d48 commit 1bfdd69
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 38 deletions.
7 changes: 6 additions & 1 deletion py_gnome/gnome/cy_gnome/cy_grid_map.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import os
from .type_defs cimport *
from .grids cimport GridMap_c
from gnome.cy_gnome.cy_helpers cimport to_bytes
from gnome.cy_gnome.cy_helpers import filename_as_bytes

#cimport cy_mover

cdef class CyGridMap:
Expand Down Expand Up @@ -60,7 +62,10 @@ cdef class CyGridMap:
"""
cdef OSErr err
err = self.map.SaveAsNetCDF(netcdf_file)

cdef bytes netcdf_file_bytes = filename_as_bytes(netcdf_file)

err = self.map.SaveAsNetCDF(netcdf_file_bytes)
if err != 0:
"""
For now just raise an OSError - until the types of possible errors are defined and enumerated
Expand Down
8 changes: 2 additions & 6 deletions py_gnome/gnome/movers/current_movers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Movers using currents and tides as forcing functions
'''





import os

import numpy as np
Expand Down Expand Up @@ -484,7 +480,7 @@ def __init__(self, filename,
Default Euler
option: Runga-Kutta 4 (RK4)
uses super, super(GridCurrentMover,self).__init__(\*\*kwargs)
uses super, ``super(GridCurrentMover,self).__init__(**kwargs)``
"""
# if child is calling, the self.mover is set by child - do not reset
if type(self) == GridCurrentMover:
Expand Down Expand Up @@ -742,7 +738,7 @@ def __init__(self,
before and after file data
:param time_offset: Time zone shift if data is in GMT
uses super, super(IceMover,self).__init__(\*\*kwargs)
uses super, ``super(IceMover,self).__init__(**kwargs)``
"""

# NOTE: will need to add uncertainty parameters and other dialog fields
Expand Down
6 changes: 1 addition & 5 deletions py_gnome/gnome/movers/movers.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@





from datetime import datetime, timedelta

import numpy as np
Expand Down Expand Up @@ -289,7 +285,7 @@ class CyMover(Mover):
def __init__(self, **kwargs):
"""
Base class for python wrappers around cython movers.
Uses super(CyMover,self).__init__(\*\*kwargs) to call Mover class
Uses ``super(CyMover, self).__init__(**kwargs)`` to call Mover class
__init__ method
All cython movers (CyWindMover, CyRandomMover) are instantiated by a
Expand Down
6 changes: 1 addition & 5 deletions py_gnome/gnome/movers/ship_drift_mover.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Ship drift mover
'''





import os

import numpy as np
Expand Down Expand Up @@ -57,7 +53,7 @@ def __init__(self,
:param time_offset: Time zone shift if data is in GMT
Pass optional arguments to base class
uses super: super(ShipDriftMover,self).__init__(\*\*kwargs)
uses super: ``super(ShipDriftMover,self).__init__(**kwargs)``
"""
if not os.path.exists(wind_file):
raise ValueError('Path for wind file does not exist: {0}'
Expand Down
8 changes: 2 additions & 6 deletions py_gnome/gnome/movers/wind_movers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
Movers using wind as the forcing function
'''





import os

import numpy as np
Expand Down Expand Up @@ -352,7 +348,7 @@ def __init__(self, filename=None, topology_file=None,
:param time_offset: Time zone shift if data is in GMT
Pass optional arguments to base class
uses super: super(GridWindMover,self).__init__(\*\*kwargs)
uses super: ``super(GridWindMover,self).__init__(**kwargs)``
"""
if not os.path.exists(filename):
raise ValueError('Path for wind file does not exist: {0}'
Expand Down Expand Up @@ -531,7 +527,7 @@ def __init__(self,
before and after file data
:param time_offset: Time zone shift if data is in GMT
uses super, super(IceWindMover,self).__init__(\*\*kwargs)
uses super, ``super(IceWindMover,self).__init__(**kwargs)``
"""

# NOTE: will need to add uncertainty parameters and other dialog fields
Expand Down
6 changes: 1 addition & 5 deletions py_gnome/gnome/outputters/geo_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
Does not contain a schema for persistence yet
'''





import os
from collections.abc import Iterable
from glob import glob
Expand Down Expand Up @@ -280,7 +276,7 @@ def __init__(self, ice_movers, **kwargs):
:type ice_movers: An ice_mover object or sequence of ice_mover
objects.
Use super to pass optional \*\*kwargs to base class __init__ method
Use super to pass optional ``**kwargs`` to base class __init__ method
'''
if (isinstance(ice_movers, Iterable) and
not isinstance(ice_movers, str)):
Expand Down
5 changes: 1 addition & 4 deletions py_gnome/gnome/outputters/kmz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
kmz outputter
"""




import copy
import os
from datetime import timedelta, datetime
Expand Down Expand Up @@ -47,7 +44,7 @@ def __init__(self, filename, **kwargs):
'''
:param str output_dir=None: output directory for kmz files.
uses super to pass optional \*\*kwargs to base class __init__ method
uses super to pass optional ``**kwargs`` to base class ``__init__`` method
'''
# a little check:
self._check_filename(filename)
Expand Down
12 changes: 6 additions & 6 deletions py_gnome/gnome/persist/save_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,10 @@ def loads(cls, json_data, saveloc=None, references=None):
'''
loads object from json_data
* load json for references from files
* update paths of datafiles if needed
* deserialize json_data
* and create object with new_from_dict()
- load json for references from files
- update paths of datafiles if needed
- deserialize json_data
- and create object with new_from_dict()
json_data: dict containing json data. It has been parsed through the
json.loads() command. The json will be valided here when it gets
Expand All @@ -442,9 +442,9 @@ def loads(cls, json_data, saveloc=None, references=None):
Optional parameter
:param saveloc: location of data files or \*.json files for objects
:param saveloc: location of data files or .json files for objects
stored as references. If object requires no datafiles and does not
need to read references from a \*.json file in saveloc, then this
need to read references from a .json file in saveloc, then this
can be None.
:param references: references object - if this is called by the Model,
it will pass a references object. It is not required.
Expand Down

0 comments on commit 1bfdd69

Please sign in to comment.