How to use the tonic.io.read_netcdf function in tonic

To help you get started, we’ve selected a few tonic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
def _run(args, ):

    print(args)
    print('in compare_soil_params')

    plot_atts_3 = None
    plot_atts_9 = None

    dom, dom_atts = read_netcdf(args.domain_file)
    d1, d1a = read_netcdf(args.soil_file1)
    d2, d2a = read_netcdf(args.soil_file2)
    out_path = args.out_path
    title1 = args.title1
    title2 = args.title2

    if not plot_atts_3:
        plot_atts_3 = {'infilt': {'vmin': 0,
                                  'vmax': 1,
                                  'amin': -0.5,
                                  'amax': 0.5,
                                  'amap': cmap_discretize('cm.RdBu_r')},
                       'Ws': {'vmin': 0,
                              'vmax': 100,
                              'amin': -50,
                              'amax': 50,
                              'amap': cmap_discretize('cm.RdBu_r')},
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
def _run(args, ):

    print(args)
    print('in compare_soil_params')

    plot_atts_3 = None
    plot_atts_9 = None

    dom, dom_atts = read_netcdf(args.domain_file)
    d1, d1a = read_netcdf(args.soil_file1)
    d2, d2a = read_netcdf(args.soil_file2)
    out_path = args.out_path
    title1 = args.title1
    title2 = args.title2

    if not plot_atts_3:
        plot_atts_3 = {'infilt': {'vmin': 0,
                                  'vmax': 1,
                                  'amin': -0.5,
                                  'amax': 0.5,
                                  'amap': cmap_discretize('cm.RdBu_r')},
                       'Ws': {'vmin': 0,
                              'vmax': 100,
                              'amin': -50,
                              'amax': 50,
                              'amap': cmap_discretize('cm.RdBu_r')},
                       'Ds': {'vmin': 0,
github UW-Hydro / tonic / tonic / models / vic / grid_params.py View on Github external
veg_dict = veg(veg_file, soil_dict, veg_classes,
                       max_roots, cells, blowing_snow,
                       vegparam_lai, vegparam_fcan,
                       vegparam_albedo, lai_src,
                       fcan_src, alb_src)
    else:
        veg_dict = False

    if lake_file:
        lake_dict = lake(lake_file, soil_dict, max_numnod,
                         cells, lake_profile)
    else:
        lake_dict = False

    if grid_file:
        target_grid, target_attrs = read_netcdf(grid_file)
    else:
        target_grid, target_attrs = calc_grid(soil_dict['lats'],
                                              soil_dict['lons'],
                                              grid_decimal)

    grid_dict = grid_params(soil_dict, target_grid, snow_dict,
                            veglib_dict, veg_dict, lake_dict,
                            version_in, veglib_fcan,
                            veglib_photo, lib_bare_idx,
                            blowing_snow, vegparam_lai,
                            vegparam_fcan, vegparam_albedo,
                            lai_src, fcan_src, alb_src)

    if nc_file:
        write_netcdf(nc_file, target_attrs, target_grid,
                     grid_dict['soil_dict'], grid_dict['snow_dict'],
github UW-Hydro / tonic / tonic / models / vic / ncparam2ascii.py View on Github external
def subset(param_file, upleft=False, lowright=False, outfiles=1,
           soil_file=False, snow_file=False,
           veg_file=False, project=None,
           nijssen2arno=False):

    data, attributes = read_netcdf(param_file)

    if nijssen2arno:
        import NIJSSEN2001_to_ARNO
        data = NIJSSEN2001_to_ARNO.convert(data)

    if project:
        print('Project Configuration {0}'.format(project))
        if project == 'RASM':
            outfiles = 1
            cells, yinds, xinds = find_gridcells(data['mask'])
            rasm_soil(data, soil_file)
        else:
            raise ValueError('Unknown project configuration')
        return

    else:
github UW-Hydro / tonic / tonic / models / vic / plot_params.py View on Github external
def main():
    param_data, _ = read_netcdf(param_file)

    baresoil = 1 - np.sum(param_data['Cv'], axis=0)

    plot_veg_types(param_data['yc'], param_data['xc'], param_data['Cv'],
                   baresoil)
# -------------------------------------------------------------------- #
github UW-Hydro / tonic / tonic / models / vic / compare_soil_params.py View on Github external
def _run(args, ):

    print(args)
    print('in compare_soil_params')

    plot_atts_3 = None
    plot_atts_9 = None

    dom, dom_atts = read_netcdf(args.domain_file)
    d1, d1a = read_netcdf(args.soil_file1)
    d2, d2a = read_netcdf(args.soil_file2)
    out_path = args.out_path
    title1 = args.title1
    title2 = args.title2

    if not plot_atts_3:
        plot_atts_3 = {'infilt': {'vmin': 0,
                                  'vmax': 1,
                                  'amin': -0.5,
                                  'amax': 0.5,
                                  'amap': cmap_discretize('cm.RdBu_r')},
                       'Ws': {'vmin': 0,
                              'vmax': 100,
                              'amin': -50,
                              'amax': 50,