示例#1
0
def simple_model(output_dir):
    start_time = "2018-09-20T12:00"
    model = gs.Model(
        start_time=start_time,
        duration=gs.days(1),
        time_step=gs.minutes(30),
        name="test model for tideflats",
    )
    model.map = MapFromBNA(bna_file)
    model.movers += gs.constant_wind_mover(10, 300, "m/s")

    model.spills += gs.surface_point_line_spill(
        num_elements=100,
        start_position=(5.4, 53.38, 0),
        end_position=(5.8, 53.4, 0),
        release_time=start_time,
    )
    model.outputters += gs.Renderer(
        output_timestep=gs.hours(1),
        map_filename=bna_file,
        output_dir=output_dir,
        formats=['gif'],  # ['gif', 'png']
        image_size=(800, 400),
        # viewport=((4.5, 53.0),
        #           (5.5, 53.5)),
    )

    return model
示例#2
0
def simple_model(output_dir):
    start_time = "2018-09-20T12:00"
    model = gs.Model(start_time=start_time,
                     duration=gs.days(1),
                     time_step=gs.minutes(30),
                     name="test model for tideflats",
                     )
    model.map = MapFromBNA(bna_file)
    model.movers += gs.constant_wind_mover(10, 300, "m/s")

    model.spills += gs.surface_point_line_spill(num_elements=100,
                                                start_position=(5.4, 53.38, 0),
                                                end_position=(5.8, 53.4, 0),
                                                release_time=start_time,
                                                )
    model.outputters += gs.Renderer(output_timestep=gs.hours(1),
                                    map_filename=bna_file,
                                    output_dir=output_dir,
                                    formats=['gif'],  # ['gif', 'png']
                                    image_size=(800, 400),
                                    # viewport=((4.5, 53.0),
                                    #           (5.5, 53.5)),
                                    )


    return model
示例#3
0
def test_model_run_with_tideflat(simple_model):
    """
    Add a tideflat with the simple tideflat object

    no tests here, but you can look at the output
    """
    model = simple_model

    # make a simple tideflat model
    bounds = (
        (5.623211, 53.309485),
        (5.784850, 53.348716),
        (5.761970, 53.368978),
        (5.722114, 53.376904),
        (5.667496, 53.367657),
        (5.620259, 53.354003),
        (5.609926, 53.328444),
    )

    dry_start = model.start_time + gs.hours(4)
    dry_end = model.start_time + gs.hours(8)

    tf = SimpleTideflat(bounds, dry_start, dry_end)

    # get the map from the model and wrap it in a TideflatMap
    tfm = TideflatMap(model.map, tf)

    model.map = tfm

    # to make it run faster
    model.time_step = gs.hours(2)
    for step in model:
        print "step_num", step['step_num']

    status = model.get_spill_property('status_codes')

    assert np.all(status == oil_status.on_land)
示例#4
0
def model(sample_model):
    model = sample_model['model']
    model.make_default_refs = True

    rel_start_pos = sample_model['release_start_pos']
    rel_end_pos = sample_model['release_end_pos']

    # model.cache_enabled = True # why use the cache -- it'll just slow things down!!!
    model.uncertain = False

    wind = constant_wind(1.0, 0.0)
    water = Water(311.15)
    model.environment += water

    waves = Waves(wind, water)
    model.environment += waves

    print "the environment:", model.environment

    start_time = model.start_time

    model.duration = gs.days(1)
    end_time = start_time + gs.hours(1)

    spill = point_line_release_spill(100,
                                     start_position=rel_start_pos,
                                     release_time=start_time,
                                     end_release_time=start_time + gs.hours(1),
                                     end_position=rel_end_pos,
                                     substance=test_oil,
                                     amount=1000,
                                     units='kg')
    model.spills += spill

    model.add_weathering(which='standard')

    return model
示例#5
0
def test_model_run_with_tideflat(simple_model):
    """
    Add a tideflat with the simple tideflat object

    no tests here, but you can look at the output
    """
    model = simple_model

    # make a simple tideflat model
    bounds = ((5.623211, 53.309485),
              (5.784850, 53.348716),
              (5.761970, 53.368978),
              (5.722114, 53.376904),
              (5.667496, 53.367657),
              (5.620259, 53.354003),
              (5.609926, 53.328444),
              )

    dry_start = model.start_time + gs.hours(4)
    dry_end = model.start_time + gs.hours(8)

    tf = SimpleTideflat(bounds, dry_start, dry_end)

    # get the map from the model and wrap it in a TideflatMap
    tfm = TideflatMap(model.map, tf)

    model.map = tfm

    # to make it run faster
    model.time_step = gs.hours(2)
    for step in model:
        print "step_num", step['step_num']

    status = model.get_spill_property('status_codes')

    assert np.all(status == oil_status.on_land)
