<jupyter_start><jupyter_text>AusCover data can be downloaded from thredds server:http://rs-data1-mel.csiro.au/thredds/fileServer/bawap/<jupyter_code>def change_forcing(imap):
    from awrams.utils.nodegraph.nodes import forcing_from_ncfiles
    from os.path import join
    from os import getcwd

    data_path = '../../test_data/simulation/'
    
    imap.mapping['precip_f'] = forcing_from_ncfiles(data_path,'bom-rain_day-*','rain_day')
    imap.mapping['tmax_f']   = forcing_from_ncfiles(data_path,'bom-tmax_day-*','tmax_day')
    imap.mapping['tmin_f']   = forcing_from_ncfiles(data_path,'bom-tmin_day-*','tmin_day')
    imap.mapping['solar_f']  = forcing_from_ncfiles(data_path,'bom-rad_day-*','rad_day')

imap = awral.get_default_mapping()
change_forcing(imap)<jupyter_output><empty_output><jupyter_text>create model output map and add nodes for saving some model outputs to netcdf files<jupyter_code>def build_output_mapping():
    from awrams.utils.nodegraph import nodes,graph
    from awrams.models.awral.template import DEFAULT_TEMPLATE

    ### populate output map with all model outputs
    output_map = awral.get_output_nodes(DEFAULT_TEMPLATE)

    outpath = './_results/'

    output_map.mapping['s0_ncsave'] = nodes.write_to_annual_ncfile(outpath,'s0')
    output_map.mapping['ss_ncsave'] = nodes.write_to_annual_ncfile(outpath,'ss')
    output_map.mapping['sd_ncsave'] = nodes.write_to_annual_ncfile(outpath,'sd')
    output_map.mapping['qtot_ncsave'] = nodes.write_to_annual_ncfile(outpath,'qtot')
    output_map.mapping['etot_ncsave'] = nodes.write_to_annual_ncfile(outpath,'etot')

    return graph.OutputGraph(output_map.mapping)

omap = build_output_mapping()
period = datetools.dates('dec 2010 - jan 2011')
extent = extents.from_boundary_offset(200,200,250,250)
period
sim = Server(awral)
sim.run(imap,omap,period,extent)<jupyter_output>2016-10-13 04:25:17,394 INFO Getting I/O dataspecs...
2016-10-13 04:25:19,358 INFO Initialising output files...
2016-10-13 04:25:19,550 INFO Building buffers...
2016-10-13 04:25:20,980 INFO Running simulation...<jupyter_text>initialise states from dict mapping of numpy arrays<jupyter_code>def initial_states_from_dict(imap,period,extent):
    from awrams.utils.io.data_mapping import SplitFileManager
    from awrams.utils.nodegraph import nodes
    from os.path import join
    from os import getcwd

    data_path = '../../test_data/simulation/'

    node_names = {'mleaf_dr': 'init_mleaf_hrudr',
                  'mleaf_sr': 'init_mleaf_hrusr',
                  's0_dr': 'init_s0_hrudr',
                  's0_sr': 'init_s0_hrusr',
                  'ss_dr': 'init_ss_hrudr',
                  'ss_sr': 'init_ss_hrusr',
                  'sd_dr': 'init_sd_hrudr',
                  'sd_sr': 'init_sd_hrusr',
                  'sg_bal': 'init_sg',
                  'sr_bal': 'init_sr'}

    data_map = {}
    period = [period[0] - 1]
    
    for k in node_names:
        sfm = SplitFileManager.open_existing(data_path,k+'*nc',k)
        data_map[node_names[k]] = sfm.get_data(period,extent)

    nodes.init_states_from_dict(imap,data_map,extent)

initial_states_from_dict(imap,period,extent)
sim = Server(awral)
sim.run(imap,omap,period,extent)<jupyter_output>2016-10-13 04:25:25,399 INFO Getting I/O dataspecs...
2016-10-13 04:25:27,405 INFO Initialising output files...
2016-10-13 04:25:27,544 INFO Building buffers...
2016-10-13 04:25:27,665 INFO Running simulation...<jupyter_text>initialise states from netcdf files<jupyter_code>from awrams.utils.nodegraph import nodes
    from os.path import join
    from os import getcwd

    data_path = '../../test_data/simulation/'

    mapping = imap.mapping

    mapping['init_sr'] = nodes.init_state_from_ncfile(data_path,'sr_bal*','sr_bal')
    mapping['init_sg'] = nodes.init_state_from_ncfile(data_path,'sg_bal*','sg_bal')

    HRU = {'_hrusr':'_sr','_hrudr':'_dr'}
    for hru in ('_hrusr','_hrudr'):
        for state in ["s0","ss","sd",'mleaf']:
            mapping['init_'+state+hru] = nodes.init_state_from_ncfile(data_path,state+HRU[hru]+'*',state+HRU[hru])

initial_states_from_dict(imap,period,extent)
sim = Server(awral)
sim.run(imap,omap,period,extent)<jupyter_output>2016-10-13 04:25:31,139 INFO Getting I/O dataspecs...
2016-10-13 04:25:33,112 INFO Initialising output files...
2016-10-13 04:25:33,249 INFO Building buffers...
2016-10-13 04:25:33,370 INFO Running simulation...<jupyter_text>fill gaps in forcing data with climatology<jupyter_code>def insert_climatology(imap):
    from awrams.utils.nodegraph import nodes
    from os.path import join
    from os import getcwd

    data_path = '../../test_data/simulation/'

    imap.mapping['precip_f'] = nodes.forcing_gap_filler(data_path,'rain_day*','rain_day',join(data_path,'climatology_daily_rain_day.nc'))
    imap.mapping['tmax_f'] = nodes.forcing_gap_filler(data_path,'temp_max*','temp_max_day',join(data_path,'climatology_daily_temp_max_day.nc'))
    imap.mapping['tmin_f'] = nodes.forcing_gap_filler(data_path,'temp_min*','temp_min_day',join(data_path,'climatology_daily_temp_min_day.nc'))
    imap.mapping['solar_f'] = nodes.forcing_gap_filler(data_path,'solar*','solar_exposure_day',join(data_path,'climatology_daily_solar_exposure_day.nc'))
    
insert_climatology(imap)
sim = Server(awral)
sim.run(imap,omap,period,extent)<jupyter_output>2016-10-13 04:25:38,482 INFO Getting I/O dataspecs...
2016-10-13 04:25:39,190 INFO Initialising output files...
2016-10-13 04:25:39,341 INFO Building buffers...
2016-10-13 04:25:39,462 INFO Running simulation...
{'fraction_non_alphanumeric': 0.13528138528138528, 'fraction_numerical': 0.05447330447330447, 'mean_word_length': 4.693018480492813, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '243027', 'license': 'NetCDF', 'n_tokens_mistral': 2282, 'n_tokens_neox': 2029, 'n_words': 313, 'path': 'simulation/notebooks/SimulationServer_AusCover.ipynb', 'repo_name': 'Zac-HD/awra_cms', 'size': '5544'}