gnome.movers.c_current_movers

Movers using currents and tides as forcing functions

Module Contents

Classes

CurrentMoversBase

Base class from which all Python movers/weatherers can inherit

CatsMover

Base class from which all Python movers/weatherers can inherit

c_GridCurrentMover

Base class from which all Python movers/weatherers can inherit

IceMover

Base class from which all Python movers/weatherers can inherit

CurrentCycleMover

Base class from which all Python movers/weatherers can inherit

ComponentMover

Base class from which all Python movers/weatherers can inherit

class gnome.movers.c_current_movers.CurrentMoversBase(uncertain_duration=24, uncertain_time_delay=0, **kwargs)

Bases: gnome.movers.CyMover

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

set common properties children should define self.mover, then we can set common properties

_ref_as = 'c_current_movers'
uncertain_duration
uncertain_time_delay
get_triangles()

Invokes the GetToplogyHdl method of TimeGridVel_c object. Cross-references point data to get triangle coordinates.

get_cells()

Invokes the GetCellDataHdl method of TimeGridVel_c object. Cross-references point data to get cell coordinates.

get_triangle_center_points()

Right now the cython mover only gets the triangular center points.

get_cell_center_points()

Right now the cython mover only gets the triangular center points, so we need to calculate centers based on the cells themselves.

Cells will have the format (tl, tr, bl, br) We need to get the rectangular centers Center will be: (tl + ((br - tl) / 2.))

get_points()
get_bounds()

Right now the cython mover only gets the triangular center points.

class gnome.movers.c_current_movers.CatsMover(filename=None, tide=None, uncertain_duration=48, **kwargs)

Bases: CurrentMoversBase

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

Uses super to invoke base class __init__ method.

Parameters:

filename – file containing currents patterns for Cats

Optional parameters (kwargs). Defaults are defined by CyCatsMover object.

Parameters:
  • tide – a gnome.environment.Tide object to be attached to CatsMover

  • scale – a boolean to indicate whether to scale value at reference point or not

  • scale_value – value used for scaling at reference point

  • scale_refpoint – reference location (long, lat, z). The scaling applied to all data is determined by scaling the raw value at this location.

  • uncertain_duration – how often does a given uncertain element gets reset

  • uncertain_time_delay – when does the uncertainly kick in.

  • up_cur_uncertain – Scale for uncertainty along the flow

  • down_cur_uncertain – Scale for uncertainty along the flow

  • right_cur_uncertain – Scale for uncertainty across the flow

  • left_cur_uncertain – Scale for uncertainty across the flow

  • uncertain_eddy_diffusion – Diffusion coefficient for eddy diffusion. Default is 0.

  • uncertain_eddy_v0 – Default is .1 (Check that this is still used)

Remaining kwargs are passed onto Mover’s __init__ using super. See Mover documentation for remaining valid kwargs.

property ref_scale
property scale_refpoint
property tide
property data_start
property data_stop
_schema
filename
scale
scale_value
up_cur_uncertain
down_cur_uncertain
right_cur_uncertain
left_cur_uncertain
uncertain_eddy_diffusion
uncertain_eddy_v0
__repr__()

Return repr(self).

get_grid_data()

Invokes the GetToplogyHdl method of TriGridVel_c object

get_center_points()
get_scaled_velocities(model_time)

Get file values scaled to ref pt value, with tide applied (if any)

class gnome.movers.c_current_movers.c_GridCurrentMover(filename, topology_file=None, extrapolate=False, time_offset=0, current_scale=1, uncertain_along=0.5, uncertain_across=0.25, uncertain_cross=0.25, num_method='Euler', **kwargs)

Bases: CurrentMoversBase

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

Initialize a c_GridCurrentMover

Parameters:
  • filename – absolute or relative path to the data file: could be netcdf or filelist

  • topology_file=None – absolute or relative path to topology file. If not given, the c_GridCurrentMover will compute the topology from the data file.

  • active_range (2-tuple of datetimes) – Range of datetimes for when the mover should be active

  • current_scale – Value to scale current data

  • uncertain_duration – how often does a given uncertain element get reset

  • uncertain_time_delay – when does the uncertainly kick in.

  • uncertain_cross – Scale for uncertainty perpendicular to the flow

  • uncertain_along – Scale for uncertainty parallel to the flow

  • extrapolate – Allow current data to be extrapolated before and after file data

  • time_offset – Time zone shift if data is in GMT

  • num_method – Numerical method for calculating movement delta. Default Euler option: Runga-Kutta 4 (RK4)

uses super, super(c_GridCurrentMover,self).__init__(**kwargs)

property data_start
property data_stop
property num_method
property is_data_on_cells
_schema
uncertain_cross
uncertain_along
current_scale
extrapolate
time_offset
__repr__()

Return repr(self).

__str__()

Return str(self).

get_grid_data()

The main function for getting grid data from the mover

get_center_points()
get_scaled_velocities(time)
Parameters:

time=0 – model time in integer seconds

export_topology(topology_file)
Parameters:

topology_file=None – absolute or relative path where topology file will be written.

extrapolate_in_time(extrapolate)
Parameters:

extrapolate=false – allow current data to be extrapolated before and after file data.

offset_time(time_offset)
Parameters:

offset_time=0 – allow data to be in GMT with a time zone offset (hours).

get_offset_time()
Parameters:

offset_time=0 – allow data to be in GMT with a time zone offset (hours).

get_start_time()

:this will be the real_data_start time (seconds).

get_end_time()

:this will be the real_data_stop time (seconds).