示例#6
0
def test_full_model_run(simple_model):
    """
    run it with a full model and no tide flats

    no tests here, but you can look at the output
    """
    # run it a bit faster
    # but long enough for them all to beach
    simple_model.duration = gs.hours(18)
    # simple_model.full_run()
    for step in simple_model:
        print "step num:", step['step_num']

    status = simple_model.get_spill_property('status_codes')

    assert np.all(status == oil_status.on_land)
示例#7
0
def test_full_model_run(simple_model):
    """
    run it with a full model and no tide flats

    no tests here, but you can look at the output
    """
    # run it a bit faster
    # but long enough for them all to beach
    simple_model.duration = gs.hours(18)
    # simple_model.full_run()
    for step in simple_model:
        print "step num:", step['step_num']

    status = simple_model.get_spill_property('status_codes')

    assert np.all(status == oil_status.on_land)
示例#8
0
def test_model_full_run_output(model, output_dir):
    '''
    Test weathering outputter with a model since simplest to do that

    (I'm being impatient -- I hope I don't regret that)
    '''

    outfilename = os.path.join(output_dir, "test_oil_budget.csv")

    model.outputters += OilBudgetOutput(outfilename,
                                        output_timestep=gs.hours(1))

    print OilBudgetOutput.clean_output_files

    model.rewind()

    model.full_run()

    # was the file created?

    out_filename = os.path.join(output_dir, outfilename)
    assert os.path.isfile(out_filename)

    # read the file in and test a couple things
    csv_file = open(out_filename).readlines()

    print len(csv_file)

    assert len(csv_file) == 26

    assert csv_file[0].split(",")[0] == "Model Time"

    assert csv_file[1].split(",")[0].strip() == "0:00"
    assert csv_file[2].split(",")[0].strip() == "1:00"

    assert csv_file[-1].split(",")[0].strip() == "24:00"
示例#9
0
def make_model(images_dir=os.path.join(base_dir, 'images')):

    # create the maps:

    print 'creating the maps'
    mapfile = gs.get_datafile(os.path.join(base_dir, './MassBayMap.bna'))
    gnome_map = gs.MapFromBNA(
        mapfile,
        refloat_halflife=1,  # hours
        raster_size=2048 * 2048  # about 4 MB
    )

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

    print 'initializing the model'
    # start_time = datetime(2013, 3, 12, 10, 0)
    start_time = "2013-03-12T10:00"
    # 15 minutes in seconds
    # Default to now, rounded to the nearest hour
    model = gs.Model(time_step=gs.minutes(15),
                     start_time=start_time,
                     duration=gs.days(1),
                     map=gnome_map,
                     uncertain=True)

    print 'adding outputters'
    model.outputters += renderer

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

    model.outputters += gs.KMZOutput(
        os.path.join(base_dir, 'script_boston.kmz'))

    print 'adding a RandomMover:'
    model.movers += gs.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=25), (5, 180))

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

    w_mover = gs.constant_wind_mover(5, 180, units='m/s')
    model.movers += w_mover
    print 'adding a cats shio mover:'

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

    c_mover = gs.CatsMover(curr_file, tide=gs.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 = gs.get_datafile(
        os.path.join(base_dir, "MerrimackMassCoast.cur"))
    tide_file = gs.get_datafile(
        os.path.join(base_dir, "MerrimackMassCoastOSSM.txt"))
    c_mover = gs.CatsMover(curr_file, tide=gs.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 = gs.get_datafile(os.path.join(base_dir, "MassBaySewage.cur"))
    c_mover = gs.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 = gs.get_datafile(os.path.join(base_dir, "WAC10msNW.cur"))
    component_file2 = gs.get_datafile(os.path.join(base_dir, "WAC10msSW.cur"))
    comp_mover = gs.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 = gs.asdatetime(start_time) + gs.hours(12)
    spill = gs.point_line_release_spill(num_elements=100,
                                        start_position=(-70.911432, 42.369142,
                                                        0.0),
                                        release_time=start_time,
                                        end_release_time=end_time)

    model.spills += spill

    return model
# still need these, 'cause we're doing something special here.
from gnome.movers import PyCurrentMover
from gnome.utilities.time_utils import asdatetime

from wadden_mudflats_matroos import Matroos_Mudflats

data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))

# Simulation outputs:
# use this place to script the folder based on test number or something
# it will be a relative path to this script
out_dir = 'mudflat_matroos_test_real'

