model.movers += RandomMover(diffusion_coef=1000)

    # curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
    # c_mover = GridCurrentMover(curr_file)
    # model.movers += c_mover

    return model


if __name__ == "__main__":
    pd.profiler.enable()
    startTime = datetime.now()
    scripting.make_images_dir()
    model = make_model()
    print "doing full run"
    rend = model.outputters[0]
    #     rend.graticule.set_DMS(True)
    for step in model:
        if step['step_num'] == 0:
            rend.set_viewport(((-122.9, 45.6), (-122.6, 46.0)))
#             rend.set_viewport(((-123.25, 48.125), (-122.5, 48.75)))
#         if step['step_num'] == 0:
#             rend.set_viewport(((-122.8, 45.65), (-122.75, 45.7)))
#             rend.set_viewport(((-123.1, 48.55), (-122.95, 48.65)))
# print step
        print "step: %.4i -- memuse: %fMB" % (step['step_num'],
                                              utilities.get_mem_use())
    print datetime.now() - startTime
    pd.profiler.disable()
    pd.print_stats(0.2)
        netCDF_fn = os.path.join(base_dir, images_dir + '.nc')
        mod.outputters += NetCDFOutput(netCDF_fn, which_data='all')
        models.append(mod)

    print 'returning models'
    return models


if __name__ == "__main__":
    models = make_models()
#     for m in models:
#         scripting.make_images_dir(m.outputters)
    print "doing full run"
#     field = rend.grids[0]
#     rend.graticule.set_DMS(True)
    for model in models:
        rend = model.outputters[0]
        startTime = datetime.now()
        pd.profiler.enable()
        for step in model:
            if step['step_num'] == 0:
                rend.set_viewport(((-74.2, 39.75), (-74.05, 39.85)))

            print "step: %.4i -- memuse: %fMB" % (step['step_num'],
                                                  utilities.get_mem_use())
        print datetime.now() - startTime
        pd.profiler.disable()
        pd.print_stats(0.1)
        pd.clear_stats()
        print '\n-----------------------------------------------\n'
    print 'adding a current mover:'
#     curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
#   
#     # uncertain_time_delay in hours
#     c_mover = GridCurrentMover(curr_file)
#     c_mover.uncertain_cross = 0  # default is .25
#   
#     model.movers += c_mover

    return model


if __name__ == "__main__":
    startTime = datetime.now()
    scripting.make_images_dir()
    model = make_model()
    print "doing full run"
    print "Note: Images folder and animation do not create same output, for demonstration"
    anim = model.outputters[0]
    model.map.save_as_image('raster.bmp')
    for step in model:
        if step['step_num'] == 12:
            anim.set_timestamp_attrib(on=False)
        if step['step_num'] == 24:
            anim.set_timestamp_attrib(on=True)
        print "step: %.4i -- memuse: %fMB" % (step['step_num'],
                                              utilities.get_mem_use())
    print datetime.now() - startTime
    pd.print_stats(5)
Beispiel #4
0
    #u_mover = GridCurrentMover(fn)
    renderer.add_grid(cf.grid)
#     renderer.add_vec_prop(cf)
    model.movers += u_mover

    # curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
    # c_mover = GridCurrentMover(curr_file)
    # model.movers += c_mover

    return model


if __name__ == "__main__":
    pd.profiler.enable()
    startTime = datetime.now()
    scripting.make_images_dir()
    model = make_model()
    print "doing full run"
    rend = model.outputters[0]
    for step in model:
        if step['step_num'] == 0:
            rend.set_viewport(((-82.8, 27.475), (-82.7, 27.575)))
#         if step['step_num'] == 0:
#             rend.set_viewport(((-83.5, 27.0), (-82.1, 28.0)))

        print "step: %.4i -- memuse: %fMB" % (step['step_num'],
                                              utilities.get_mem_use())
    print datetime.now() - startTime
    pd.profiler.disable()
    pd.print_stats(0.2)
    print 'adding a current mover:'
    #     curr_file = get_datafile(os.path.join(base_dir, 'COOPSu_CREOFS24.nc'))
    #
    #     # uncertain_time_delay in hours
    #     c_mover = GridCurrentMover(curr_file)
    #     c_mover.uncertain_cross = 0  # default is .25
    #
    #     model.movers += c_mover

    return model


if __name__ == "__main__":
    startTime = datetime.now()
    scripting.make_images_dir()
    model = make_model()
    print "doing full run"
    print "Note: Images folder and animation do not create same output, for demonstration"
    anim = model.outputters[0]
    model.map.save_as_image('raster.bmp')
    for step in model:
        if step['step_num'] == 12:
            anim.set_timestamp_attrib(on=False)
        if step['step_num'] == 24:
            anim.set_timestamp_attrib(on=True)
        print "step: %.4i -- memuse: %fMB" % (step['step_num'],
                                              utilities.get_mem_use())
    print datetime.now() - startTime
    pd.print_stats(5)