コード例 #1
0
def test_server():
    extent = extents.get_default_extent()
    extent = extent.icoords[-32:-35,115:118]

    from awrams.simulation.server import SimulationServer

    sim = SimulationServer(awral)
    sim.run(input_map,output_map,period,extent)
コード例 #2
0
def test_server():
    from awrams.utils import extents
    from awrams.simulation.server import SimulationServer
    #from awrams.models import awral

    extent = extents.get_default_extent()
    extent = extent.icoords[-32:-35, 115:118]

    get_initial_states_dict(input_map, period, extent)
    insert_climatology(input_map)

    sim = SimulationServer(awral)
    sim.run(input_map, output_map, period, extent)
コード例 #3
0
ファイル: test_et.py プロジェクト: adivicco47/awra_cms-1
def test_sim():
    '''
    Required inputs
    mortons: tmin,tmax,solar,vapour pressure ### apparently not albedo
    fao56:   tmin,tmax,solar,vapour pressure,wind
    penpan:  tmin2da,tmax,solar,vapour pressure,wind
    penman:  tmin,tmax,solar,vapour pressure,wind,veg,albedo
    '''

    from awrams.utils import extents
    from awrams.simulation.server import SimulationServer

    et.set_models_to_run([
        "fao56", "asce", "morton_shallow_lake", "morton_areal", "penpan",
        "penman"
    ])

    extent = extents.get_default_extent()
    extent = extent.icoords[-32:-35, 115:118]

    period = pd.date_range("1 dec 2010", "31 jan 2011", freq='D')

    sim = SimulationServer(et)
    sim.run(imap, omap, period, extent)
コード例 #4
0
ファイル: test_et.py プロジェクト: adivicco47/awra_cms-1
def test_asce():
    import awrams.models.settings
    import awrams.utils.nodegraph.nodes as nodes
    # awrams.models.settings.CLIMATE_DATA = _join(TRAINING_DATA_PATH,'climate/BOM_climate/')

    bom_data_path = '/data/cwd_awra_data/awra_inputs/climate_generated_sdcvd-awrap01/'
    wind_data_path = '/data/cwd_awra_data/awra_inputs/mcvicar_wind/'
    fveg_data_path = '/data/cwd_awra_data/awra_inputs/modis_fveg/8day/pv/'
    albedo_data_path = '/data/cwd_awra_data/awra_inputs/randall_albedo/'
    temp_min_2day_datapath = '/data/cwd_awra_data/awra_inputs/2dayAveTmin/'

    FORCING = {
        'tmin':
        ('temp_min*.nc', 'temp_min_day', bom_data_path + 'temp_min_day/'),
        'tmin2da':
        ('temp_min*.nc', 'temp_min_2dayave', temp_min_2day_datapath),
        'tmax':
        ('temp_max*.nc', 'temp_max_day', bom_data_path + 'temp_max_day/'),
        'precip': ('rain_day*.nc', 'rain_day', bom_data_path + 'rain_day/'),
        'solar': ('solar*.nc', 'solar_exposure_day',
                  bom_data_path + 'solar_exposure_day/'),  #,
        'vprp': ('vapour_pressure*.nc', 'vapour_pressure',
                 bom_data_path + 'vapour_pressure/'),  #, #h09
        'wind': ('wind*.nc', 'wind', wind_data_path),
        'fveg': ('fveg*.nc', 'fveg', fveg_data_path),
        'alb': ('albedo*.nc', 'albedo', albedo_data_path)
    }
    import awrams.models.et.settings
    awrams.models.et.settings.FORCING = {
        k + "_f": dict(zip(("pattern", "nc_var", "path"), v))
        for k, v in FORCING.items()
    }
    '''
    Required inputs
    mortons: tmin,tmax,solar,vapour pressure ### apparently not albedo
    fao56:   tmin,tmax,solar,vapour pressure,wind
    penpan:  tmin2da,tmax,solar,vapour pressure,wind
    penman:  tmin,tmax,solar,vapour pressure,wind,veg,albedo
    '''

    from awrams.utils import extents
    from awrams.simulation.ondemand import OnDemandSimulator
    from awrams.simulation.server import SimulationServer
    from awrams.models.et.model import ETModel

    et = ETModel()
    # et.set_models_to_run(["fao56","morton_shallow_lake","morton_areal","penpan","penman"])
    # et.set_models_to_run(["fao56","morton_areal","penpan"])
    # et.set_models_to_run(["morton_areal"])
    # et.set_models_to_run(["fao56"])
    # et.set_models_to_run(["penpan"])
    # et.set_models_to_run(["penman"])
    et.set_models_to_run(["asce"])
    # et.set_models_to_run(["morton_shallow_lake"])

    imap = et.get_default_mapping()
    # print(imap['fveg'])
    # print(imap['fveg_f'])
    # imap['fveg_f'] = nodes.forcing_from_modis_ncfiles(fveg_data_path,'fveg_filled.nc','fveg')
    # imap['fveg'] = nodes.mul('fveg_f',0.01)
    # print(imap['fveg_f'])
    # exit()
    omap = et.get_output_mapping()
    et.save_outputs(omap, path="./outputs/ss/")
    # et.save_outputs(omap,path="/data/cwd_awra_data/awra_test_outputs/Scheduled_et_sdcvt-awrap01/")
    # print(omap)

    # omap['nc_msl_et'] = nodes.write_to_annual_ncfile("./",'msl_et')

    extent = extents.get_default_extent()
    # extent = extent.icoords[-32:-34,115:118]
    # extent = extent.ioffset[440,95]
    # extent = extent.ioffset[490,90]
    # extent = extent.ioffset[277:304,50]
    # extent = extent.ioffset[256:265,60]
    # extent = extent.ioffset[455,770:791]
    # extent = extent.ioffset[230:240,120]
    # print("Extent",extent)

    # period = pd.date_range("1 jan 2010","31 dec 2011",freq='D')
    # period = pd.date_range("1 jan 2010",periods=1,freq='D')
    period = pd.date_range("1 jan 2011", "31 dec 2011", freq='D')
    # period = pd.date_range("1 jan 2016","31 jan 2016",freq='D')
    # period = pd.date_range("1 jan 1990","30 apr 2018",freq='D')

    # sim = OnDemandSimulator(et,imap,omapping=omap)
    # print(sim.input_runner.input_graph['models']['exe'].get_dataspec())
    # r = sim.run(period,extent)
    # # print(r)

    sim = SimulationServer(et)
    sim.run(imap, omap, period, extent)