# Model parameters:
start_time = "2018-10-11 05:00"  # time 00:00 if you don't specify
model_duration = gs.hours(24)

dT_OUT = gs.minutes(30)

currentfile = 'MatroosRect.nc'

# constant wind (in both time and space)
Wind = {"speed": 10, "direction": 270, "units": "m/s"}

SpillPosition = (5.122382, 53.327899, 0)  # tussen VL en TX
# SpillPosition = (5.210218, 53.231510, 0)  # route Harlingen Terschelling
# SpillPosition = (4.834194, 52.936454, 0)

# Model Parameters:
base_dir = os.path.dirname(__file__)
newpath = os.path.join(base_dir, out_dir)
import gnome.scripting as gs
from gnome.outputters import WeatheringOutput, OilBudgetOutput

try:
    savefile = sys.argv[1]
except IndexError:
    print "You must provide a savefile to load"
    sys.exit(1)


print "Loading:", savefile

model = gs.Model.load_savefile(savefile)
model.outputters += WeatheringOutput(output_dir="NewModel",
                                     output_timestep=gs.hours(1),
                                     )

print "running model"
model.full_run()







# note: this outputs a bunch of JSON -- one for each timestep.
#       maybe a MassBalanceOutputter that ouputs a CSV file would be in order?

示例#12
0
from gnome.maps.tideflat_map import TideflatMap, SimpleTideflat
from wadden_mudflats import Delft3D_Mudflats

# Simulation inputs
# location of the input data
# data_dir = os.path.join(os.path.dirname(__file__), "../")
data_dir = os.path.dirname(__file__)  # same dir as this script

# Simulation outputs:
# use this place to script the folder based on test number or something
# it will be a relative path to this script
out_dir = 'mudflat_test'

# Model parameters:
start_time = "2009-01-01"  # time 00:00 if you don't specify
model_duration = gs.hours(24)

dT_OUT = gs.hours(1)

currentfile = 'PACE_GNOME_01V2.nc'
# currentfile = 'PACE_GNOME_01V2_fixed.nc'

# constant wind (in both time and space)
# Wind = {"speed": 5, "direction": 220, "units": "m/s"}
Wind = {"speed": 10, "direction": 270, "units": "m/s"}

# SpillPosition = (5.122382, 53.327899, 0) # tussen VL en TX
SpillPosition = (5.210218, 53.231510, 0)  # route Harlingen Terschelling
##

# Model Parameters:
示例#13
0
model.outputters += gs.Renderer(
    map_filename=mapfile,
    output_dir=images_dir,
    image_size=(800, 800),
    projection=None,
    viewport=((-124.0, 36.0), (-122.0, 38.0)),
    map_BB=None,
    draw_back_to_fore=True,
    draw_map_bounds=False,
    draw_spillable_area=False,
    formats=['gif'],
    draw_ontop='forecast',
    output_timestep=None,
    output_zero_step=True,
    output_last_step=True,
    output_start_time=None,
    on=True,
    timestamp_attrib={},
)

outfilename = "whale_run_windage_{:.1f}.nc".format(WINDAGE * 100)
netcdf_file = os.path.join(base_dir, outfilename)
model.outputters += gs.NetCDFOutput(netcdf_file,
                                    which_data='standard',
                                    output_timestep=gs.hours(3),
                                    compress=True,
                                    surface_conc=None)

model.full_run()
示例#14
0
def model(sample_model):
    model = sample_model['model']
    model.make_default_refs = True

    rel_start_pos = sample_model['release_start_pos']
    rel_end_pos = sample_model['release_end_pos']

    # model.cache_enabled = True # why use the cache -- it'll just slow things down!!!
    model.uncertain = False

    wind = constant_wind(1.0, 0.0)
    water = Water(311.15)
    model.environment += water

    waves = Waves(wind, water)
    model.environment += waves

    print "the environment:", model.environment

    start_time = model.start_time

    model.duration = timedelta(hours=12)
    end_time = start_time + timedelta(hours=1)
    spill = point_line_release_spill(100,
                                     start_position=rel_start_pos,
                                     release_time=start_time,
                                     end_release_time=start_time + hours(1),
                                     end_position=rel_end_pos,
                                     substance=test_oil,
                                     amount=1000,
                                     units='kg')
    model.spills += spill

    # figure out mid-run save for weathering_data attribute, then add this in
    # rel_time = model.spills[0].release_time

    skim_start = start_time + timedelta(hours=1)
    amount = model.spills[0].amount
    units = model.spills[0].units

    skimmer = Skimmer(.3 * amount,
                      units=units,
                      efficiency=0.3,
                      active_range=(skim_start,
                                    skim_start + hours(1)))

    # thickness = 1m so area is just 20% of volume
    volume = spill.get_mass() / spill.substance.density_at_temp()

    burn = Burn(0.2 * volume, 1.0,
                active_range=(skim_start, InfDateTime('inf')),
                efficiency=0.9)

    c_disp = ChemicalDispersion(.1, efficiency=0.5,
                                active_range=(skim_start,
                                              skim_start + timedelta(hours=1)),
                                waves=waves)

    model.weatherers += [Evaporation(),
                         c_disp,
                         burn,
                         skimmer]

    model.outputters += WeatheringOutput()
    model.rewind()

    return model
