Example #1
0
def test_exceptions():
    """
    Test correct exceptions are raised
    """
    with pytest.raises(ValueError):
        'bad file'
        ComponentMover(os.path.join('./', 'NW30ktwinds.CURX'))

    with pytest.raises(TypeError):
        ComponentMover(curr1_file, wind=10)
def test_serialize_deserialize(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    c_component = ComponentMover(curr1_file, wind=wind)
    serial = c_component.serialize()
    deser = ComponentMover.deserialize(serial)

    assert deser == c_component
def test_serialize_deserialize(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    c_component = ComponentMover(curr1_file, wind=wind)
    serial = c_component.serialize()
    deser =  ComponentMover.deserialize(serial)

    assert deser == c_component
def test_save_load(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    saveloc = tempfile.mkdtemp()
    c_component = ComponentMover(curr1_file, wind=wind)
    json_, saveloc, refs = c_component.save(saveloc)
    loaded = ComponentMover.load(saveloc)

    assert loaded == c_component
def test_save_load(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    saveloc = tempfile.mkdtemp()
    c_component = ComponentMover(curr1_file, wind=wind)
    json_, saveloc, refs = c_component.save(saveloc)
    loaded =  ComponentMover.load(saveloc)

    assert loaded == c_component
def test_uncertain_loop():
    """
    test one time step with uncertainty on the spill
    checks there is non-zero motion.
    """

    pSpill = sample_sc_release(num_le, start_pos, rel_time, uncertain=True)
    component = ComponentMover(curr1_file, curr2_file, wind=wnd)
    component.scale_refpoint = (-75.262319, 39.142987, 0)
    u_delta = _uncertain_loop(pSpill, component)

    _assert_move(u_delta)

    return u_delta
def test_uncertain_loop():
    """
    test one time step with uncertainty on the spill
    checks there is non-zero motion.
    """

    pSpill = sample_sc_release(num_le, start_pos, rel_time,
                               uncertain=True)
    component = ComponentMover(curr1_file, curr2_file, wind=wnd)
    component.scale_refpoint = (-75.262319, 39.142987, 0)
    u_delta = _uncertain_loop(pSpill, component)

    _assert_move(u_delta)

    return u_delta
def test_serialize_deserialize(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    c_component = ComponentMover(curr1_file, wind=wind)
    serial = c_component.serialize('webapi')
    dict_ = c_component.deserialize(serial)
    if wind:
        #assert serial['wind'] == wnd.serialize(json_)
        assert 'wind' in serial
        dict_['wind'] = wnd  # no longer updating properties of nested objects
        assert c_component.wind is wnd
    else:
        c_component.update_from_dict(dict_)
def test_loop():
    """
    test one time step with no uncertainty on the spill
    checks there is non-zero motion.
    also checks the motion is same for all LEs
    """

    pSpill = sample_sc_release(num_le, start_pos, rel_time)
    component = ComponentMover(curr1_file, curr2_file, wind=wnd, ref_point = (-75.262319, 39.142987))
    component.ref_point = (-75.262319, 39.142987)
    delta = _certain_loop(pSpill, component)

    _assert_move(delta)

    assert np.all(delta[:, 0] == delta[0, 0])  # lat move matches for all LEs
    assert np.all(delta[:, 1] == delta[0, 1])  # long move matches for all LEs
    assert np.all(delta[:, 2] == 0)  # 'z' is zeros

    return delta
Example #10
0
def test_serialize_deserialize(wind):
    """
    test to_dict function for Component mover with wind object
    create a new Component mover and make sure it has same properties
    """

    c_component = ComponentMover(curr1_file, wind=wind)
    serial = c_component.serialize('webapi')
    dict_ = c_component.deserialize(serial)
    if wind:
        #assert serial['wind'] == wnd.serialize(json_)
        assert 'wind' in serial
        dict_['wind'] = wnd  # no longer updating properties of nested objects
        assert c_component.wind is wnd
    else:
        c_component.update_from_dict(dict_)
def test_loop():
    """
    test one time step with no uncertainty on the spill
    checks there is non-zero motion.
    also checks the motion is same for all LEs
    """

    pSpill = sample_sc_release(num_le, start_pos, rel_time)
    component = ComponentMover(curr1_file,
                               curr2_file,
                               wind=wnd,
                               scale_refpoint=(-75.262319, 39.142987, 0))
    print component.scale_refpoint
    delta = _certain_loop(pSpill, component)

    _assert_move(delta)

    assert np.all(delta[:, 0] == delta[0, 0])  # lat move matches for all LEs
    assert np.all(delta[:, 1] == delta[0, 1])  # long move matches for all LEs
    assert np.all(delta[:, 2] == 0)  # 'z' is zeros

    return delta
def make_model(images_dir=os.path.join(base_dir, 'images')):

    # create the maps:

    print 'creating the maps'
    mapfile = get_datafile(os.path.join(base_dir, './DelawareRiverMap.bna'))
    gnome_map = MapFromBNA(mapfile, refloat_halflife=1)  # hours

    renderer = Renderer(mapfile, images_dir, size=(800, 800),
                        projection_class=GeoProjection)

    print 'initializing the model'
    start_time = datetime(2012, 8, 20, 13, 0)

    # 15 minutes in seconds
    # Default to now, rounded to the nearest hour
    model = Model(time_step=900, start_time=start_time,
                  duration=timedelta(days=1),
                  map=gnome_map, uncertain=False)

    print 'adding outputters'
    model.outputters += renderer

    netcdf_file = os.path.join(base_dir, 'script_delaware_bay.nc')
    scripting.remove_netcdf(netcdf_file)
    model.outputters += NetCDFOutput(netcdf_file, which_data='all')

    print 'adding a RandomMover:'
    model.movers += RandomMover(diffusion_coef=100000)

    print 'adding a wind mover:'

    series = np.zeros((2, ), dtype=datetime_value_2d)
    series[0] = (start_time, (5, 270))
    series[1] = (start_time + timedelta(hours=18), (5, 270))

    wind_file = get_datafile(os.path.join(base_dir, r"ConstantWind.WND"))
   # wind = Wind(filename=wind_file)
    wind = Wind(timeseries=series, units='m/s')
    w_mover = WindMover(wind)
    #w_mover = WindMover(Wind(timeseries=series, units='knots'))
    model.movers += w_mover

    print 'adding a cats shio mover:'

    curr_file = get_datafile(os.path.join(base_dir, r"./FloodTides.cur"))
    tide_file = get_datafile(os.path.join(base_dir, r"./FloodTidesShio.txt"))

    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # this is the value in the file (default)
    c_mover.scale_refpoint = (-75.081667,38.7995)
    c_mover.scale = True
    c_mover.scale_value = 1

    model.movers += c_mover

    # TODO: cannot add this till environment base class is created
    model.environment += c_mover.tide

    print 'adding a cats mover:'

    curr_file = get_datafile(os.path.join(base_dir,
                             r"./Offshore.cur"))
    c_mover = CatsMover(curr_file)

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-74.7483333,38.898333)
    c_mover.scale_value = .03
    model.movers += c_mover
# 
# pat1Angle 315; pat1Speed 30; pat1SpeedUnits knots; pat1ScaleToValue 0.314426 # these are from windows they don't match Mac values...
# pat2Angle 225; pat2Speed 30; pat2SpeedUnits knots; pat2ScaleToValue 0.032882
# scaleBy WindStress
 
    print 'adding a component mover:'

    curr_file1 = get_datafile(os.path.join(base_dir, r"NW30ktwinds.cur"))
    curr_file2 = get_datafile(os.path.join(base_dir, r"SW30ktwinds.cur"))
    comp_mover = ComponentMover(curr_file1, curr_file2, wind)
    #todo: following is not working when model is saved out - fix
    #comp_mover = ComponentMover(curr_file1, curr_file2, Wind(timeseries=series, units='m/s'))
    #comp_mover = ComponentMover(curr_file1, curr_file2, wind=Wind(filename=wind_file))

    comp_mover.ref_point = (-75.263166,39.1428333)
    comp_mover.pat1_angle = 315
    comp_mover.pat1_speed = 30
    comp_mover.pat1_speed_units = 1
    #comp_mover.pat1ScaleToValue = .314426
    comp_mover.pat1_scale_to_value = .502035
    comp_mover.pat2_angle = 225
    comp_mover.pat2_speed = 30
    comp_mover.pat2_speed_units = 1
    #comp_mover.pat2ScaleToValue = .032882
    comp_mover.pat2_scale_to_value = .021869

    model.movers += comp_mover

    print 'adding a spill'

    end_time = start_time + timedelta(hours=12)
    spill = point_line_release_spill(num_elements=1000,
                                     start_position=(-75.262319,
                                                     39.142987, 0.0),
                                     release_time=start_time)
                                     #end_release_time=end_time)

    model.spills += spill

    return model
Example #13
0
def make_model(images_dir=os.path.join(base_dir, 'images')):

    # create the maps:

    print 'creating the maps'
    mapfile = get_datafile(os.path.join(base_dir, 'DelawareRiverMap.bna'))
    gnome_map = MapFromBNA(mapfile, refloat_halflife=1)  # hours

    renderer = Renderer(mapfile, images_dir, image_size=(800, 800),
                        projection_class=GeoProjection)

    print 'initializing the model'
    start_time = datetime(2012, 8, 20, 13, 0)

    # 15 minutes in seconds
    # Default to now, rounded to the nearest hour
    model = Model(time_step=900, start_time=start_time,
                  duration=timedelta(days=1),
                  map=gnome_map, uncertain=False)

    print 'adding outputters'
    model.outputters += renderer

    netcdf_file = os.path.join(base_dir, 'script_delaware_bay.nc')
    scripting.remove_netcdf(netcdf_file)
    model.outputters += NetCDFOutput(netcdf_file, which_data='all')

    print 'adding a RandomMover:'
    model.movers += RandomMover(diffusion_coef=100000)

    print 'adding a wind mover:'

    # wind_file = get_datafile(os.path.join(base_dir, 'ConstantWind.WND'))
    # wind = Wind(filename=wind_file)

    series = np.zeros((2, ), dtype=datetime_value_2d)
    series[0] = (start_time, (5, 270))
    series[1] = (start_time + timedelta(hours=25), (5, 270))

    wind = Wind(timeseries=series, units='m/s')

    # w_mover = WindMover(Wind(timeseries=series, units='knots'))
    w_mover = WindMover(wind)
    model.movers += w_mover

    print 'adding a cats shio mover:'

    curr_file = get_datafile(os.path.join(base_dir, 'FloodTides.cur'))
    tide_file = get_datafile(os.path.join(base_dir, 'FloodTidesShio.txt'))

    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # this is the value in the file (default)
    c_mover.scale_refpoint = (-75.081667, 38.7995)
    c_mover.scale = True
    c_mover.scale_value = 1

    model.movers += c_mover

    # TODO: cannot add this till environment base class is created
    model.environment += c_mover.tide

    print 'adding a cats mover:'

    curr_file = get_datafile(os.path.join(base_dir, 'Offshore.cur'))
    c_mover = CatsMover(curr_file)

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-74.7483333, 38.898333)
    c_mover.scale_value = .03
    model.movers += c_mover
    #
    # these are from windows they don't match Mac values...
    # pat1Angle 315;
    # pat1Speed 30; pat1SpeedUnits knots;
    # pat1ScaleToValue 0.314426
    #
    # pat2Angle 225;
    # pat2Speed 30; pat2SpeedUnits knots;
    # pat2ScaleToValue 0.032882
    # scaleBy WindStress

    print 'adding a component mover:'

    # if only using one current pattern
    # comp_mover = ComponentMover(curr_file1, None, wind)
    #
    # todo: following is not working when model is saved out - fix
    # comp_mover = ComponentMover(curr_file1, curr_file2,
    #                             Wind(timeseries=series, units='m/s'))
    # comp_mover = ComponentMover(curr_file1, curr_file2,
    #                             wind=Wind(filename=wind_file))

    curr_file1 = get_datafile(os.path.join(base_dir, 'NW30ktwinds.cur'))
    curr_file2 = get_datafile(os.path.join(base_dir, 'SW30ktwinds.cur'))
    comp_mover = ComponentMover(curr_file1, curr_file2, wind)

    comp_mover.scale_refpoint = (-75.263166, 39.1428333)

    comp_mover.pat1_angle = 315
    comp_mover.pat1_speed = 30
    comp_mover.pat1_speed_units = 1
    # comp_mover.pat1ScaleToValue = .314426
    comp_mover.pat1_scale_to_value = .502035

    comp_mover.pat2_angle = 225
    comp_mover.pat2_speed = 30
    comp_mover.pat2_speed_units = 1
    # comp_mover.pat2ScaleToValue = .032882
    comp_mover.pat2_scale_to_value = .021869

    model.movers += comp_mover

    print 'adding a spill'

    end_time = start_time + timedelta(hours=12)
    spill = point_line_release_spill(num_elements=1000,
                                     release_time=start_time,
                                     # end_release_time=end_time,
                                     start_position=(-75.262319,
                                                     39.142987, 0.0),
                                     )

    model.spills += spill

    return model
Example #14
0
def make_model(images_dir=os.path.join(base_dir, 'images')):

    # create the maps:

    print 'creating the maps'
    mapfile = get_datafile(os.path.join(base_dir, './MassBayMap.bna'))
    gnome_map = MapFromBNA(mapfile, refloat_halflife=1)  # hours

    renderer = Renderer(mapfile, images_dir, size=(800, 800),
                        projection_class=GeoProjection)

    print 'initializing the model'
    start_time = datetime(2013, 3, 12, 10, 0)

    # 15 minutes in seconds
    # Default to now, rounded to the nearest hour
    model = Model(time_step=900, start_time=start_time,
                  duration=timedelta(days=1),
                  map=gnome_map, uncertain=False)

    print 'adding outputters'
    model.outputters += renderer

    netcdf_file = os.path.join(base_dir, 'script_boston.nc')
    scripting.remove_netcdf(netcdf_file)
    model.outputters += NetCDFOutput(netcdf_file, which_data='all')

    print 'adding a RandomMover:'
    model.movers += RandomMover(diffusion_coef=100000)

    print 'adding a wind mover:'

    series = np.zeros((2, ), dtype=datetime_value_2d)
    series[0] = (start_time, (5, 180))
    series[1] = (start_time + timedelta(hours=18), (5, 180))

    w_mover = WindMover(Wind(timeseries=series, units='m/s'))
    model.movers += w_mover
    model.environment += w_mover.wind

    print 'adding a cats shio mover:'

    curr_file = get_datafile(os.path.join(base_dir, r"./EbbTides.cur"))
    tide_file = get_datafile(os.path.join(base_dir, r"./EbbTidesShio.txt"))

    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # this is the value in the file (default)
    c_mover.scale_refpoint = (-70.8875, 42.321333)
    c_mover.scale = True
    c_mover.scale_value = -1

    model.movers += c_mover

    # TODO: cannot add this till environment base class is created
    model.environment += c_mover.tide

    print 'adding a cats ossm mover:'

    # ossm_file = get_datafile(os.path.join(base_dir,
    #                          r"./MerrimackMassCoastOSSM.txt"))
    curr_file = get_datafile(os.path.join(base_dir,
                             r"./MerrimackMassCoast.cur"))
    tide_file = get_datafile(os.path.join(base_dir,
                             r"./MerrimackMassCoastOSSM.txt"))
    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-70.65, 42.58333)
    c_mover.scale_value = 1.
    model.movers += c_mover
    model.environment += c_mover.tide

    print 'adding a cats mover:'

    curr_file = get_datafile(os.path.join(base_dir, r"MassBaySewage.cur"))
    c_mover = CatsMover(curr_file)

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-70.78333, 42.39333)

    # the scale factor is 0 if user inputs no sewage outfall effects
    c_mover.scale_value = .04

    model.movers += c_mover

    # pat1Angle 315;
    # pat1Speed 19.44; pat1SpeedUnits knots;
    # pat1ScaleToValue 0.138855
    #
    # pat2Angle 225;
    # pat2Speed 19.44; pat2SpeedUnits knots;
    # pat2ScaleToValue 0.05121
    #
    # scaleBy WindStress

    print "adding a component mover:"
    component_file1 = get_datafile(os.path.join(base_dir, r"./WAC10msNW.cur"))
    component_file2 = get_datafile(os.path.join(base_dir, r"./WAC10msSW.cur"))
    comp_mover = ComponentMover(component_file1, component_file2, w_mover.wind)

    # todo: callback did not work correctly below - fix!
    # comp_mover = ComponentMover(component_file1,
    #                             component_file2,
    #                             Wind(timeseries=series, units='m/s'))

    comp_mover.scale_refpoint = (-70.855, 42.275)
    comp_mover.pat1_angle = 315
    comp_mover.pat1_speed = 19.44
    comp_mover.pat1_speed_units = 1
    comp_mover.pat1ScaleToValue = .138855
    comp_mover.pat2_angle = 225
    comp_mover.pat2_speed = 19.44
    comp_mover.pat2_speed_units = 1
    comp_mover.pat2ScaleToValue = .05121

    model.movers += comp_mover

    print 'adding a spill'

    end_time = start_time + timedelta(hours=12)
    spill = point_line_release_spill(num_elements=1000,
                                     start_position=(-70.911432,
                                                     42.369142, 0.0),
                                     release_time=start_time,
                                     end_release_time=end_time)

    model.spills += spill

    return model
Example #15
0
base_dir = os.path.dirname(__file__)

# For WindMover test_save_load in test_wind_mover
g_objects = (
    GridCurrent.from_netCDF(testdata['GridCurrentMover']['curr_tri']),
    Tide(testdata['CatsMover']['tide']),
    #Wind(filename=testdata['ComponentMover']['wind']),
    constant_wind(5., 270, 'knots'),
    Wind(timeseries=(sec_to_date(24 * 60 * 60), (0, 0)), units='mps'),
    Water(temperature=273),
    RandomMover(),
    CatsMover(testdata['CatsMover']['curr']),
    CatsMover(testdata['CatsMover']['curr'],
              tide=Tide(testdata['CatsMover']['tide'])),
    ComponentMover(testdata['ComponentMover']['curr']),
    ComponentMover(testdata['ComponentMover']['curr'],
                   wind=constant_wind(5., 270, 'knots')),
    #wind=Wind(filename=testdata['ComponentMover']['wind'])),
    RandomMover3D(),
    SimpleMover(velocity=(10.0, 10.0, 0.0)),
    MapFromBNA(testdata['MapFromBNA']['testmap'], 6),
    NetCDFOutput(os.path.join(base_dir, u'xtemp.nc')),
    Renderer(testdata['Renderer']['bna_sample'],
             os.path.join(base_dir, 'output_dir')),
    WeatheringOutput(),
    spill.PointLineRelease(release_time=datetime.now(),
                           num_elements=10,
                           start_position=(0, 0, 0)),
    spill.point_line_release_spill(10, (0, 0, 0), datetime.now()),
    spill.substance.Substance(windage_range=(0.05, 0.07)),
Example #16
0
'''

base_dir = os.path.dirname(__file__)

# For WindMover test_save_load in test_wind_mover
g_objects = (
    GridCurrent.from_netCDF(testdata['GridCurrentMover']['curr_tri']),
    Tide(testdata['CatsMover']['tide']),
    Wind(filename=testdata['ComponentMover']['wind']),
    Wind(timeseries=(sec_to_date(24 * 60 * 60), (0, 0)), units='mps'),
    Water(temperature=273),
    RandomMover(),
    CatsMover(testdata['CatsMover']['curr']),
    CatsMover(testdata['CatsMover']['curr'],
              tide=Tide(testdata['CatsMover']['tide'])),
    ComponentMover(testdata['ComponentMover']['curr']),
    ComponentMover(testdata['ComponentMover']['curr'],
                   wind=Wind(filename=testdata['ComponentMover']['wind'])),
    RandomMover3D(),
    SimpleMover(velocity=(10.0, 10.0, 0.0)),
    map.MapFromBNA(testdata['MapFromBNA']['testmap'], 6),
    NetCDFOutput(os.path.join(base_dir, u'xtemp.nc')),
    Renderer(testdata['Renderer']['bna_sample'],
             os.path.join(base_dir, 'output_dir')),
    WeatheringOutput(),
    spill.PointLineRelease(release_time=datetime.now(),
                           num_elements=10,
                           start_position=(0, 0, 0)),
    spill.point_line_release_spill(10, (0, 0, 0), datetime.now()),
    spill.substance.Substance(windage_range=(0.05, 0.07)),
    spill.substance.GnomeOil(test_oil, windage_range=(0.05, 0.07)),
def test_certain_uncertain():
    """
    make sure certain and uncertain loop results in different deltas
    """

    delta = test_loop()
    u_delta = test_uncertain_loop()
    print
    print delta
    print u_delta
    assert np.all(delta[:, :2] != u_delta[:, :2])
    assert np.all(delta[:, 2] == u_delta[:, 2])


c_component = ComponentMover(curr1_file)


def test_default_props():
    """
    test default properties
    """

    assert c_component.pat1_angle == 0
    assert c_component.pat1_speed == 10
    #assert c_component.scale_refpoint is None


def test_pat1_angle():
    """
    test setting / getting properties
Example #18
0
def make_model(images_dir=os.path.join(base_dir, 'images')):

    # create the maps:

    print 'creating the maps'
    mapfile = get_datafile(os.path.join(base_dir, './MassBayMap.bna'))
    gnome_map = MapFromBNA(mapfile, refloat_halflife=1)  # hours

    renderer = Renderer(mapfile,
                        images_dir,
                        size=(800, 800),
                        projection_class=GeoProjection)

    print 'initializing the model'
    start_time = datetime(2013, 3, 12, 10, 0)

    # 15 minutes in seconds
    # Default to now, rounded to the nearest hour
    model = Model(time_step=900,
                  start_time=start_time,
                  duration=timedelta(days=1),
                  map=gnome_map,
                  uncertain=False)

    print 'adding outputters'
    model.outputters += renderer

    netcdf_file = os.path.join(base_dir, 'script_boston.nc')
    scripting.remove_netcdf(netcdf_file)
    model.outputters += NetCDFOutput(netcdf_file, which_data='all')

    print 'adding a RandomMover:'
    model.movers += RandomMover(diffusion_coef=100000)

    print 'adding a wind mover:'

    series = np.zeros((2, ), dtype=datetime_value_2d)
    series[0] = (start_time, (5, 180))
    series[1] = (start_time + timedelta(hours=18), (5, 180))

    w_mover = WindMover(Wind(timeseries=series, units='m/s'))
    model.movers += w_mover
    model.environment += w_mover.wind

    print 'adding a cats shio mover:'

    curr_file = get_datafile(os.path.join(base_dir, r"./EbbTides.cur"))
    tide_file = get_datafile(os.path.join(base_dir, r"./EbbTidesShio.txt"))

    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # this is the value in the file (default)
    c_mover.scale_refpoint = (-70.8875, 42.321333)
    c_mover.scale = True
    c_mover.scale_value = -1

    model.movers += c_mover

    # TODO: cannot add this till environment base class is created
    model.environment += c_mover.tide

    print 'adding a cats ossm mover:'

    # ossm_file = get_datafile(os.path.join(base_dir,
    #                          r"./MerrimackMassCoastOSSM.txt"))
    curr_file = get_datafile(
        os.path.join(base_dir, r"./MerrimackMassCoast.cur"))
    tide_file = get_datafile(
        os.path.join(base_dir, r"./MerrimackMassCoastOSSM.txt"))
    c_mover = CatsMover(curr_file, tide=Tide(tide_file))

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-70.65, 42.58333)
    c_mover.scale_value = 1.
    model.movers += c_mover
    model.environment += c_mover.tide

    print 'adding a cats mover:'

    curr_file = get_datafile(os.path.join(base_dir, r"MassBaySewage.cur"))
    c_mover = CatsMover(curr_file)

    # but do need to scale (based on river stage)

    c_mover.scale = True
    c_mover.scale_refpoint = (-70.78333, 42.39333)

    # the scale factor is 0 if user inputs no sewage outfall effects
    c_mover.scale_value = .04

    model.movers += c_mover

    # pat1Angle 315;
    # pat1Speed 19.44; pat1SpeedUnits knots;
    # pat1ScaleToValue 0.138855
    #
    # pat2Angle 225;
    # pat2Speed 19.44; pat2SpeedUnits knots;
    # pat2ScaleToValue 0.05121
    #
    # scaleBy WindStress

    print "adding a component mover:"
    component_file1 = get_datafile(os.path.join(base_dir, r"./WAC10msNW.cur"))
    component_file2 = get_datafile(os.path.join(base_dir, r"./WAC10msSW.cur"))
    comp_mover = ComponentMover(component_file1, component_file2, w_mover.wind)

    # todo: callback did not work correctly below - fix!
    # comp_mover = ComponentMover(component_file1,
    #                             component_file2,
    #                             Wind(timeseries=series, units='m/s'))

    comp_mover.scale_refpoint = (-70.855, 42.275)
    comp_mover.pat1_angle = 315
    comp_mover.pat1_speed = 19.44
    comp_mover.pat1_speed_units = 1
    comp_mover.pat1ScaleToValue = .138855
    comp_mover.pat2_angle = 225
    comp_mover.pat2_speed = 19.44
    comp_mover.pat2_speed_units = 1
    comp_mover.pat2ScaleToValue = .05121

    model.movers += comp_mover

    print 'adding a spill'

    end_time = start_time + timedelta(hours=12)
    spill = point_line_release_spill(num_elements=1000,
                                     start_position=(-70.911432, 42.369142,
                                                     0.0),
                                     release_time=start_time,
                                     end_release_time=end_time)

    model.spills += spill

    return model