get_num_method()
class gnome.movers.c_current_movers.IceMover(filename=None, topology_file=None, current_scale=1, uncertain_along=0.5, uncertain_cross=0.25, extrapolate=False, time_offset=0, **kwargs)

Bases: CurrentMoversBase

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

Initialize an IceMover

Parameters:
  • filename – absolute or relative path to the data file: could be netcdf or filelist

  • topology_file=None – absolute or relative path to topology file. If not given, the IceMover will compute the topology from the data file.

  • active_range (2-tuple of datetimes) – Range of datetimes for when the mover should be active

  • current_scale – Value to scale current data

  • uncertain_duration – how often does a given uncertain element get reset

  • uncertain_time_delay – when does the uncertainly kick in.

  • uncertain_cross – Scale for uncertainty perpendicular to the flow

  • uncertain_along – Scale for uncertainty parallel to the flow

  • extrapolate – Allow current data to be extrapolated before and after file data

  • time_offset – Time zone shift if data is in GMT

uses super, super(IceMover,self).__init__(**kwargs)

_schema
uncertain_cross
uncertain_along
current_scale
extrapolate
time_offset
__repr__()

Return repr(self).

__str__()

Return str(self).

get_grid_data()
get_grid_bounding_box(grid_data=None, box_to_merge=None)

Return a bounding box surrounding the grid data.

Parameters:
  • grid_data (A sequence of 3-tuples or 4-tuples containing (long, lat) pairs.) – The point data of our grid.

  • box_to_merge – A bounding box to surround in combination with our grid data. This allows us to pad the bounding box that we generate.

get_center_points()
get_scaled_velocities(model_time)
Parameters:

model_time=0 – datetime in integer seconds

get_ice_velocities(model_time)
Parameters:

model_time=0

get_movement_velocities(model_time)
Parameters:

model_time=0

get_ice_fields(model_time)
Parameters:

model_time=0

export_topology(topology_file)
Parameters:

topology_file=None – absolute or relative path where topology file will be written.

extrapolate_in_time(extrapolate)
Parameters:

extrapolate=false – allow current data to be extrapolated before and after file data.

offset_time(time_offset)
Parameters:

offset_time=0 – allow data to be in GMT with a time zone offset (hours).

get_offset_time()
Parameters:

offset_time=0 – allow data to be in GMT with a time zone offset (hours).

class gnome.movers.c_current_movers.CurrentCycleMover(filename=None, topology_file=None, tide=None, **kwargs)

Bases: c_GridCurrentMover

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

Initialize a CurrentCycleMover

Parameters:
  • filename – Absolute or relative path to the data file: could be netcdf or filelist

  • topology_file=None – Absolute or relative path to topology file. If not given, the c_GridCurrentMover will compute the topology from the data file.

  • tide – A gnome.environment.Tide object to be attached to CatsMover

  • active_range (2-tuple of datetimes) – Range of datetimes for when the mover should be active

  • current_scale – Value to scale current data

  • uncertain_duration – How often does a given uncertain element get reset

  • uncertain_time_delay – when does the uncertainly kick in.

  • uncertain_cross – Scale for uncertainty perpendicular to the flow

  • uncertain_along – Scale for uncertainty parallel to the flow

  • extrapolate – Allow current data to be extrapolated before and after file data

  • time_offset – Time zone shift if data is in GMT

uses super: super(CurrentCycleMover,self).__init__(**kwargs)

property tide
property data_start
property data_stop
property is_data_on_cells
_schema
_ref_as = 'current_cycle_mover'
_req_refs
__repr__()

Return repr(self).

__str__()

Return str(self).

get_center_points()
get_scaled_velocities(time)
Parameters:

time=0 – datetime in integer seconds

class gnome.movers.c_current_movers.ComponentMover(filename1=None, filename2=None, wind=None, scale_refpoint=None, pat1_angle=0, pat1_speed=10, pat1_speed_units=2, pat1_scale_to_value=0.1, pat2_angle=90, pat2_scale_to_value=0.1, pat2_speed=10, pat2_speed_units=2, scale_by=0, **kwargs)

Bases: CurrentMoversBase

Base class from which all Python movers/weatherers can inherit

It defines the base functionality for mover/weatherer.

NOTE: Since base class is not Serializable, it does not need

a class level _schema attribute.

Uses super to invoke base class __init__ method.

Parameters:

filename – file containing currents for first Cats pattern

Optional parameters (kwargs). Defaults are defined by CyCatsMover object.

Parameters:
  • filename – file containing currents for second Cats pattern

  • wind – A gnome.environment.Wind object to be used to drive the CatsMovers. Will want a warning that mover will not be active without a wind

  • scale – A boolean to indicate whether to scale value at reference point or not

  • scale_value – Value used for scaling at reference point

  • scale_refpoint – Reference location (long, lat, z). The scaling applied to all data is determined by scaling the raw value at this location.

Remaining kwargs are passed onto Mover’s __init__ using super. See Mover documentation for remaining valid kwargs.

property data_start
property data_stop
property scale_refpoint
property wind
_schema
_ref_as = 'component_mover'
_req_refs
pat1_angle
pat1_speed
pat1_speed_units
pat1_scale_to_value
pat2_angle
pat2_speed
pat2_speed_units
pat2_scale_to_value
scale_by
extrapolate
use_averaged_winds
wind_power_factor
past_hours_to_average
scale_factor_averaged_winds
use_original_scale_factor
__repr__()

unambiguous representation of object

get_grid_data()

Invokes the GetToplogyHdl method of TriGridVel_c object

get_center_points()
get_optimize_values(model_time)
get_scaled_velocities(model_time)

Get file values scaled to optimized check if pat2 exists