示例#15
0
def make_model():
    """
    Set up a GNOME simulation that uses TAMOC

    Set up a spill scenario in GNOME that uses TAMOC to simulate a subsurface
    blowout and then pass the TAMOC solution to GNOME for the far-field
    particle tracking

    """
    # Set up the directory structure for the model
    base_dir, images_dir, outfiles_dir = set_directory_structure()

    # Set up the modeling environment
    print '\n-- Initializing the Model         --'
    start_time = "2019-06-01T12:00"
    model = gs.Model(start_time=start_time,
                     duration=gs.days(3),
                     time_step=gs.minutes(30),
                     uncertain=False)

    # Add a map
    print '\n-- Adding a Map                   --'
    model.map = gs.GnomeMap()

    # Add image output
    print '\n-- Adding Image Outputters        --'
    renderer = gs.Renderer(output_dir=images_dir,
                           image_size=(1024, 768),
                           output_timestep=gs.hours(1),
                           viewport=((-0.15, -0.35), (0.15, 0.35)))
    model.outputters += renderer

    # Add NetCDF output
    print '\n-- Adding NetCDF Outputter        --'
    if not os.path.exists(outfiles_dir):
        os.mkdir(outfiles_dir)
    netcdf_file = os.path.join(outfiles_dir, 'script_tamoc.nc')
    gs.remove_netcdf(netcdf_file)
    file_writer = gs.NetCDFOutput(netcdf_file,
                                  which_data='all',
                                  output_timestep=gs.hours(2))
    model.outputters += file_writer

    # Add a spill object
    print '\n-- Adding a Point Spill           --'
    end_release_time = model.start_time + gs.hours(12)
    point_source = ts.TamocSpill(num_elements=100,
                                 start_position=(0.0, 0.0, 1000.),
                                 release_duration=gs.hours(24),
                                 release_time=start_time,
                                 substance='AD01554',
                                 release_rate=20000.,
                                 units='bbl/day',
                                 gor=500.,
                                 d0=0.5,
                                 phi_0=-np.pi / 2.,
                                 theta_0=0.,
                                 windage_range=(0.01, 0.04),
                                 windage_persist=900,
                                 name='Oil Well Blowout')

    model.spills += point_source

    # Create an ocean environment
    water, wind, waves = base_environment(water_temp=273.15 + 21.,
                                          wind_speed=5.,
                                          wind_dir=225.)

    # Add a uniform current in the easterly direction
    print '\n-- Adding Currents                --'
    uniform_current = gs.SimpleMover(velocity=(0.1, 0.0, 0.))
    model.movers += uniform_current

    # Add a wind mover
    wind_mover = gs.WindMover(wind)
    model.movers += wind_mover

    # Add particle diffusion...note, units are in cm^2/s
    print '\n-- Adding Particle Diffusion      --'
    particle_diffusion = gs.RandomMover3D(
        horizontal_diffusion_coef_above_ml=100000.,
        horizontal_diffusion_coef_below_ml=10000.,
        vertical_diffusion_coef_above_ml=100.,
        vertical_diffusion_coef_below_ml=10.,
        mixed_layer_depth=15.)
    model.movers += particle_diffusion

    # Add rise velocity for droplets
    print '\n-- Adding Particle Rise Velocity  --'
    # fixme: we do have code for rise velocity:
    #  gnome.movers.RiseVelocityMover
    #  let's test that later
    slip_velocity = gs.SimpleMover(velocity=(0.0, 0.0, -0.1))
    model.movers += slip_velocity

    # Add dissolution
    print '\n-- Adding Weathering              --'
    evaporation = Evaporation(water=water, wind=wind)
    model.weatherers += evaporation

    dissolution = Dissolution(waves=waves, wind=wind)
    model.weatherers += dissolution

    return model
