Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting VIC ascii parameters to netcdf for image driver #61

Open
lizaclark opened this issue Sep 24, 2016 · 3 comments
Open

Converting VIC ascii parameters to netcdf for image driver #61

lizaclark opened this issue Sep 24, 2016 · 3 comments

Comments

@lizaclark
Copy link

When I run vic_utils grid_params --help, I get the usage, like I would expect, but if I run vic_utils grid_params soil_file.txt, I get the same usage that I would get from vic_utils --help. According to the grid_params help, the soil file is the only required input. the others are not optional? grid_params() doesn't seem to need these parameters. Either way, I would think that the vic_utils grid_params usage would print to the screen instead of the vic_utils usage.

@ankur-srivastav
Copy link

I am also facing the same issue. Any updates/workaround this issue? @lizaclark

@solomonsg
Copy link

solomonsg commented May 3, 2019

I am facing this issue! did anyone solve this issue? this is how I am running it
vic_utils grid_params Stehekin_soil.txt
and this gives the same information as vic_utils -h
I am also trying to convert the vic parameters to netcdf using tonic api using the example in https://vic.readthedocs.io/en/master/Documentation/Drivers/Image/Ascii_to_NetCDF_params/#option-2-using-the-tonic-api

if I am right i did this in python as (file name =file.py)

#!/usr/bin/env python
from tonic.models.vic.grid_params import soil, snow, veg, veg_class, Cols, Desc, calc_grid, grid_params
n_veg_classes = 11
root_zones = 3

Read the soil parameters

soil_dict = soil('/mnt/c/global_para/parameters/Stehekin_soil.txt', c=Cols(nlayers=3))

Read the snow parameters

snow_dict = snow('/mnt/c/PostDoc/VIC-Model/global_data_sets/global_para/parameters/Stehekin_snowbands.txt',
soil_dict, c=Cols(snow_bands=5))

Read the veg parameter file

veg_dict = veg('/mnt/c/global_para/parameters/Stehekin_vegparam.txt',
soil_dict,
lai_index=False,
veg_classes=n_veg_classes)
#Read the veg library file
veg_lib = veg_class('/mnt/c/global_para/parameters/Stehekin_veglib.txt',
skiprows=1)

Determine the grid shape

target_grid, target_attrs = calc_grid(soil_dict['lats'], soil_dict['lons'])

Grid all the parameters

grid_dict = grid_params(soil_dict, target_grid, version=version,
veg_dict=veg_dict, veglib_dict=veg_lib, snow_dict=snow_dict)

Write a netCDF file with all the parameters

write_netcdf('/mnt/c/global_para/parameters/global_sol_params_vic5.nc', target_attrs,
target_grid=target_grid,
soil_grid=grid_dict['soil_dict'],
snow_grid=grid_dict['snow_dict'],
veglib_dict=veg_lib,
veg_grid=grid_dict['veg_dict'],
version='5.0.dev')

after running this as "python file.py" I am getting are:

  1. TypeError: veg() got an unexpected keyword argument 'lai_index'
  2. I removed lai_index as the data contains Lai, /tonic/models/vic/grid_params.py", line 1503, in veg
    ValueError: invalid literal for int() with base 10: ''
  3. TypeError: veg_class() got an unexpected keyword argument 'skiprows'
  4. target_grid, target_attrs = calc_grid(soil_dict['lats'], soil_dict['lons']) NameError: name 'calc_grid' is not defined

@daverocks87
Copy link

I am also facing same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants