UW-Hydro / VIC

The Variable Infiltration Capacity (VIC) Macroscale Hydrologic Model
http://vic.readthedocs.io
MIT License
263 stars 395 forks source link

Does VIC get locations information of cells from domain file or parameters file? #637

Closed Sibada closed 8 years ago

Sibada commented 8 years ago

Or it's out of boundary on time scale?

[ERROR] /home/victi/VIC/vic/drivers/shared_image/src/get_nc_field.c:54: errno: NetCDF: Index exceeds dimension bound: Error getting values for tas in /home/victi/TRMM_VIC/just_tst_forcing.1959.nc 
dgergel commented 8 years ago

@Sibada, can you provide us with a bit more information about your setup, such as the global parameter file, and some info about the forcing data? Also, if you could an ncdump -h $forcing_file on one of the forcing files, that would be helpful.

Sibada commented 8 years ago

After holiday I still have no ideas... Their header is look like that:

netcdf Just_tst.1959 {
dimensions:
    lon = 109 ;
    lat = 42 ;
    time = 365 ;
variables:
    double lon(lon) ;
        lon:standard_name = "longtitude" ;
        lon:units = "degrees_east" ;
        lon:axis = "X" ;
    double lat(lat) ;
        lat:standard_name = "latitude" ;
        lat:units = "degrees_north" ;
        lat:axis = "Y" ;
    int time(time) ;
        time:units = "days since 1959-01-01" ;
        time:calendar = "proleptic_gregorian" ;
    double mask(lat, lon) ;
        mask:_FillValue = 0. ;
        mask:long_name = "fraction of grid cell that is active domain mask." ;
        mask:comment = "0 value indicates cell is not active." ;
    double tas(time, lat, lon) ;
        tas:_FillValue = -9999. ;
        tas:long_name = "TEMP" ;
    double prcp(time, lat, lon) ;
        prcp:_FillValue = -9999. ;
        prcp:long_name = "TEMP" ;
    double pres(time, lat, lon) ;
        pres:_FillValue = -9999. ;
        pres:long_name = "TEMP" ;
    double vp(time, lat, lon) ;
        vp:_FillValue = -9999. ;
        vp:long_name = "TEMP" ;
    double wind(time, lat, lon) ;
        wind:_FillValue = -9999. ;
        wind:long_name = "TEMP" ;
    double dswrf(time, lat, lon) ;
        dswrf:_FillValue = -9999. ;
        dswrf:long_name = "SWDOWN" ;
    double dlwrf(time, lat, lon) ;
        dlwrf:_FillValue = -9999. ;
        dlwrf:long_name = "LWDOWN" ;

// global attributes:
        :_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17" ;
}
Sibada commented 8 years ago

I found that it's the problem of time steps per day. I modify MIN_SUBDAILY_STEPS_PER_DAY to 1 in vic_def.h and set global file like that:

#######################################################################
# Simulation Parameters
#######################################################################
MODEL_STEPS_PER_DAY 1
SNOW_STEPS_PER_DAY 1
RUNOFF_STEPS_PER_DAY 1

STARTYEAR 1960
STARTMONTH 1
STARTDAY 1
ENDYEAR 1970
ENDMONTH 12
ENDDAY 31
CALENDAR PROLEPTIC_GREGORIAN

It works and outputs seems correct. Although it take out warnings like this:

[WARN] /home/sibada/VIC/vic/vic_run/src/root_brent.c:255: errno: Numerical result out of range: lower and upper bounds -329.107187 and -219.107187 failed to bracket the root. Driver info: Gridcell io_idx: 4485, timestep info: dmy:
    day         : 27
    day_in_year : 361
    seconds     : 0
    month       : 12
    year        : 1970
.

May it means something wrong in parameters file?

And would MIN_SUBDAILY_STEPS_PER_DAY set to 1 be recommended?

jhamman commented 8 years ago

VIC should not be run at a daily timestep. VIC requires forcings to be supplied at least a 6 hourly timestep (MODEL_STEPS_PER_DAY 4). If your forcings are daily, you will need to disaggregate them.

Sibada commented 8 years ago

How the units of time in netCDF file should be set if timestep is set to 6 hour? 6 hours since 1959-01-01 seems not legal.

jhamman commented 8 years ago

@Sibada - You need to use subdaily forcings. Simply changing the units in your netcdf file will not suffice. The units may be any CF compliant string (e.g. hours since 1959-01-01).