示例#16
0
def make_model(images_dir=os.path.join(base_dir, 'images')):
    print 'initializing the model'

    start_time = "1985-01-01T13:31"

    model = gs.Model(start_time=start_time,
                     duration=gs.days(2),
                     time_step=gs.hours(1))

    mapfile = gs.get_datafile(os.path.join(base_dir, 'ak_arctic.bna'))

    print 'adding the map'
    model.map = gs.MapFromBNA(mapfile, refloat_halflife=0.0)  # seconds

    print 'adding outputters'
    renderer = gs.Renderer(mapfile, images_dir, image_size=(1024, 768))
    renderer.set_viewport(((-165, 69), (-161.5, 70)))

    # model.outputters += renderer

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

    print 'adding a spill'
    # For a subsurfce spill, you would need to add vertical movers:
    # - gs.RiseVelocityMover
    # - gs.RandomVerticalMover
    spill1 = gs.point_line_release_spill(num_elements=1000,
                                         start_position=(-163.75,
                                                         69.75,
                                                         0.0),
                                         release_time=start_time)

    model.spills += spill1



    print 'adding the ice movers'
    fn = [gs.get_datafile('arctic_avg2_0001_gnome.nc'),
          gs.get_datafile('arctic_avg2_0002_gnome.nc'),
          ]

    gt = {'node_lon': 'lon',
          'node_lat': 'lat'}

    ice_aware_curr = gs.IceAwareCurrent.from_netCDF(filename=fn,
                                                    grid_topology=gt)
    ice_aware_wind = gs.IceAwareWind.from_netCDF(filename=fn,
                                                 grid=ice_aware_curr.grid,)
    method = 'RK2'

    i_c_mover = gs.PyCurrentMover(current=ice_aware_curr,
                                  default_num_method=method)
    i_w_mover = gs.PyWindMover(wind=ice_aware_wind,
                               default_num_method=method)

    # shifting to -360 to 0 longitude
    ice_aware_curr.grid.node_lon = ice_aware_curr.grid.node_lon[:] - 360
    model.movers += i_c_mover
    model.movers += i_w_mover

    print 'adding an Ice RandomMover:'
    model.movers += IceAwareRandomMover(ice_concentration=ice_aware_curr.ice_concentration,
                                        diffusion_coef=50000)


    # to visualize the grid and currents
#     renderer.add_grid(ice_aware_curr.grid)
#     renderer.add_vec_prop(ice_aware_curr)

    return model
示例#17
0
def make_model(images_dir=os.path.join(base_dir, 'images')):
    print 'initializing the model'

    start_time = "1985-01-01T13:31"

    model = gs.Model(start_time=start_time,
                     duration=gs.days(2),
                     time_step=gs.hours(1))

    mapfile = gs.get_datafile(os.path.join(base_dir, 'ak_arctic.bna'))

    print 'adding the map'
    model.map = gs.MapFromBNA(mapfile, refloat_halflife=0.0)  # seconds

    print 'adding outputters'
    renderer = gs.Renderer(mapfile, images_dir, image_size=(1024, 768))
    renderer.set_viewport(((-165, 69), (-161.5, 70)))

    # model.outputters += renderer

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

    print 'adding a spill'
    # For a subsurfce spill, you would need to add vertical movers:
    # - gs.RiseVelocityMover
    # - gs.RandomVerticalMover
    spill1 = gs.point_line_release_spill(num_elements=1000,
                                         start_position=(-163.75, 69.75, 0.0),
                                         release_time=start_time)

    model.spills += spill1

    print 'adding the ice movers'
    fn = [
        gs.get_datafile('arctic_avg2_0001_gnome.nc'),
        gs.get_datafile('arctic_avg2_0002_gnome.nc'),
    ]

    gt = {'node_lon': 'lon', 'node_lat': 'lat'}

    ice_aware_curr = gs.IceAwareCurrent.from_netCDF(filename=fn,
                                                    grid_topology=gt)
    ice_aware_wind = gs.IceAwareWind.from_netCDF(
        filename=fn,
        grid=ice_aware_curr.grid,
    )
    method = 'RK2'

    i_c_mover = gs.PyCurrentMover(current=ice_aware_curr,
                                  default_num_method=method)
    i_w_mover = gs.PyWindMover(wind=ice_aware_wind, default_num_method=method)

    # shifting to -360 to 0 longitude
    ice_aware_curr.grid.node_lon = ice_aware_curr.grid.node_lon[:] - 360
    model.movers += i_c_mover
    model.movers += i_w_mover

    print 'adding an Ice RandomMover:'
    model.movers += IceAwareRandomMover(
        ice_concentration=ice_aware_curr.ice_concentration,
        diffusion_coef=50000)

    # to visualize the grid and currents
    #     renderer.add_grid(ice_aware_curr.grid)
    #     renderer.add_vec_prop(ice_aware_curr)

    return model