def from_netCDF( cls, filename=None, extrapolate=False, time_offset=0, current_scale=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=0.5, uncertain_across=0.25, uncertain_cross=0.25, default_num_method="Trapezoid", **kwargs ): wind = GridWind.from_netCDF(filename, **kwargs) return cls( wind=wind, filename=filename, extrapolate=extrapolate, time_offset=time_offset, current_scale=current_scale, uncertain_along=uncertain_along, uncertain_across=uncertain_across, uncertain_cross=uncertain_cross, default_num_method=default_num_method, )
def from_netCDF(cls, filename=None, time_offset=0, wind_scale=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=.5, uncertain_across=.25, uncertain_cross=.25, default_num_method='RK2', **kwargs): wind = GridWind.from_netCDF(filename, **kwargs) return cls(wind=wind, filename=filename, time_offset=time_offset, wind_scale=wind_scale, uncertain_along=uncertain_along, uncertain_across=uncertain_across, uncertain_cross=uncertain_cross, default_num_method=default_num_method)
def from_netCDF(cls, filename=None, time_offset=0, scale_value=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=.5, uncertain_across=.25, uncertain_cross=.25, default_num_method='RK2', **kwargs): wind = GridWind.from_netCDF(filename, **kwargs) return cls(wind=wind, filename=filename, time_offset=time_offset, scale_value=scale_value, uncertain_along=uncertain_along, uncertain_across=uncertain_across, uncertain_cross=uncertain_cross, default_num_method=default_num_method)
def from_netCDF(cls, filename=None, extrapolate=False, time_offset=0, current_scale=1, uncertain_duration=24 * 3600, uncertain_time_delay=0, uncertain_along=.5, uncertain_across=.25, uncertain_cross=.25, default_num_method='Trapezoid', **kwargs): wind = GridWind.from_netCDF(filename, **kwargs) return cls(wind=wind, filename=filename, extrapolate=extrapolate, time_offset=time_offset, current_scale=current_scale, uncertain_along=uncertain_along, uncertain_across=uncertain_across, uncertain_cross=uncertain_cross, default_num_method=default_num_method)
def __init__(self, filename=None, wind=None, time_offset=0, uncertain_duration=3, uncertain_time_delay=0, uncertain_speed_scale=2., uncertain_angle_scale=0.4, wind_scale=1, default_num_method='RK2', extrapolation_is_allowed=False, **kwargs): """ Initialize a PyWindMover :param filename: absolute or relative path to the data file(s): could be a string or list of strings in the case of a multi-file dataset :param wind: Environment object representing wind to be used. If this is not specified, a GridWind object will attempt to be instantiated from the file :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param wind_scale: Value to scale wind data :param uncertain_duration: how often does a given uncertain element get reset :param uncertain_time_delay: when does the uncertainly kick in. :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param time_offset: Time zone shift if data is in GMT :param num_method: Numerical method for calculating movement delta. Choices:('Euler', 'RK2', 'RK4') Default: RK2 """ self.wind = wind self.make_default_refs = False self.filename = filename if self.wind is None: if filename is None: raise ValueError("must provide a filename or wind object") else: self.wind = GridWind.from_netCDF(filename=self.filename, **kwargs) self.extrapolation_is_allowed = extrapolation_is_allowed self.uncertain_duration = uncertain_duration self.uncertain_time_delay = uncertain_time_delay self.uncertain_speed_scale = uncertain_speed_scale self.wind_scale = wind_scale self.time_offset = time_offset # also sets self._uncertain_angle_units self.uncertain_angle_scale = uncertain_angle_scale (super(PyWindMover, self) .__init__(default_num_method=default_num_method, **kwargs)) self.array_types.update({'windages', 'windage_range', 'windage_persist'})
def __init__(self, filename=None, wind=None, time_offset=0, uncertain_duration=3, uncertain_time_delay=0, uncertain_speed_scale=2., uncertain_angle_scale=0.4, scale_value=1, default_num_method='RK2', **kwargs): """ Initialize a PyWindMover :param filename: absolute or relative path to the data file(s): could be a string or list of strings in the case of a multi-file dataset :param wind: Environment object representing wind to be used. If this is not specified, a GridWind object will attempt to be instantiated from the file :param active_range: Range of datetimes for when the mover should be active :type active_range: 2-tuple of datetimes :param scale_value: Value to scale wind data :param uncertain_duration: how often does a given uncertain element get reset :param uncertain_time_delay: when does the uncertainly kick in. :param uncertain_cross: Scale for uncertainty perpendicular to the flow :param uncertain_along: Scale for uncertainty parallel to the flow :param time_offset: Time zone shift if data is in GMT :param num_method: Numerical method for calculating movement delta. Choices:('Euler', 'RK2', 'RK4') Default: RK2 """ (super(PyWindMover, self).__init__(default_num_method=default_num_method, **kwargs)) self.wind = wind self.make_default_refs = False self.filename = filename if self.wind is None: if filename is None: raise ValueError("must provide a filename or wind object") else: self.wind = GridWind.from_netCDF(filename=self.filename, **kwargs) self.uncertain_duration = uncertain_duration self.uncertain_time_delay = uncertain_time_delay self.uncertain_speed_scale = uncertain_speed_scale self.scale_value = scale_value self.time_offset = time_offset # also sets self._uncertain_angle_units self.uncertain_angle_scale = uncertain_angle_scale self.array_types.update({ 'windages': gat('windages'), 'windage_range': gat('windage_range'), 'windage_persist': gat('windage_persist') })
# dataset=ds_c, grid_topology={ 'node_lon': 'lonc', 'node_lat': 'latc' }) c_mover = PyCurrentMover(current=g_curr, default_num_method='RK4') model.movers += c_mover print 'creating wind MFDataset' ds_w = nc4.MFDataset(file_list_w) print 'adding a WindMover (Euler):' g_wind = GridWind.from_netCDF( filename=file_list_w, # dataset=ds_w, grid_topology={ 'node_lon': 'lonc', 'node_lat': 'latc' }) w_mover = PyWindMover(wind=g_wind, default_num_method='Euler') model.movers += w_mover model.environment += g_wind water = Water(temperature=290.0, salinity=33.0) waves = Waves(g_wind) model.weatherers += Evaporation(water=water, wind=g_wind) model.weatherers += NaturalDispersion(waves=waves) # print 'adding a CurrentMover (Trapeziod/RK4):' # c_mover = GridCurrentMover(os.path.join(setup.Data_Dir,setup.CurrCatFile), # os.path.join(setup.Data_Dir,setup.CurrTopoFile),