From 922b4572920abbb0a007362bb2843b4b41025d35 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Sun, 24 Jan 2016 21:20:56 -0800 Subject: [PATCH 01/13] add vic_sample_data submodule --- .gitmodules | 3 +++ samples/VIC_sample_data | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 samples/VIC_sample_data diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..507b8f0ad --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "samples/VIC_sample_data"] + path = samples/VIC_sample_data + url = https://github.com/jhamman/VIC_sample_data diff --git a/samples/VIC_sample_data b/samples/VIC_sample_data new file mode 160000 index 000000000..8de9ea08f --- /dev/null +++ b/samples/VIC_sample_data @@ -0,0 +1 @@ +Subproject commit 8de9ea08f360c633c237a8da8d5efabfb660f81a From 7cd023939f49b2ce950eb8a029c7db5a9d56716c Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Sat, 30 Jan 2016 20:25:01 -0800 Subject: [PATCH 02/13] allow user to specify netcdf variable names in global parameter file for image driver --- samples/global.param.sample.image.txt | 39 ++--- vic/drivers/image/include/vic_driver_image.h | 1 + vic/drivers/image/src/get_force_type.c | 146 ++++++++++++++++++ vic/drivers/image/src/get_global_param.c | 7 +- vic/drivers/image/src/vic_force.c | 34 ++-- .../shared/include/vic_driver_shared.h | 1 + 6 files changed, 191 insertions(+), 37 deletions(-) create mode 100644 vic/drivers/image/src/get_force_type.c diff --git a/samples/global.param.sample.image.txt b/samples/global.param.sample.image.txt index c0ada31cf..48f0c0194 100644 --- a/samples/global.param.sample.image.txt +++ b/samples/global.param.sample.image.txt @@ -105,33 +105,22 @@ FROZEN_SOIL FALSE # TRUE = calculate frozen soils. Default = FALSE. ####################################################################### # Forcing Files and Parameters # -# All FORCING filenames are actually the pathname, and prefix -# for gridded data types: ex. DATA/forcing_ -# Latitude and longitude index suffix is added by VIC +# All FORCING filenames are actually the pathname, and prefix # -# There must be 1 FORCE_TYPE entry for each variable (column) in the forcing file +# There must be 1 FORCE_TYPE entry for each variable in the forcing file, followed by the netCDF variable name. For example: # -# If FORCE_TYPE is BINARY, each FORCE_TYPE must be followed by: -# SIGNED/UNSIGNED SCALE_FACTOR -# For example (BINARY): -# FORCE_TYPE PREC UNSIGNED 40 -# or (ASCII): -# FORCE_TYPE PREC -####################################################################### -FORCING1 (put the forcing path/prefix here) # Forcing file path and prefix, ending in "_" -FORCE_FORMAT BINARY # BINARY or ASCII -FORCE_ENDIAN LITTLE # LITTLE (PC/Linux) or BIG (SUN) -N_TYPES 4 # Number of variables (columns) -FORCE_TYPE PREC UNSIGNED 40 -FORCE_TYPE TMAX SIGNED 100 -FORCE_TYPE TMIN SIGNED 100 -FORCE_TYPE WIND SIGNED 100 -FORCE_STEPS_PER_DAY 24 # Forcing time step length (hours) -FORCEYEAR 2000 # Year of first forcing record -FORCEMONTH 01 # Month of first forcing record -FORCEDAY 01 # Day of first forcing record -GRID_DECIMAL 4 # Number of digits after decimal point in forcing file names -WIND_H 10.0 # height of wind speed measurement (m) +# FORCING1 (put the forcing path/prefix here) # Forcing file path and prefix, ending in "_" +# FORCE_TYPE PREC prcp +####################################################################### +FORCING1 (put the forcing path/prefix here # Forcing file path and prefix, ending in "_" +FORCE_TYPE AIR_TEMP tas # Average air temperature, C +FORCE_TYPE PREC prcp # Total precipitation (rain and snow), mm +FORCE_TYPE PRESSURE pres # Atmospheric pressure, kPa +FORCE_TYPE SHORTWAVE dswrf # Incoming shortwave, W/m2 +FORCE_TYPE LONGWAVE dslwr # Incoming longwave radiation, W/m2 +FORCE_TYPE QAIR shum # Vapor pressure, kPa +FORCE_TYPE WIND wind # Wind speed, m/s +WIND_H 10.0 # height of wind speed measurement (m) ####################################################################### # Land Surface Files and Parameters diff --git a/vic/drivers/image/include/vic_driver_image.h b/vic/drivers/image/include/vic_driver_image.h index b7527a329..1b7ab9e8d 100644 --- a/vic/drivers/image/include/vic_driver_image.h +++ b/vic/drivers/image/include/vic_driver_image.h @@ -138,6 +138,7 @@ double average(double *ar, size_t n); out_data_struct *create_output_list(void); void free_atmos(atmos_data_struct *atmos); void free_veg_hist(veg_hist_struct *veg_hist); +void get_force_type(char *cmdstr, int file_num, int *field); void get_forcing_file_info(param_set_struct *param_set, size_t file_num); size_t get_global_domain(char *fname, domain_struct *global_domain); void get_global_param(FILE *); diff --git a/vic/drivers/image/src/get_force_type.c b/vic/drivers/image/src/get_force_type.c new file mode 100644 index 000000000..c593a10fd --- /dev/null +++ b/vic/drivers/image/src/get_force_type.c @@ -0,0 +1,146 @@ +/****************************************************************************** + * @section DESCRIPTION + * + * This routine determines the current forcing file data type and stores its + * location in the description of the current forcing file. + * + * @section LICENSE + * + * The Variable Infiltration Capacity (VIC) macroscale hydrological model + * Copyright (C) 2014 The Land Surface Hydrology Group, Department of Civil + * and Environmental Engineering, University of Washington. + * + * The VIC model is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + *****************************************************************************/ + +#include +#include +#include + +/****************************************************************************** + * @brief This routine determines the current forcing file data type and + * stores its location in the description of the current forcing file. + *****************************************************************************/ +void +get_force_type(char *cmdstr, + int file_num, + int *field) +{ + extern param_set_struct param_set; + + char optstr[MAXSTRING]; + char flgstr[MAXSTRING]; + char ncvarname[MAXSTRING]; + int type; + + type = SKIP; + strcpy(ncvarname, "MISSING"); + + /** Initialize flgstr **/ + strcpy(flgstr, "NULL"); + + if ((*field) >= (int) param_set.N_TYPES[file_num]) { + log_err("Too many variables defined for forcing file %i.", file_num); + } + + sscanf(cmdstr, "%*s %s %s", optstr, ncvarname); + + /*************************************** + Get meteorological data forcing info + ***************************************/ + + /* type 0: air temperature [C] */ + if (strcasecmp("AIR_TEMP", optstr) == 0) { + type = AIR_TEMP; + } + /* type 1: albedo [fraction] */ + else if (strcasecmp("ALBEDO", optstr) == 0) { + type = ALBEDO; + } + /* type 2: atmospheric CO2 mixing ratio [ppm] */ + else if (strcasecmp("CATM", optstr) == 0) { + type = CATM; + } + /* type 3: incoming channel flow [m3] */ + else if (strcasecmp("CHANNEL_IN", optstr) == 0) { + type = CHANNEL_IN; + } + /* type 4: direct fraction of shortwave [fraction] */ + else if (strcasecmp("FDIR", optstr) == 0) { + type = FDIR; + } + /* type 5: LAI [m2/m2] */ + else if (strcasecmp("LAI_IN", optstr) == 0) { + type = LAI_IN; + } + /* type 6: incoming longwave radiation [W/m2] */ + else if (strcasecmp("LONGWAVE", + optstr) == 0 || strcasecmp("LWDOWN", optstr) == 0) { + type = LONGWAVE; + } + /* type 7: photosynthetically active radiation [uE/m2s] */ + else if (strcasecmp("PAR", optstr) == 0) { + type = PAR; + } + /* type 8: precipitation [mm] */ + else if (strcasecmp("PREC", optstr) == 0) { + type = PREC; + } + /* type 9: air pressure [kPa] */ + else if (strcasecmp("PRESSURE", optstr) == 0) { + type = PRESSURE; + } + /* type 10: vapor pressure [kPa] */ + else if (strcasecmp("VP", optstr) == 0) { + type = VP; + } + /* type 11: rainfall [mm] */ + else if (strcasecmp("SHORTWAVE", + optstr) == 0 || strcasecmp("SWDOWN", optstr) == 0) { + type = SHORTWAVE; + } + /* type 12: vegetation cover fraction */ + else if (strcasecmp("VEGCOVER", optstr) == 0) { + type = VEGCOVER; + } + /* type 13: wind speed [m/s] */ + else if (strcasecmp("WIND", optstr) == 0) { + type = WIND; + } + /* type 14: unused (blank) data */ + else if (strcasecmp("SKIP", optstr) == 0) { + type = SKIP; + } + /** Undefined variable type **/ + else { + log_err("Undefined forcing variable type %s in file %i.", + optstr, file_num); + } + + param_set.TYPE[type].SUPPLIED = file_num + 1; + param_set.FORCE_INDEX[file_num][(*field)] = type; + + if (strcasecmp("MISSING", ncvarname) != 0) { + strcpy(param_set.TYPE[type].varname, ncvarname); + } + else { + log_err("Must suply netCDF variable name for %s forcing file number %d", + optstr, file_num); + } + + param_set.TYPE[type].N_ELEM = 1; + + (*field)++; +} diff --git a/vic/drivers/image/src/get_global_param.c b/vic/drivers/image/src/get_global_param.c index 4775a676b..5623ecaff 100644 --- a/vic/drivers/image/src/get_global_param.c +++ b/vic/drivers/image/src/get_global_param.c @@ -47,6 +47,7 @@ get_global_param(FILE *gp) char flgstr[MAXSTRING]; char flgstr2[MAXSTRING]; size_t file_num; + int field; unsigned int tmpstartdate; unsigned int tmpenddate; unsigned short int lastday[MONTHS_PER_YEAR]; @@ -401,6 +402,7 @@ get_global_param(FILE *gp) } sscanf(cmdstr, "%*s %s", filenames.f_path_pfx[0]); file_num = 0; + field = 0; } else if (strcasecmp("FORCING2", optstr) == 0) { sscanf(cmdstr, "%*s %s", filenames.f_path_pfx[1]); @@ -408,9 +410,10 @@ get_global_param(FILE *gp) strcpy(filenames.f_path_pfx[1], "MISSING"); } file_num = 1; + field = 0; } - else if (strcasecmp("N_TYPES", optstr) == 0) { - sscanf(cmdstr, "%*s %zu", ¶m_set.N_TYPES[file_num]); + else if (strcasecmp("FORCE_TYPE", optstr) == 0) { + get_force_type(cmdstr, file_num, &field); } else if (strcasecmp("WIND_H", optstr) == 0) { sscanf(cmdstr, "%*s %lf", &global_param.wind_h); diff --git a/vic/drivers/image/src/vic_force.c b/vic/drivers/image/src/vic_force.c index fdd2a3db8..22903b37f 100644 --- a/vic/drivers/image/src/vic_force.c +++ b/vic/drivers/image/src/vic_force.c @@ -48,6 +48,7 @@ vic_force(void) extern veg_con_struct **veg_con; extern veg_hist_struct **veg_hist; extern parameters_struct param; + extern param_set_struct param_set; double t_offset; double *dvar = NULL; @@ -86,7 +87,8 @@ vic_force(void) // Air temperature: tas for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "tas", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[AIR_TEMP].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].air_temp[j] = (double) dvar[i]; @@ -96,7 +98,8 @@ vic_force(void) // Precipitation: prcp for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "prcp", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[PREC].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].prec[j] = (double) dvar[i]; @@ -106,7 +109,8 @@ vic_force(void) // Downward solar radiation: dswrf for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "dswrf", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[SHORTWAVE].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].shortwave[j] = (double) dvar[i]; @@ -116,7 +120,8 @@ vic_force(void) // Downward longwave radiation: dlwrf for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "dlwrf", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[LONGWAVE].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].longwave[j] = (double) dvar[i]; @@ -136,7 +141,8 @@ vic_force(void) // Specific humidity: shum for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "shum", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[VP].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].vp[j] = (double) dvar[i]; @@ -146,7 +152,8 @@ vic_force(void) // Pressure: pressure for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "pres", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[PRESSURE].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].pressure[j] = (double) dvar[i]; @@ -155,9 +162,13 @@ vic_force(void) // Optional inputs if (options.LAKES) { // Channel inflow to lake + d3start[0] = global_param.forceoffset[0] + j; + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[CHANNEL_IN].varname, + d3start, d3count, dvar); for (j = 0; j < NF; j++) { for (i = 0; i < local_domain.ncells_active; i++) { - atmos[i].channel_in[j] = 0; + atmos[i].channel_in[j] = (double) dvar[i]; } } } @@ -165,7 +176,8 @@ vic_force(void) // Atmospheric CO2 mixing ratio for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "catm", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[CATM].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].Catm[j] = (double) dvar[i]; @@ -174,7 +186,8 @@ vic_force(void) // Fraction of shortwave that is direct for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "fdir", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[FDIR].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].fdir[j] = (double) dvar[i]; @@ -183,7 +196,8 @@ vic_force(void) // Photosynthetically active radiation for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; - get_scatter_nc_field_double(filenames.forcing[0], "par", + get_scatter_nc_field_double(filenames.forcing[0], + param_set.TYPE[PAR].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].par[j] = (double) dvar[i]; diff --git a/vic/drivers/shared/include/vic_driver_shared.h b/vic/drivers/shared/include/vic_driver_shared.h index 967501528..070e5835b 100644 --- a/vic/drivers/shared/include/vic_driver_shared.h +++ b/vic/drivers/shared/include/vic_driver_shared.h @@ -343,6 +343,7 @@ typedef struct { bool SIGNED; bool SUPPLIED; double multiplier; + char varname[MAXSTRING]; } force_type_struct; /****************************************************************************** From b12958402693ccf3ff138d04ea87c8f6c39c1577 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Sun, 31 Jan 2016 18:54:21 -0800 Subject: [PATCH 03/13] update vic_headers for change to force_type_struct --- vic/drivers/python/vic_headers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/vic/drivers/python/vic_headers.py b/vic/drivers/python/vic_headers.py index 798d0821a..f2503842f 100644 --- a/vic/drivers/python/vic_headers.py +++ b/vic/drivers/python/vic_headers.py @@ -1250,6 +1250,7 @@ _Bool SIGNED; _Bool SUPPLIED; double multiplier; + char varname[MAXSTRING]; } force_type_struct; typedef struct { force_type_struct TYPE[N_FORCING_TYPES]; From b7cc654d2f5c42e6fc056ab65b1e13958e58fdb6 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Sun, 31 Jan 2016 19:33:13 -0800 Subject: [PATCH 04/13] update python header --- vic/drivers/image/src/get_global_domain.c | 6 +++--- vic/drivers/python/vic_headers.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vic/drivers/image/src/get_global_domain.c b/vic/drivers/image/src/get_global_domain.c index 8eb17b340..8a0c27e32 100644 --- a/vic/drivers/image/src/get_global_domain.c +++ b/vic/drivers/image/src/get_global_domain.c @@ -47,8 +47,8 @@ get_global_domain(char *nc_name, initialize_domain(global_domain); - global_domain->n_nx = get_nc_dimension(nc_name, "ni"); - global_domain->n_ny = get_nc_dimension(nc_name, "nj"); + global_domain->n_nx = get_nc_dimension(nc_name, "lon"); + global_domain->n_ny = get_nc_dimension(nc_name, "lat"); d2start[0] = 0; d2start[1] = 0; @@ -64,7 +64,7 @@ get_global_domain(char *nc_name, log_err("Memory allocation error in get_global_domain()."); } - get_nc_field_int(nc_name, "run_cell", d2start, d2count, run); + get_nc_field_int(nc_name, "mask", d2start, d2count, run); for (i = 0; i < global_domain->ncells_total; i++) { if (run[i]) { diff --git a/vic/drivers/python/vic_headers.py b/vic/drivers/python/vic_headers.py index f2503842f..7408eeee6 100644 --- a/vic/drivers/python/vic_headers.py +++ b/vic/drivers/python/vic_headers.py @@ -1250,7 +1250,7 @@ _Bool SIGNED; _Bool SUPPLIED; double multiplier; - char varname[MAXSTRING]; + char varname[2048]; } force_type_struct; typedef struct { force_type_struct TYPE[N_FORCING_TYPES]; From f824c2ea7a9d9f159ce71281169cfdccced6e63a Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Sun, 31 Jan 2016 21:42:09 -0800 Subject: [PATCH 05/13] specify domain variable and dimension names in global parameter file --- samples/global.param.sample.image.txt | 12 +++ vic/drivers/image/include/vic_driver_image.h | 15 +++ vic/drivers/image/src/get_global_domain.c | 100 +++++++++++++++---- vic/drivers/image/src/get_global_param.c | 9 +- vic/drivers/image/src/vic_init_output.c | 24 ++--- vic/drivers/image/src/vic_start.c | 3 + vic/vic_run/include/vic_def.h | 3 - 7 files changed, 123 insertions(+), 43 deletions(-) diff --git a/samples/global.param.sample.image.txt b/samples/global.param.sample.image.txt index 48f0c0194..8779fead6 100644 --- a/samples/global.param.sample.image.txt +++ b/samples/global.param.sample.image.txt @@ -18,6 +18,18 @@ ENDDAY 31 # day model simulation ends # LOG_DIR (put the log directory path here) # Log directory. Default log output to stderr +####################################################################### +# DOMAIN INFO +####################################################################### +DOMAIN /Users/jhamman/Dropbox/data/VIC_test_data/datasets/Stehekin/vic5_setup/domain.stehekin.20151028.nc +DOMAIN_TYPE LAT lat +DOMAIN_TYPE LON lon +DOMAIN_TYPE MASK mask +DOMAIN_TYPE AREA area +DOMAIN_TYPE FRAC frac +DOMAIN_TYPE YDIM lat +DOMAIN_TYPE XDIM lon + ####################################################################### # Simulation Parameters Namelist ####################################################################### diff --git a/vic/drivers/image/include/vic_driver_image.h b/vic/drivers/image/include/vic_driver_image.h index a3017b47a..bfe64dde0 100644 --- a/vic/drivers/image/include/vic_driver_image.h +++ b/vic/drivers/image/include/vic_driver_image.h @@ -54,6 +54,19 @@ typedef struct { size_t local_idx; /**< index of grid cell in local list of grid cells */ } location_struct; +/****************************************************************************** + * @brief Structure to store information about the domain file. + *****************************************************************************/ +typedef struct { + char lat_var[MAXSTRING]; + char lon_var[MAXSTRING]; + char mask_var[MAXSTRING]; + char area_var[MAXSTRING]; + char frac_var[MAXSTRING]; + char y_dim[MAXSTRING]; + char x_dim[MAXSTRING]; + size_t n_coord_dims; +} domain_info_struct; /****************************************************************************** * @brief Structure to store local and global domain information. If the @@ -65,6 +78,7 @@ typedef struct { size_t n_nx; /**< size of x-index; */ size_t n_ny; /**< size of y-index */ location_struct *locations; /**< locations structs for local domain */ + domain_info_struct info; /**< structure storing domain file info */ } domain_struct; /****************************************************************************** @@ -138,6 +152,7 @@ double average(double *ar, size_t n); out_data_struct *create_output_list(void); void free_atmos(atmos_data_struct *atmos); void free_veg_hist(veg_hist_struct *veg_hist); +void get_domain_type(char *cmdstr); void get_force_type(char *cmdstr, int file_num, int *field); void get_forcing_file_info(param_set_struct *param_set, size_t file_num); size_t get_global_domain(char *fname, domain_struct *global_domain); diff --git a/vic/drivers/image/src/get_global_domain.c b/vic/drivers/image/src/get_global_domain.c index 8a0c27e32..b99695926 100644 --- a/vic/drivers/image/src/get_global_domain.c +++ b/vic/drivers/image/src/get_global_domain.c @@ -43,12 +43,9 @@ get_global_domain(char *nc_name, size_t d2start[2]; size_t d1count[1]; size_t d1start[1]; - extern option_struct options; - initialize_domain(global_domain); - - global_domain->n_nx = get_nc_dimension(nc_name, "lon"); - global_domain->n_ny = get_nc_dimension(nc_name, "lat"); + global_domain->n_nx = get_nc_dimension(nc_name, global_domain->info.x_dim); + global_domain->n_ny = get_nc_dimension(nc_name, global_domain->info.y_dim); d2start[0] = 0; d2start[1] = 0; @@ -64,7 +61,7 @@ get_global_domain(char *nc_name, log_err("Memory allocation error in get_global_domain()."); } - get_nc_field_int(nc_name, "mask", d2start, d2count, run); + get_nc_field_int(nc_name, global_domain->info.mask_var, d2start, d2count, run); for (i = 0; i < global_domain->ncells_total; i++) { if (run[i]) { @@ -103,15 +100,15 @@ get_global_domain(char *nc_name, } // Get number of lat/lon dimensions. - options.COORD_DIMS_OUT = get_nc_varndimensions(nc_name, - options.DOMAIN_LON_VAR); - if (options.COORD_DIMS_OUT != - get_nc_varndimensions(nc_name, options.DOMAIN_LAT_VAR)) { + global_domain->info.n_coord_dims = get_nc_varndimensions(nc_name, + global_domain->info.lon_var); + if (global_domain->info.n_coord_dims != + (size_t) get_nc_varndimensions(nc_name, global_domain->info.lat_var)) { log_err("Un even number of dimensions for %s and %s in: %s", - options.DOMAIN_LON_VAR, options.DOMAIN_LAT_VAR, nc_name); + global_domain->info.lon_var, global_domain->info.lat_var, nc_name); } - if (options.COORD_DIMS_OUT == 1) { + if (global_domain->info.n_coord_dims == 1) { double *varLon = NULL; double *varLat = NULL; @@ -129,7 +126,7 @@ get_global_domain(char *nc_name, d1count[0] = global_domain->n_nx; // get longitude for unmasked grid - get_nc_field_double(nc_name, options.DOMAIN_LON_VAR, + get_nc_field_double(nc_name, global_domain->info.lon_var, d1start, d1count, varLon); for (i = 0; i < global_domain->n_nx; i++) { // rescale to [-180., 180]. Note that the if statement is not strictly @@ -144,7 +141,7 @@ get_global_domain(char *nc_name, d1count[0] = global_domain->n_ny; // get latitude for unmasked grid - get_nc_field_double(nc_name, options.DOMAIN_LAT_VAR, + get_nc_field_double(nc_name, global_domain->info.lat_var, d1start, d1count, varLat); for (i = 0; i < global_domain->n_ny; i++) { global_domain->locations[i].latitude = (double) varLat[i]; @@ -153,9 +150,9 @@ get_global_domain(char *nc_name, free(varLon); free(varLat); } - else if (options.COORD_DIMS_OUT == 2) { + else if (global_domain->info.n_coord_dims == 2) { // get longitude for unmasked grid - get_nc_field_double(nc_name, options.DOMAIN_LON_VAR, + get_nc_field_double(nc_name, global_domain->info.lon_var, d2start, d2count, var); for (i = 0; i < global_domain->ncells_total; i++) { // rescale to [-180., 180]. Note that the if statement is not strictly @@ -167,7 +164,7 @@ get_global_domain(char *nc_name, } // get latitude for unmasked grid - get_nc_field_double(nc_name, options.DOMAIN_LAT_VAR, + get_nc_field_double(nc_name, global_domain->info.lat_var, d2start, d2count, var); for (i = 0; i < global_domain->ncells_total; i++) { global_domain->locations[i].latitude = (double) var[i]; @@ -175,12 +172,12 @@ get_global_domain(char *nc_name, } else { log_err("Number of dimensions for %s and %s should be 1 or 2 in: %s", - options.DOMAIN_LON_VAR, options.DOMAIN_LAT_VAR, nc_name); + global_domain->info.lon_var, global_domain->info.lat_var, nc_name); } // get area // TBD: read var id from file - get_nc_field_double(nc_name, "area", + get_nc_field_double(nc_name, global_domain->info.area_var, d2start, d2count, var); for (i = 0; i < global_domain->ncells_total; i++) { global_domain->locations[i].area = (double) var[i]; @@ -188,7 +185,7 @@ get_global_domain(char *nc_name, // get fraction // TBD: read var id from file - get_nc_field_double(nc_name, "frac", + get_nc_field_double(nc_name, global_domain->info.frac_var, d2start, d2count, var); for (i = 0; i < global_domain->ncells_total; i++) { global_domain->locations[i].frac = (double) var[i]; @@ -198,8 +195,6 @@ get_global_domain(char *nc_name, free(var); free(run); - // print_domain(global_domain, true); - return global_domain->ncells_active; } @@ -214,6 +209,16 @@ initialize_domain(domain_struct *domain) domain->n_nx = 0; domain->n_ny = 0; domain->locations = NULL; + + // Initialize domain info structure + strcpy(domain->info.lat_var, "MISSING"); + strcpy(domain->info.lon_var, "MISSING"); + strcpy(domain->info.mask_var, "MISSING"); + strcpy(domain->info.area_var, "MISSING"); + strcpy(domain->info.frac_var, "MISSING"); + strcpy(domain->info.y_dim, "MISSING"); + strcpy(domain->info.x_dim, "MISSING"); + domain->info.n_coord_dims = 0; } /****************************************************************************** @@ -262,3 +267,54 @@ add_nveg_to_global_domain(char *nc_name, free(dvar); } + +/****************************************************************************** + * @brief Parse the domain variable types. + *****************************************************************************/ +void +get_domain_type(char *cmdstr) +{ + extern domain_struct global_domain; + + char optstr[MAXSTRING]; + char ncvarname[MAXSTRING]; + int type; + + type = SKIP; + strcpy(ncvarname, "MISSING"); + + sscanf(cmdstr, "%*s %s %s", optstr, ncvarname); + + // Lattitude variable name + if (strcasecmp("LAT", optstr) == 0) { + strcpy(global_domain.info.lat_var, ncvarname); + } + // Longitude variable name + else if (strcasecmp("LON", optstr) == 0) { + strcpy(global_domain.info.lon_var, ncvarname); + } + // Mask variable name + else if (strcasecmp("MASK", optstr) == 0) { + strcpy(global_domain.info.mask_var, ncvarname); + } + // Area variable name + else if (strcasecmp("AREA", optstr) == 0) { + strcpy(global_domain.info.area_var, ncvarname); + } + // Fraction variable name + else if (strcasecmp("FRAC", optstr) == 0) { + strcpy(global_domain.info.frac_var, ncvarname); + } + // y dimension name + else if (strcasecmp("YDIM", optstr) == 0) { + strcpy(global_domain.info.y_dim, ncvarname); + } + // x dimension name + else if (strcasecmp("XDIM", optstr) == 0) { + strcpy(global_domain.info.x_dim, ncvarname); + } + else { + log_err("Unrecognized domain variable: %s %s", optstr, ncvarname); + } + +} diff --git a/vic/drivers/image/src/get_global_param.c b/vic/drivers/image/src/get_global_param.c index 5623ecaff..b92d8bf54 100644 --- a/vic/drivers/image/src/get_global_param.c +++ b/vic/drivers/image/src/get_global_param.c @@ -428,6 +428,9 @@ get_global_param(FILE *gp) else if (strcasecmp("DOMAIN", optstr) == 0) { sscanf(cmdstr, "%*s %s", filenames.domain); } + else if (strcasecmp("DOMAIN_TYPE", optstr) == 0) { + get_domain_type(cmdstr); + } else if (strcasecmp("SOIL", optstr) == 0) { sscanf(cmdstr, "%*s %s", filenames.soil); } @@ -594,12 +597,6 @@ get_global_param(FILE *gp) else if (strcasecmp("SKIPYEAR", optstr) == 0) { sscanf(cmdstr, "%*s %hu", &global_param.skipyear); } - else if (strcasecmp("DOMAIN_LON_VAR", optstr) == 0) { - sscanf(cmdstr, "%*s %s", options.DOMAIN_LON_VAR); - } - else if (strcasecmp("DOMAIN_LAT_VAR", optstr) == 0) { - sscanf(cmdstr, "%*s %s", options.DOMAIN_LAT_VAR); - } else if (strcasecmp("ALMA_OUTPUT", optstr) == 0) { sscanf(cmdstr, "%*s %s", flgstr); if (strcasecmp("TRUE", flgstr) == 0) { diff --git a/vic/drivers/image/src/vic_init_output.c b/vic/drivers/image/src/vic_init_output.c index b0701f795..1b746bf96 100644 --- a/vic/drivers/image/src/vic_init_output.c +++ b/vic/drivers/image/src/vic_init_output.c @@ -175,7 +175,7 @@ initialize_history_file(nc_file_struct *nc) log_err("Error defining nlayer dimenension in %s", nc->fname); } - if (options.COORD_DIMS_OUT == 1) { + if (global_domain.info.n_coord_dims == 1) { status = nc_def_dim(nc->nc_id, "lon", nc->ni_size, &(nc->ni_dimid)); @@ -189,7 +189,7 @@ initialize_history_file(nc_file_struct *nc) log_err("Error defining ni dimenension in %s", nc->fname); } - if (options.COORD_DIMS_OUT == 1) { + if (global_domain.info.n_coord_dims == 1) { status = nc_def_dim(nc->nc_id, "lat", nc->nj_size, &(nc->nj_dimid)); @@ -301,15 +301,15 @@ initialize_history_file(nc_file_struct *nc) log_err("Error adding attribute in %s", nc->fname); } - ndims = options.COORD_DIMS_OUT; + ndims = global_domain.info.n_coord_dims; dstart[0] = 0; dstart[1] = 0; - if (options.COORD_DIMS_OUT == 1) { + if (global_domain.info.n_coord_dims == 1) { dimids[0] = nc->ni_dimid; dcount[0] = nc->ni_size; } - else if (options.COORD_DIMS_OUT == 2) { + else if (global_domain.info.n_coord_dims == 2) { dimids[0] = nc->nj_dimid; dcount[0] = nc->nj_size; @@ -317,11 +317,11 @@ initialize_history_file(nc_file_struct *nc) dcount[1] = nc->ni_size; } else { - log_err("COORD_DIMS_OUT should be 1 or 2"); + log_err("n_coord_dims should be 1 or 2"); } // define the netcdf variable longitude - status = nc_def_var(nc->nc_id, options.DOMAIN_LON_VAR, NC_DOUBLE, ndims, + status = nc_def_var(nc->nc_id, global_domain.info.lon_var, NC_DOUBLE, ndims, dimids, &(lon_var_id)); if (status != NC_NOERR) { log_err("Error defining lon variable in %s", nc->fname); @@ -343,13 +343,13 @@ initialize_history_file(nc_file_struct *nc) log_err("Error adding attribute in %s", nc->fname); } - if (options.COORD_DIMS_OUT == 1) { + if (global_domain.info.n_coord_dims == 1) { dimids[0] = nc->nj_dimid; dcount[0] = nc->nj_size; } // define the netcdf variable latitude - status = nc_def_var(nc->nc_id, options.DOMAIN_LAT_VAR, NC_DOUBLE, ndims, + status = nc_def_var(nc->nc_id, global_domain.info.lat_var, NC_DOUBLE, ndims, dimids, &(lat_var_id)); if (status != NC_NOERR) { log_err("Error defining lat variable in %s", nc->fname); @@ -377,7 +377,7 @@ initialize_history_file(nc_file_struct *nc) } // fill the netcdf variables lat/lon - if (options.COORD_DIMS_OUT == 1) { + if (global_domain.info.n_coord_dims == 1) { dvar = calloc(nc->ni_size, sizeof(*dvar)); dcount[0] = nc->ni_size; @@ -405,7 +405,7 @@ initialize_history_file(nc_file_struct *nc) } free(dvar); } - else if (options.COORD_DIMS_OUT == 2) { + else if (global_domain.info.n_coord_dims == 2) { dvar = calloc(nc->nj_size * nc->ni_size, sizeof(*dvar)); for (i = 0; i < nc->nj_size * nc->ni_size; i++) { @@ -429,6 +429,6 @@ initialize_history_file(nc_file_struct *nc) free(dvar); } else { - log_err("COORD_DIMS_OUT should be 1 or 2"); + log_err("n_coord_dims should be 1 or 2"); } } diff --git a/vic/drivers/image/src/vic_start.c b/vic/drivers/image/src/vic_start.c index 4111f2ba6..cd36c5d0c 100644 --- a/vic/drivers/image/src/vic_start.c +++ b/vic/drivers/image/src/vic_start.c @@ -66,6 +66,9 @@ vic_start(void) initialize_filenames(); if (mpi_rank == 0) { + // Initialize the global domain + initialize_domain(&global_domain); + // read global settings filep.globalparam = open_file(filenames.global, "r"); get_global_param(filep.globalparam); diff --git a/vic/vic_run/include/vic_def.h b/vic/vic_run/include/vic_def.h index 838c84a4f..d3b74541b 100644 --- a/vic/vic_run/include/vic_def.h +++ b/vic/vic_run/include/vic_def.h @@ -315,9 +315,6 @@ typedef struct { bool COMPRESS; /**< TRUE = Compress all output files */ bool MOISTFRACT; /**< TRUE = output soil moisture as fractional moisture content */ size_t Noutfiles; /**< Number of output files (not including state files) */ - int COORD_DIMS_OUT; /**< Number of output dimensions for lat and lon variables. COORD_DIMS_OUT 1 = lon(lon), lat(lat). COORD_DIMS_OUT 2 = lon(xc, yc), lat(xc, yc) */ - char DOMAIN_LON_VAR[MAXSTRING]; /**< Name of the variable and the dimension of longitude in the output file */ - char DOMAIN_LAT_VAR[MAXSTRING]; /**< Name of the variable and the dimension of latitude in the output file */ bool PRT_HEADER; /**< TRUE = insert header at beginning of output file; FALSE = no header */ bool PRT_SNOW_BAND; /**< TRUE = print snow parameters for each snow band. This is only used when default output files are used (for backwards-compatibility); if outfiles and From 020bcb457a07c62751cad1e281b1c2ff638e194d Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Tue, 2 Feb 2016 12:37:25 -0800 Subject: [PATCH 06/13] port count force vars to image driver, now in driver shared, fixed a few other merge bugs --- .../classic/include/vic_driver_classic.h | 1 - vic/drivers/classic/src/get_force_type.c | 48 ------------------- vic/drivers/image/src/get_force_type.c | 8 ++-- vic/drivers/image/src/get_global_param.c | 4 ++ .../shared/include/vic_driver_shared.h | 1 + vic/drivers/shared/src/forcing_utils.c | 47 ++++++++++++++++++ 6 files changed, 57 insertions(+), 52 deletions(-) diff --git a/vic/drivers/classic/include/vic_driver_classic.h b/vic/drivers/classic/include/vic_driver_classic.h index 575509ea3..961a109a2 100644 --- a/vic/drivers/classic/include/vic_driver_classic.h +++ b/vic/drivers/classic/include/vic_driver_classic.h @@ -41,7 +41,6 @@ double calc_netshort(double, int, double, double *); void check_files(filep_struct *, filenames_struct *); FILE *check_state_file(char *, size_t, size_t, int *); void close_files(filep_struct *, out_data_file_struct *, filenames_struct *); -size_t count_force_vars(FILE *gp); size_t count_n_outfiles(FILE *gp); size_t count_outfile_nvars(FILE *gp); out_data_struct *create_output_list(); diff --git a/vic/drivers/classic/src/get_force_type.c b/vic/drivers/classic/src/get_force_type.c index 6430a1c7d..60a4d6d79 100644 --- a/vic/drivers/classic/src/get_force_type.c +++ b/vic/drivers/classic/src/get_force_type.c @@ -147,51 +147,3 @@ get_force_type(char *cmdstr, (*field)++; } - - -/****************************************************************************** - * @brief This routine determines the counts the number of forcing variables - in each forcing file specified in the global parameter file. - *****************************************************************************/ -size_t -count_force_vars(FILE *gp) -{ - size_t nvars; - unsigned long start_position; - char cmdstr[MAXSTRING]; - char optstr[MAXSTRING]; - - // Figure out where we are in the input file - fflush(gp); - start_position = ftell(gp); - - // read the first line - fgets(cmdstr, MAXSTRING, gp); - - // initalize nvars - nvars = 0; - - // Loop through the lines - while (!feof(gp)) { - if (cmdstr[0] != '#' && cmdstr[0] != '\n' && cmdstr[0] != '\0') { - // line is not blank or a comment - sscanf(cmdstr, "%s", optstr); - - // if the line starts with FORCE_TYPE - if (strcasecmp("FORCE_TYPE", optstr) == 0) { - nvars++; - } - // else if we arive at another forcing file break out of loop - else if (strcasecmp("FORCING1", optstr) == 0 || - strcasecmp("FORCING2", optstr) == 0) { - break; - } - } - fgets(cmdstr, MAXSTRING, gp); - } - - // put the position in the file back to where we started - fseek(gp, start_position, SEEK_SET); - - return nvars; -} diff --git a/vic/drivers/image/src/get_force_type.c b/vic/drivers/image/src/get_force_type.c index c593a10fd..87867a9cb 100644 --- a/vic/drivers/image/src/get_force_type.c +++ b/vic/drivers/image/src/get_force_type.c @@ -52,7 +52,9 @@ get_force_type(char *cmdstr, strcpy(flgstr, "NULL"); if ((*field) >= (int) param_set.N_TYPES[file_num]) { - log_err("Too many variables defined for forcing file %i.", file_num); + log_err("Too many variables defined for forcing file %i., was " + "expecting at most %zu and got %d", file_num + 1, + param_set.N_TYPES[file_num], *field); } sscanf(cmdstr, "%*s %s %s", optstr, ncvarname); @@ -126,7 +128,7 @@ get_force_type(char *cmdstr, /** Undefined variable type **/ else { log_err("Undefined forcing variable type %s in file %i.", - optstr, file_num); + optstr, file_num + 1); } param_set.TYPE[type].SUPPLIED = file_num + 1; @@ -137,7 +139,7 @@ get_force_type(char *cmdstr, } else { log_err("Must suply netCDF variable name for %s forcing file number %d", - optstr, file_num); + optstr, file_num + 1); } param_set.TYPE[type].N_ELEM = 1; diff --git a/vic/drivers/image/src/get_global_param.c b/vic/drivers/image/src/get_global_param.c index f8974d8b5..3120817b9 100644 --- a/vic/drivers/image/src/get_global_param.c +++ b/vic/drivers/image/src/get_global_param.c @@ -403,6 +403,8 @@ get_global_param(FILE *gp) sscanf(cmdstr, "%*s %s", filenames.f_path_pfx[0]); file_num = 0; field = 0; + // count the number of forcing variables in this file + param_set.N_TYPES[file_num] = count_force_vars(gp); } else if (strcasecmp("FORCING2", optstr) == 0) { sscanf(cmdstr, "%*s %s", filenames.f_path_pfx[1]); @@ -411,6 +413,8 @@ get_global_param(FILE *gp) } file_num = 1; field = 0; + // count the number of forcing variables in this file + param_set.N_TYPES[file_num] = count_force_vars(gp); } else if (strcasecmp("FORCE_TYPE", optstr) == 0) { get_force_type(cmdstr, file_num, &field); diff --git a/vic/drivers/shared/include/vic_driver_shared.h b/vic/drivers/shared/include/vic_driver_shared.h index 070e5835b..682d42b7c 100644 --- a/vic/drivers/shared/include/vic_driver_shared.h +++ b/vic/drivers/shared/include/vic_driver_shared.h @@ -449,6 +449,7 @@ void collect_wb_terms(cell_data_struct, veg_var_struct, snow_data_struct, double *, out_data_struct *); void compute_treeline(atmos_data_struct *, dmy_struct *, double, double *, bool *); +size_t count_force_vars(FILE *gp); void cmd_proc(int argc, char **argv, char *globalfilename); void compress_files(char string[]); out_data_struct *create_output_list(void); diff --git a/vic/drivers/shared/src/forcing_utils.c b/vic/drivers/shared/src/forcing_utils.c index cde65e52b..841b39523 100644 --- a/vic/drivers/shared/src/forcing_utils.c +++ b/vic/drivers/shared/src/forcing_utils.c @@ -121,3 +121,50 @@ will_it_snow(double *t, return 0; } + +/****************************************************************************** + * @brief This routine determines the counts the number of forcing variables + in each forcing file specified in the global parameter file. + *****************************************************************************/ +size_t +count_force_vars(FILE *gp) +{ + size_t nvars; + unsigned long start_position; + char cmdstr[MAXSTRING]; + char optstr[MAXSTRING]; + + // Figure out where we are in the input file + fflush(gp); + start_position = ftell(gp); + + // read the first line + fgets(cmdstr, MAXSTRING, gp); + + // initalize nvars + nvars = 0; + + // Loop through the lines + while (!feof(gp)) { + if (cmdstr[0] != '#' && cmdstr[0] != '\n' && cmdstr[0] != '\0') { + // line is not blank or a comment + sscanf(cmdstr, "%s", optstr); + + // if the line starts with FORCE_TYPE + if (strcasecmp("FORCE_TYPE", optstr) == 0) { + nvars++; + } + // else if we arive at another forcing file break out of loop + else if (strcasecmp("FORCING1", optstr) == 0 || + strcasecmp("FORCING2", optstr) == 0) { + break; + } + } + fgets(cmdstr, MAXSTRING, gp); + } + + // put the position in the file back to where we started + fseek(gp, start_position, SEEK_SET); + + return nvars; +} From 910b7471bb150ecd83d8755644b251b97bac7a4d Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Tue, 2 Feb 2016 14:05:42 -0800 Subject: [PATCH 07/13] first round of code review changes, adding functionality to force_ncvars --- vic/drivers/classic/src/parse_output_info.c | 18 ++++--- vic/drivers/image/src/get_force_type.c | 8 +-- vic/drivers/image/src/get_global_domain.c | 59 +++++++++++---------- vic/drivers/image/src/get_nc_var_attr.c | 9 ++-- vic/drivers/image/src/vic_force.c | 1 - vic/drivers/image/src/vic_init_output.c | 27 +++------- 6 files changed, 55 insertions(+), 67 deletions(-) diff --git a/vic/drivers/classic/src/parse_output_info.c b/vic/drivers/classic/src/parse_output_info.c index c7fd4922e..c16246706 100644 --- a/vic/drivers/classic/src/parse_output_info.c +++ b/vic/drivers/classic/src/parse_output_info.c @@ -86,18 +86,21 @@ parse_output_info(FILE *gp, "%zu but found %hu", options.Noutfiles, outfilenum); } - sscanf(cmdstr, "%*s %s", (*out_data_files)[outfilenum].prefix); + sscanf(cmdstr, "%*s %s", + (*out_data_files)[outfilenum].prefix); // determine how many variable will be in this file before // allocating (GH: 209) - (*out_data_files)[outfilenum].nvars = count_outfile_nvars(gp); + (*out_data_files)[outfilenum].nvars = + count_outfile_nvars(gp); (*out_data_files)[outfilenum].varid = calloc((*out_data_files)[outfilenum].nvars, sizeof(*((*out_data_files)[outfilenum].varid))); - if ((*out_data_files)[outfilenum].varid == NULL) { - log_err("Memory allocation error in parse_output_info()."); - } + if ((*out_data_files)[outfilenum].varid == NULL) { + log_err( + "Memory allocation error in parse_output_info()."); + } outvarnum = 0; } else if (strcasecmp("OUTVAR", optstr) == 0) { @@ -139,7 +142,8 @@ parse_output_info(FILE *gp, } } if (set_output_var((*out_data_files), true, outfilenum, - out_data, varname, outvarnum, format, type, + out_data, varname, outvarnum, format, + type, mult) != 0) { log_err("Invalid output variable specification."); } @@ -153,7 +157,6 @@ parse_output_info(FILE *gp, fclose(gp); } - /****************************************************************************** * @brief This routine determines the counts the number of output variables in each output file specified in the global parameter file. @@ -199,7 +202,6 @@ count_outfile_nvars(FILE *gp) return nvars; } - /****************************************************************************** * @brief This routine determines the counts the number of output files specified in the global parameter file. diff --git a/vic/drivers/image/src/get_force_type.c b/vic/drivers/image/src/get_force_type.c index 87867a9cb..e13429742 100644 --- a/vic/drivers/image/src/get_force_type.c +++ b/vic/drivers/image/src/get_force_type.c @@ -43,9 +43,8 @@ get_force_type(char *cmdstr, char optstr[MAXSTRING]; char flgstr[MAXSTRING]; char ncvarname[MAXSTRING]; - int type; + int type = SKIP; - type = SKIP; strcpy(ncvarname, "MISSING"); /** Initialize flgstr **/ @@ -138,8 +137,9 @@ get_force_type(char *cmdstr, strcpy(param_set.TYPE[type].varname, ncvarname); } else { - log_err("Must suply netCDF variable name for %s forcing file number %d", - optstr, file_num + 1); + log_err( + "Must supply netCDF variable name for %s forcing file number %d", + optstr, file_num + 1); } param_set.TYPE[type].N_ELEM = 1; diff --git a/vic/drivers/image/src/get_global_domain.c b/vic/drivers/image/src/get_global_domain.c index b99695926..5379b40d6 100644 --- a/vic/drivers/image/src/get_global_domain.c +++ b/vic/drivers/image/src/get_global_domain.c @@ -35,14 +35,16 @@ size_t get_global_domain(char *nc_name, domain_struct *global_domain) { - int *run = NULL; - double *var = NULL; - size_t i; - size_t j; - size_t d2count[2]; - size_t d2start[2]; - size_t d1count[1]; - size_t d1start[1]; + int *run = NULL; + double *var = NULL; + double *var_lon = NULL; + double *var_lat = NULL; + size_t i; + size_t j; + size_t d2count[2]; + size_t d2start[2]; + size_t d1count[1]; + size_t d1start[1]; global_domain->n_nx = get_nc_dimension(nc_name, global_domain->info.x_dim); global_domain->n_ny = get_nc_dimension(nc_name, global_domain->info.y_dim); @@ -61,7 +63,8 @@ get_global_domain(char *nc_name, log_err("Memory allocation error in get_global_domain()."); } - get_nc_field_int(nc_name, global_domain->info.mask_var, d2start, d2count, run); + get_nc_field_int(nc_name, global_domain->info.mask_var, d2start, d2count, + run); for (i = 0; i < global_domain->ncells_total; i++) { if (run[i]) { @@ -101,24 +104,22 @@ get_global_domain(char *nc_name, // Get number of lat/lon dimensions. global_domain->info.n_coord_dims = get_nc_varndimensions(nc_name, - global_domain->info.lon_var); + global_domain->info.lon_var); if (global_domain->info.n_coord_dims != (size_t) get_nc_varndimensions(nc_name, global_domain->info.lat_var)) { log_err("Un even number of dimensions for %s and %s in: %s", - global_domain->info.lon_var, global_domain->info.lat_var, nc_name); + global_domain->info.lon_var, global_domain->info.lat_var, + nc_name); } if (global_domain->info.n_coord_dims == 1) { - double *varLon = NULL; - double *varLat = NULL; - // allocate memory for variables - varLon = malloc(global_domain->n_nx * sizeof(*varLon)); - if (varLon == NULL) { + var_lon = malloc(global_domain->n_nx * sizeof(*var_lon)); + if (var_lon == NULL) { log_err("Memory allocation error in get_global_domain()."); } - varLat = malloc(global_domain->n_ny * sizeof(*varLat)); - if (varLat == NULL) { + var_lat = malloc(global_domain->n_ny * sizeof(*var_lat)); + if (var_lat == NULL) { log_err("Memory allocation error in get_global_domain()."); } @@ -127,14 +128,14 @@ get_global_domain(char *nc_name, // get longitude for unmasked grid get_nc_field_double(nc_name, global_domain->info.lon_var, - d1start, d1count, varLon); + d1start, d1count, var_lon); for (i = 0; i < global_domain->n_nx; i++) { // rescale to [-180., 180]. Note that the if statement is not strictly // needed, but it prevents -180 from turning into 180 and vice versa if (var[i] < -180.f || var[i] > 180.f) { var[i] -= round(var[i] / 360.f) * 360.f; } - global_domain->locations[i].longitude = (double) varLon[i]; + global_domain->locations[i].longitude = (double) var_lon[i]; } d1start[0] = 0; @@ -142,13 +143,13 @@ get_global_domain(char *nc_name, // get latitude for unmasked grid get_nc_field_double(nc_name, global_domain->info.lat_var, - d1start, d1count, varLat); + d1start, d1count, var_lat); for (i = 0; i < global_domain->n_ny; i++) { - global_domain->locations[i].latitude = (double) varLat[i]; + global_domain->locations[i].latitude = (double) var_lat[i]; } - free(varLon); - free(varLat); + free(var_lon); + free(var_lat); } else if (global_domain->info.n_coord_dims == 2) { // get longitude for unmasked grid @@ -172,7 +173,8 @@ get_global_domain(char *nc_name, } else { log_err("Number of dimensions for %s and %s should be 1 or 2 in: %s", - global_domain->info.lon_var, global_domain->info.lat_var, nc_name); + global_domain->info.lon_var, global_domain->info.lat_var, + nc_name); } // get area @@ -276,9 +278,9 @@ get_domain_type(char *cmdstr) { extern domain_struct global_domain; - char optstr[MAXSTRING]; - char ncvarname[MAXSTRING]; - int type; + char optstr[MAXSTRING]; + char ncvarname[MAXSTRING]; + int type; type = SKIP; strcpy(ncvarname, "MISSING"); @@ -316,5 +318,4 @@ get_domain_type(char *cmdstr) else { log_err("Unrecognized domain variable: %s %s", optstr, ncvarname); } - } diff --git a/vic/drivers/image/src/get_nc_var_attr.c b/vic/drivers/image/src/get_nc_var_attr.c index a19c133fa..f21c81788 100644 --- a/vic/drivers/image/src/get_nc_var_attr.c +++ b/vic/drivers/image/src/get_nc_var_attr.c @@ -32,9 +32,9 @@ * @brief Get netCDF dimension. *****************************************************************************/ void -get_nc_var_attr(char *nc_name, - char *var_name, - char *attr_name, +get_nc_var_attr(char *nc_name, + char *var_name, + char *attr_name, char **attr) { int nc_id; @@ -57,7 +57,8 @@ get_nc_var_attr(char *nc_name, // get size of the attribute status = nc_inq_attlen(nc_id, var_id, attr_name, &attr_len); if (status != NC_NOERR) { - log_err("Error getting attribute length for %s:%s in %s", var_name, attr_name, nc_name); + log_err("Error getting attribute length for %s:%s in %s", var_name, + attr_name, nc_name); } // allocate memory for attribute diff --git a/vic/drivers/image/src/vic_force.c b/vic/drivers/image/src/vic_force.c index 813b55170..86f133371 100644 --- a/vic/drivers/image/src/vic_force.c +++ b/vic/drivers/image/src/vic_force.c @@ -477,5 +477,4 @@ get_forcing_file_info(param_set_struct *param_set, // Free attribute character arrays free(nc_unit_chars); free(calendar_char); - } diff --git a/vic/drivers/image/src/vic_init_output.c b/vic/drivers/image/src/vic_init_output.c index 1b746bf96..4953e28d2 100644 --- a/vic/drivers/image/src/vic_init_output.c +++ b/vic/drivers/image/src/vic_init_output.c @@ -175,32 +175,17 @@ initialize_history_file(nc_file_struct *nc) log_err("Error defining nlayer dimenension in %s", nc->fname); } - if (global_domain.info.n_coord_dims == 1) { - status = - nc_def_dim(nc->nc_id, "lon", nc->ni_size, - &(nc->ni_dimid)); - } - else { - nc_def_dim(nc->nc_id, "ni", nc->ni_size, - &(nc->ni_dimid)); - } + status = nc_def_dim(nc->nc_id, global_domain.info.x_dim, nc->ni_size, + &(nc->ni_dimid)); if (status != NC_NOERR) { - log_err("Error defining ni dimenension in %s", nc->fname); + log_err("Error defining x dimenension in %s", nc->fname); } + status = nc_def_dim(nc->nc_id, global_domain.info.y_dim, nc->nj_size, + &(nc->nj_dimid)); - if (global_domain.info.n_coord_dims == 1) { - status = - nc_def_dim(nc->nc_id, "lat", nc->nj_size, - &(nc->nj_dimid)); - } - else { - status = - nc_def_dim(nc->nc_id, "nj", nc->nj_size, - &(nc->nj_dimid)); - } if (status != NC_NOERR) { - log_err("Error defining nj dimenension in %s", nc->fname); + log_err("Error defining y dimenension in %s", nc->fname); } status = nc_def_dim(nc->nc_id, "node", nc->node_size, &(nc->node_dimid)); From b76600177afbf5ad86cc41471715cab5f63e9b4a Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Mon, 8 Feb 2016 10:25:52 -0800 Subject: [PATCH 08/13] add sample data download script --- samples/get_sample_data.bash | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 samples/get_sample_data.bash diff --git a/samples/get_sample_data.bash b/samples/get_sample_data.bash new file mode 100755 index 000000000..432b25796 --- /dev/null +++ b/samples/get_sample_data.bash @@ -0,0 +1,16 @@ +#! /usr/bin/env bash + +set -e + +# save a few directory names +CWD=$PWD +SAMPLES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +# Get the sample data +cd $SAMPLES/VIC_sample_data +git fetch origin +# TODO - get data branch/tag that aligns with the state of the VIC repo. +git checkout master + +# back to the original directory +cd $CWD From 1d45452711ade64520f2e426ca670e902c07bcc2 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Mon, 8 Feb 2016 11:59:33 -0800 Subject: [PATCH 09/13] add samples README --- samples/README.md | 31 +++++++++++++++++++++++++++++++ samples/get_sample_data.bash | 5 +++++ 2 files changed, 36 insertions(+) create mode 100644 samples/README.md diff --git a/samples/README.md b/samples/README.md new file mode 100644 index 000000000..37dd6fb0c --- /dev/null +++ b/samples/README.md @@ -0,0 +1,31 @@ +VIC Sample Data +=============== + +This directory includes complete sample datasets to run VIC. Sample datasets that are currently included in the VIC source code repository: + +## Image Driver +1. Stehekin - 10-days of forcings + +## Classic Driver + +*In progress* + +1. Stehekin +1. Rosemount + +## Summary of Datasets: +1. Stehekin: This is a distributed datasets that covers the entire Stehekin River Basin, located in Washington State, USA. +1. Rosemount: This is a single point dataset from Rosemount site, Illinois, USA. + +## Getting the Datasets: +The VIC sample datasets are in a "git submodule", to download the datasets to this directory, simply run the following command: + +``` +./get_sample_data.bash +``` + +You may also download the sample data to another location on your computer using the following command: + +``` +git clone https://github.com/jhamman/VIC_sample_data.git +``` diff --git a/samples/get_sample_data.bash b/samples/get_sample_data.bash index 432b25796..82d4c3b9f 100755 --- a/samples/get_sample_data.bash +++ b/samples/get_sample_data.bash @@ -14,3 +14,8 @@ git checkout master # back to the original directory cd $CWD + +# Check that the +if [ ! -d "~/workdir" ]; then + echo "WARNING: `~/workdir` does not exist. Sample data will not run without modifying the global parameter file." +fi From 786e968df980f0bf85cedf93939416e5b947dec9 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Mon, 8 Feb 2016 12:21:45 -0800 Subject: [PATCH 10/13] update sample data --- samples/VIC_sample_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/VIC_sample_data b/samples/VIC_sample_data index 8de9ea08f..db0b320a1 160000 --- a/samples/VIC_sample_data +++ b/samples/VIC_sample_data @@ -1 +1 @@ -Subproject commit 8de9ea08f360c633c237a8da8d5efabfb660f81a +Subproject commit db0b320a128fb7592c7ad42a92aa17d256b7a414 From 87ccdf2afdbe80fabaf82e9da9052c2e35109ec2 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Tue, 16 Feb 2016 14:49:16 -0800 Subject: [PATCH 11/13] updates after @bartnijssen review --- docs/Development/ReleaseNotes.md | 21 ++++++++++++------- .../Drivers/Classic/ForcingData.md | 4 ++-- docs/Documentation/OutputVarList.md | 12 +++++------ vic/drivers/classic/src/get_force_type.c | 10 ++++----- vic/drivers/classic/src/vic_force.c | 8 +++---- vic/drivers/classic/src/write_forcing_file.c | 4 ++-- vic/drivers/image/include/vic_driver_image.h | 2 +- vic/drivers/image/src/get_global_param.c | 2 +- .../{get_force_type.c => set_force_type.c} | 12 +++++------ vic/drivers/image/src/vic_force.c | 4 ++-- vic/drivers/image/src/vic_nc_info.c | 14 ++++++------- vic/drivers/python/vic_headers.py | 16 +++++++------- .../shared/include/vic_driver_shared.h | 16 +++++++------- vic/drivers/shared/src/output_list_utils.c | 16 +++++++------- vic/drivers/shared/src/put_data.c | 20 +++++++++--------- 15 files changed, 80 insertions(+), 81 deletions(-) rename vic/drivers/image/src/{get_force_type.c => set_force_type.c} (93%) diff --git a/docs/Development/ReleaseNotes.md b/docs/Development/ReleaseNotes.md index a6e20f68e..34cc20de6 100644 --- a/docs/Development/ReleaseNotes.md +++ b/docs/Development/ReleaseNotes.md @@ -76,16 +76,16 @@ This is a major update from VIC 4. The VIC 5.0.0 release aims to have nearly ide Computation of potential evapotranspiration (PET) has been simplified, reducing the number of output variables from 6 to 1. The following output variables have been removed: - - 'OUT_PET_SATSOIL' (potential evap from saturated bare soil) - - 'OUT_PET_H2OSURF' (potential evap from open water) - - 'OUT_PET_SHORT' (potential evap (transpiration only) from short reference crop (grass)) - - 'OUT_PET_TALL' (potential evap (transpiration only) from tall reference crop (alfalfa)) - - 'OUT_PET_NATVEG' (potential evap (transpiration only) from current vegetation and current canopy resistance) - - 'OUT_PET_VEGNOCR' (potential evap (transpiration only) from current vegetation and 0 canopy resistance) + - `OUT_PET_SATSOIL` (potential evap from saturated bare soil) + - `OUT_PET_H2OSURF` (potential evap from open water) + - `OUT_PET_SHORT` (potential evap (transpiration only) from short reference crop (grass)) + - `OUT_PET_TALL` (potential evap (transpiration only) from tall reference crop (alfalfa)) + - `OUT_PET_NATVEG` (potential evap (transpiration only) from current vegetation and current canopy resistance) + - `OUT_PET_VEGNOCR` (potential evap (transpiration only) from current vegetation and 0 canopy resistance) - These have been replaced by: + These have been replaced by: - - 'OUT_PET' (potential evapotranspiration, which = area-weighted sum of potential transpiration and potential soil evaporation; potential transpiration is computed using the Penman-Monteith eqn with architectural resistance and LAI of the current veg cover) + - `OUT_PET` (potential evapotranspiration, which = area-weighted sum of potential transpiration and potential soil evaporation; potential transpiration is computed using the Penman-Monteith eqn with architectural resistance and LAI of the current veg cover) #### Deprecated Features: @@ -102,6 +102,11 @@ This is a major update from VIC 4. The VIC 5.0.0 release aims to have nearly ide - `OUTPUT_FORCE` We are providing a stand-alone version of MTCLIM that produces subdaily VIC meteorological forcings. That tool is available [here](http://mtclim.readthedocs.org). +3. Removed `LONGWAVE` and `SHORTWAVE` forcing types ([GH#379](https://github.com/UW-Hydro/VIC/pull/379)). + + Previous versions of VIC allowed users to specify either `LONGWAVE` or `LWDOWN` to denote the incoming longwave radiation flux and `SHORTWAVE` or `SWDOWN` to denote the incoming shorwave radiation flux. We have removed these duplicate options, standardizing on the more descriptive `LWDOWN` and `SWDOWN`. + + Similarly, output variables `OUT_NET_LONG` and `OUT_NET_SHORT` have been replaced with `OUT_LWNET` and `OUT_SWNET`, respectively. #### Bug Fixes: diff --git a/docs/Documentation/Drivers/Classic/ForcingData.md b/docs/Documentation/Drivers/Classic/ForcingData.md index fc285fe46..504b4a5a5 100644 --- a/docs/Documentation/Drivers/Classic/ForcingData.md +++ b/docs/Documentation/Drivers/Classic/ForcingData.md @@ -9,8 +9,8 @@ The VIC Classic Driver requires subdaily forcings (meteorological or other). Th | AIR_TEMP | Average air temperature | C | | PREC | Total precipitation (rain and snow) | mm | | PRESSURE | Atmospheric pressure | kPa | -| SHORTWAVE | Incoming shortwave | W/m2 | -| LONGWAVE | Incoming longwave radiation | W/m2 | +| SWDOWN | Incoming shortwave radiation | W/m2 | +| LWDOWN | Incoming longwave radiation | W/m2 | | VP | Vapor pressure | kPa | | WIND | Wind speed | m/s | diff --git a/docs/Documentation/OutputVarList.md b/docs/Documentation/OutputVarList.md index 8800c7f78..c050e95fa 100644 --- a/docs/Documentation/OutputVarList.md +++ b/docs/Documentation/OutputVarList.md @@ -118,8 +118,8 @@ Using options within the *global parameter file*, any combination of the variabl | OUT_LATENT | Net upward latent heat flux | W/m2 | | OUT_LATENT_SUB | Net upward latent heat flux from sublimation | W/m2 | | OUT_MELT_ENERGY | Energy of fusion (melting) in snowpack | W/m2 | -| OUT_NET_LONG | Net downward longwave flux | W/m2 | -| OUT_NET_SHORT | Net downward shortwave flux | W/m2 | +| OUT_LWNET | Net downward longwave flux | W/m2 | +| OUT_SWNET | Net downward shortwave flux | W/m2 | | OUT_R_NET | Net downward radiation flux | W/m2 | | OUT_RFRZ_ENERGY | Net energy used to refreeze liquid water in snowpack | W/m2 | | OUT_SENSIBLE | Net upward sensible heat flux | W/m2 | @@ -137,11 +137,11 @@ Using options within the *global parameter file*, any combination of the variabl | OUT_DENSITY | Near-surface atmospheric density | kg/m3 | | OUT_FDIR | fraction of incoming shortwave that is direct | fraction | | OUT_LAI | Leaf Area Index | fraction | -| OUT_LONGWAVE | Incoming longwave | W/m2 | +| OUT_LWDOWN | Incoming longwave | W/m2 | | OUT_PRESSURE | Near surface atmospheric pressure | kPa (ALMA_OUTPUT: Pa) | | OUT_QAIR | Specific humidity | kg/kg | | OUT_REL_HUMID | Relative humidity | fraction | -| OUT_SHORTWAVE | Incoming shortwave | W/m2 | +| OUT_SWDOWN | Incoming shortwave | W/m2 | | OUT_SURF_COND | Surface conductance | m/s | | OUT_TSKC | (release 4.1.2 and later) Cloud fraction | fraction | | OUT_VEGCOVER | Partial vegetation cover fraction | fraction | @@ -161,8 +161,8 @@ Using options within the *global parameter file*, any combination of the variabl | OUT_LATENT_BAND | Net upward latent heat flux | W/m2 | | OUT_LATENT_SUB_BAND | Net upward latent heat flux due to sublimation | W/m2 | | OUT_MELT_ENERGY_BAND | Energy of fusion (melting) in snowpack | W/m2 | -| OUT_NET_LONG_BAND | Net downward longwave flux | W/m2 | -| OUT_NET_SHORT_BAND | Net downward shortwave flux | W/m2 | +| OUT_LWNET_BAND | Net downward longwave flux | W/m2 | +| OUT_SWNET_BAND | Net downward shortwave flux | W/m2 | | OUT_RFRZ_ENERGY_BAND | Net energy used to refreeze liquid water in snowpack | W/m2 | | OUT_SENSIBLE_BAND | Net upward sensible heat flux | W/m2 | | OUT_SNOW_CANOPY_BAND | Snow interception storage in canopy | mm | diff --git a/vic/drivers/classic/src/get_force_type.c b/vic/drivers/classic/src/get_force_type.c index 60a4d6d79..b064a93dd 100644 --- a/vic/drivers/classic/src/get_force_type.c +++ b/vic/drivers/classic/src/get_force_type.c @@ -84,9 +84,8 @@ get_force_type(char *cmdstr, type = LAI_IN; } /* type 6: incoming longwave radiation [W/m2] */ - else if (strcasecmp("LONGWAVE", - optstr) == 0 || strcasecmp("LWDOWN", optstr) == 0) { - type = LONGWAVE; + else if (strcasecmp("LWDOWN", optstr) == 0) { + type = LWDOWN; } /* type 7: photosynthetically active radiation [uE/m2s] */ else if (strcasecmp("PAR", optstr) == 0) { @@ -105,9 +104,8 @@ get_force_type(char *cmdstr, type = VP; } /* type 11: rainfall [mm] */ - else if (strcasecmp("SHORTWAVE", - optstr) == 0 || strcasecmp("SWDOWN", optstr) == 0) { - type = SHORTWAVE; + else if (strcasecmp("SWDOWN", optstr) == 0) { + type = SWDOWN; } /* type 12: vegetation cover fraction */ else if (strcasecmp("VEGCOVER", optstr) == 0) { diff --git a/vic/drivers/classic/src/vic_force.c b/vic/drivers/classic/src/vic_force.c index 6edd50784..325fd9a5b 100644 --- a/vic/drivers/classic/src/vic_force.c +++ b/vic/drivers/classic/src/vic_force.c @@ -68,10 +68,10 @@ vic_force(atmos_data_struct *atmos, if (!param_set.TYPE[PREC].SUPPLIED) { log_err("Precipitation must be supplied as a forcing"); } - if (!param_set.TYPE[SHORTWAVE].SUPPLIED) { + if (!param_set.TYPE[SWDOWN].SUPPLIED) { log_err("Downward shortwave radiation must be supplied as a forcing"); } - if (!param_set.TYPE[LONGWAVE].SUPPLIED) { + if (!param_set.TYPE[LWDOWN].SUPPLIED) { log_err("Downward longwave radiation must be supplied as a forcing"); } if (!param_set.TYPE[PRESSURE].SUPPLIED) { @@ -131,9 +131,9 @@ vic_force(atmos_data_struct *atmos, // precipitation in mm/period atmos[rec].prec[i] = forcing_data[PREC][uidx]; // downward shortwave in W/m2 - atmos[rec].shortwave[i] = forcing_data[SHORTWAVE][uidx]; + atmos[rec].shortwave[i] = forcing_data[SWDOWN][uidx]; // downward longwave in W/m2 - atmos[rec].longwave[i] = forcing_data[LONGWAVE][uidx]; + atmos[rec].longwave[i] = forcing_data[LWDOWN][uidx]; // pressure in kPa atmos[rec].pressure[i] = forcing_data[PRESSURE][uidx] * PA_PER_KPA; // vapor pressure in kPa diff --git a/vic/drivers/classic/src/write_forcing_file.c b/vic/drivers/classic/src/write_forcing_file.c index a99727213..d470ffb79 100644 --- a/vic/drivers/classic/src/write_forcing_file.c +++ b/vic/drivers/classic/src/write_forcing_file.c @@ -54,7 +54,7 @@ write_forcing_file(atmos_data_struct *atmos, for (j = 0; j < NF; j++) { out_data[OUT_AIR_TEMP].data[0] = atmos[rec].air_temp[j]; out_data[OUT_DENSITY].data[0] = atmos[rec].density[j]; - out_data[OUT_LONGWAVE].data[0] = atmos[rec].longwave[j]; + out_data[OUT_LWDOWN].data[0] = atmos[rec].longwave[j]; out_data[OUT_PREC].data[0] = atmos[rec].prec[j]; out_data[OUT_PRESSURE].data[0] = atmos[rec].pressure[j] / PA_PER_KPA; @@ -64,7 +64,7 @@ write_forcing_file(atmos_data_struct *atmos, atmos[rec].vp[j] / (atmos[rec].vp[j] + atmos[rec].vpd[j]); - out_data[OUT_SHORTWAVE].data[0] = atmos[rec].shortwave[j]; + out_data[OUT_SWDOWN].data[0] = atmos[rec].shortwave[j]; out_data[OUT_VP].data[0] = atmos[rec].vp[j] / PA_PER_KPA; out_data[OUT_VPD].data[0] = atmos[rec].vpd[j] / PA_PER_KPA; out_data[OUT_WIND].data[0] = atmos[rec].wind[j]; diff --git a/vic/drivers/image/include/vic_driver_image.h b/vic/drivers/image/include/vic_driver_image.h index bfe64dde0..972d5812c 100644 --- a/vic/drivers/image/include/vic_driver_image.h +++ b/vic/drivers/image/include/vic_driver_image.h @@ -153,7 +153,6 @@ out_data_struct *create_output_list(void); void free_atmos(atmos_data_struct *atmos); void free_veg_hist(veg_hist_struct *veg_hist); void get_domain_type(char *cmdstr); -void get_force_type(char *cmdstr, int file_num, int *field); void get_forcing_file_info(param_set_struct *param_set, size_t file_num); size_t get_global_domain(char *fname, domain_struct *global_domain); void get_global_param(FILE *); @@ -191,6 +190,7 @@ int put_nc_field_double(char *nc_name, bool *open, int *nc_id, double fillval, int put_nc_field_int(char *nc_name, bool *open, int *nc_id, int fillval, int *dimids, int ndims, char *var_name, size_t *start, size_t *count, int *var); +void set_force_type(char *cmdstr, int file_num, int *field); void sprint_location(char *str, location_struct *loc); void vic_alloc(void); void vic_nc_info(nc_file_struct *nc_hist_file, out_data_struct **out_data, diff --git a/vic/drivers/image/src/get_global_param.c b/vic/drivers/image/src/get_global_param.c index 3120817b9..bc0694a1f 100644 --- a/vic/drivers/image/src/get_global_param.c +++ b/vic/drivers/image/src/get_global_param.c @@ -417,7 +417,7 @@ get_global_param(FILE *gp) param_set.N_TYPES[file_num] = count_force_vars(gp); } else if (strcasecmp("FORCE_TYPE", optstr) == 0) { - get_force_type(cmdstr, file_num, &field); + set_force_type(cmdstr, file_num, &field); } else if (strcasecmp("WIND_H", optstr) == 0) { sscanf(cmdstr, "%*s %lf", &global_param.wind_h); diff --git a/vic/drivers/image/src/get_force_type.c b/vic/drivers/image/src/set_force_type.c similarity index 93% rename from vic/drivers/image/src/get_force_type.c rename to vic/drivers/image/src/set_force_type.c index e13429742..495d1d538 100644 --- a/vic/drivers/image/src/get_force_type.c +++ b/vic/drivers/image/src/set_force_type.c @@ -34,7 +34,7 @@ * stores its location in the description of the current forcing file. *****************************************************************************/ void -get_force_type(char *cmdstr, +set_force_type(char *cmdstr, int file_num, int *field) { @@ -87,9 +87,8 @@ get_force_type(char *cmdstr, type = LAI_IN; } /* type 6: incoming longwave radiation [W/m2] */ - else if (strcasecmp("LONGWAVE", - optstr) == 0 || strcasecmp("LWDOWN", optstr) == 0) { - type = LONGWAVE; + else if (strcasecmp("LWDOWN", optstr) == 0) { + type = LWDOWN; } /* type 7: photosynthetically active radiation [uE/m2s] */ else if (strcasecmp("PAR", optstr) == 0) { @@ -108,9 +107,8 @@ get_force_type(char *cmdstr, type = VP; } /* type 11: rainfall [mm] */ - else if (strcasecmp("SHORTWAVE", - optstr) == 0 || strcasecmp("SWDOWN", optstr) == 0) { - type = SHORTWAVE; + else if (strcasecmp("SWDOWN", optstr) == 0) { + type = SWDOWN; } /* type 12: vegetation cover fraction */ else if (strcasecmp("VEGCOVER", optstr) == 0) { diff --git a/vic/drivers/image/src/vic_force.c b/vic/drivers/image/src/vic_force.c index 86f133371..86a4f64a8 100644 --- a/vic/drivers/image/src/vic_force.c +++ b/vic/drivers/image/src/vic_force.c @@ -110,7 +110,7 @@ vic_force(void) for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; get_scatter_nc_field_double(filenames.forcing[0], - param_set.TYPE[SHORTWAVE].varname, + param_set.TYPE[SWDOWN].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].shortwave[j] = (double) dvar[i]; @@ -121,7 +121,7 @@ vic_force(void) for (j = 0; j < NF; j++) { d3start[0] = global_param.forceoffset[0] + j; get_scatter_nc_field_double(filenames.forcing[0], - param_set.TYPE[LONGWAVE].varname, + param_set.TYPE[LWDOWN].varname, d3start, d3count, dvar); for (i = 0; i < local_domain.ncells_active; i++) { atmos[i].longwave[j] = (double) dvar[i]; diff --git a/vic/drivers/image/src/vic_nc_info.c b/vic/drivers/image/src/vic_nc_info.c index f8e17edbf..2a6fb016e 100644 --- a/vic/drivers/image/src/vic_nc_info.c +++ b/vic/drivers/image/src/vic_nc_info.c @@ -112,8 +112,7 @@ vic_nc_info(nc_file_struct *nc_hist_file, case OUT_LATENT_BAND: case OUT_LATENT_SUB_BAND: case OUT_MELT_ENERGY_BAND: - case OUT_NET_LONG_BAND: - case OUT_NET_SHORT_BAND: + case OUT_LWNET_BAND: case OUT_RFRZ_ENERGY_BAND: case OUT_SENSIBLE_BAND: case OUT_SNOW_CANOPY_BAND: @@ -318,15 +317,15 @@ vic_nc_info(nc_file_struct *nc_hist_file, case OUT_LATENT: case OUT_LATENT_SUB: case OUT_MELT_ENERGY: - case OUT_NET_LONG: - case OUT_NET_SHORT: + case OUT_LWNET: + case OUT_SWNET: case OUT_R_NET: case OUT_RFRZ_ENERGY: case OUT_SENSIBLE: case OUT_SNOW_FLUX: - case OUT_LONGWAVE: + case OUT_LWDOWN: case OUT_PAR: - case OUT_SHORTWAVE: + case OUT_SWDOWN: case OUT_ADV_SENS_BAND: case OUT_ADVECTION_BAND: case OUT_DELTACC_BAND: @@ -335,8 +334,7 @@ vic_nc_info(nc_file_struct *nc_hist_file, case OUT_LATENT_BAND: case OUT_LATENT_SUB_BAND: case OUT_MELT_ENERGY_BAND: - case OUT_NET_LONG_BAND: - case OUT_NET_SHORT_BAND: + case OUT_SWNET_BAND: case OUT_RFRZ_ENERGY_BAND: case OUT_SENSIBLE_BAND: case OUT_SNOW_FLUX_BAND: diff --git a/vic/drivers/python/vic_headers.py b/vic/drivers/python/vic_headers.py index 7408eeee6..e2990dcec 100644 --- a/vic/drivers/python/vic_headers.py +++ b/vic/drivers/python/vic_headers.py @@ -70,13 +70,13 @@ DENSITY, FDIR, LAI_IN, - LONGWAVE, + LWDOWN, PAR, PREC, PRESSURE, QAIR, REL_HUMID, - SHORTWAVE, + SWDOWN, VEGCOVER, VP, WIND, @@ -186,8 +186,8 @@ OUT_LATENT, OUT_LATENT_SUB, OUT_MELT_ENERGY, - OUT_NET_LONG, - OUT_NET_SHORT, + OUT_LWNET, + OUT_SWNET, OUT_R_NET, OUT_RFRZ_ENERGY, OUT_SENSIBLE, @@ -204,12 +204,12 @@ OUT_DENSITY, OUT_FDIR, OUT_LAI, - OUT_LONGWAVE, + OUT_LWDOWN, OUT_PAR, OUT_PRESSURE, OUT_QAIR, OUT_REL_HUMID, - OUT_SHORTWAVE, + OUT_SWDOWN, OUT_SURF_COND, OUT_TSKC, OUT_VEGCOVER, @@ -225,8 +225,8 @@ OUT_LATENT_BAND, OUT_LATENT_SUB_BAND, OUT_MELT_ENERGY_BAND, - OUT_NET_LONG_BAND, - OUT_NET_SHORT_BAND, + OUT_LWNET_BAND, + OUT_SWNET_BAND, OUT_RFRZ_ENERGY_BAND, OUT_SENSIBLE_BAND, OUT_SNOW_CANOPY_BAND, diff --git a/vic/drivers/shared/include/vic_driver_shared.h b/vic/drivers/shared/include/vic_driver_shared.h index 682d42b7c..cb53f869f 100644 --- a/vic/drivers/shared/include/vic_driver_shared.h +++ b/vic/drivers/shared/include/vic_driver_shared.h @@ -76,12 +76,12 @@ enum CHANNEL_IN, /**< incoming channel flow [m3] */ FDIR, /**< fraction of incoming shortwave that is direct [fraction] */ LAI_IN, /**< leaf area index [m2/m2] */ - LONGWAVE, /**< incoming longwave radiation [W/m2] */ + LWDOWN, /**< incoming longwave radiation [W/m2] */ PAR, /**< incoming photosynthetically active radiation [W/m2] */ PREC, /**< total precipitation (rain and snow) [mm] */ PRESSURE, /**< atmospheric pressure [kPa] */ VP, /**< vapor pressure [kPa] */ - SHORTWAVE, /**< incoming shortwave [W/m2] */ + SWDOWN, /**< incoming shortwave [W/m2] */ VEGCOVER, /**< fraction of each veg tile covered by plants [fraction] */ WIND, /**< wind speed [m/s] */ SKIP, /**< place holder for unused data columns */ @@ -201,8 +201,8 @@ enum OUT_LATENT, /**< net upward latent heat flux [W/m2] */ OUT_LATENT_SUB, /**< net upward latent heat flux from sublimation [W/m2] */ OUT_MELT_ENERGY, /**< energy of fusion (melting) in snowpack [W/m2] */ - OUT_NET_LONG, /**< net downward longwave flux [W/m2] */ - OUT_NET_SHORT, /**< net downward shortwave flux [W/m2] */ + OUT_LWNET, /**< net downward longwave flux [W/m2] */ + OUT_SWNET, /**< net downward shortwave flux [W/m2] */ OUT_R_NET, /**< net downward radiation flux [W/m2] */ OUT_RFRZ_ENERGY, /**< net energy used to refreeze liquid water in snowpack [W/m2] */ OUT_SENSIBLE, /**< net upward sensible heat flux [W/m2] */ @@ -219,12 +219,12 @@ enum OUT_DENSITY, /**< near-surface atmospheric density [kg/m3]*/ OUT_FDIR, /**< fraction of incoming shortwave that is direct [fraction]*/ OUT_LAI, /**< leaf area index [m2/m2] */ - OUT_LONGWAVE, /**< incoming longwave [W/m2] */ + OUT_LWDOWN, /**< incoming longwave [W/m2] */ OUT_PAR, /**< incoming photosynthetically active radiation [W/m2] */ OUT_PRESSURE, /**< near surface atmospheric pressure [kPa] (ALMA_OUTPUT: [Pa])*/ OUT_QAIR, /**< specific humidity [kg/kg] */ OUT_REL_HUMID, /**< relative humidity [%]*/ - OUT_SHORTWAVE, /**< incoming shortwave [W/m2] */ + OUT_SWDOWN, /**< incoming shortwave [W/m2] */ OUT_SURF_COND, /**< surface conductance [m/s] */ OUT_VEGCOVER, /**< fractional area of plants [fraction] */ OUT_VP, /**< near surface vapor pressure [kPa] (ALMA_OUTPUT: [Pa]) */ @@ -240,8 +240,8 @@ enum OUT_LATENT_BAND, /**< net upward latent heat flux [W/m2] */ OUT_LATENT_SUB_BAND, /**< net upward latent heat flux due to sublimation [W/m2] */ OUT_MELT_ENERGY_BAND, /**< energy of fusion (melting) in snowpack [W/m2] */ - OUT_NET_LONG_BAND, /**< net downward longwave flux [W/m2] */ - OUT_NET_SHORT_BAND, /**< net downward shortwave flux [W/m2] */ + OUT_LWNET_BAND, /**< net downward longwave flux [W/m2] */ + OUT_SWNET_BAND, /**< net downward shortwave flux [W/m2] */ OUT_RFRZ_ENERGY_BAND, /**< net energy used to refreeze liquid water in snowpack [W/m2] */ OUT_SENSIBLE_BAND, /**< net upward sensible heat flux [W/m2] */ OUT_SNOW_CANOPY_BAND, /**< snow interception storage in canopy [mm] */ diff --git a/vic/drivers/shared/src/output_list_utils.c b/vic/drivers/shared/src/output_list_utils.c index 5bb8bcb81..9119d89b6 100644 --- a/vic/drivers/shared/src/output_list_utils.c +++ b/vic/drivers/shared/src/output_list_utils.c @@ -148,8 +148,8 @@ create_output_list() strcpy(out_data[OUT_LATENT].varname, "OUT_LATENT"); /* net upward latent heat flux [W/m2] */ strcpy(out_data[OUT_LATENT_SUB].varname, "OUT_LATENT_SUB"); /* net upward latent heat flux from sublimation [W/m2] */ strcpy(out_data[OUT_MELT_ENERGY].varname, "OUT_MELT_ENERGY"); /* energy of fusion (melting) [W/m2] */ - strcpy(out_data[OUT_NET_LONG].varname, "OUT_NET_LONG"); /* net downward longwave flux [W/m2] */ - strcpy(out_data[OUT_NET_SHORT].varname, "OUT_NET_SHORT"); /* net downward shortwave flux [W/m2] */ + strcpy(out_data[OUT_LWNET].varname, "OUT_LWNET"); /* net downward longwave flux [W/m2] */ + strcpy(out_data[OUT_SWNET].varname, "OUT_SWNET"); /* net downward shortwave flux [W/m2] */ strcpy(out_data[OUT_R_NET].varname, "OUT_R_NET"); /* net downward radiation flux [W/m2] */ strcpy(out_data[OUT_RFRZ_ENERGY].varname, "OUT_RFRZ_ENERGY"); /* net energy used to refreeze liquid water in snowpack [W/m2] */ strcpy(out_data[OUT_SENSIBLE].varname, "OUT_SENSIBLE"); /* net upward sensible heat flux [W/m2] */ @@ -167,12 +167,12 @@ create_output_list() strcpy(out_data[OUT_DENSITY].varname, "OUT_DENSITY"); /* near-surface atmospheric density [kg/m3] */ strcpy(out_data[OUT_FDIR].varname, "OUT_FDIR"); /* fraction of incoming shortwave that is direct [fraction] */ strcpy(out_data[OUT_LAI].varname, "OUT_LAI"); /* leaf area index [m2/m2] */ - strcpy(out_data[OUT_LONGWAVE].varname, "OUT_LONGWAVE"); /* incoming longwave [W/m2] */ + strcpy(out_data[OUT_LWDOWN].varname, "OUT_LWDOWN"); /* incoming longwave [W/m2] */ strcpy(out_data[OUT_PAR].varname, "OUT_PAR"); /* incoming photosynthetically active radiation [W/m2] */ strcpy(out_data[OUT_PRESSURE].varname, "OUT_PRESSURE"); /* near surface atmospheric pressure [kPa] */ strcpy(out_data[OUT_QAIR].varname, "OUT_QAIR"); /* specific humidity [kg/kg] */ strcpy(out_data[OUT_REL_HUMID].varname, "OUT_REL_HUMID"); /* relative humidity [fraction]*/ - strcpy(out_data[OUT_SHORTWAVE].varname, "OUT_SHORTWAVE"); /* incoming shortwave [W/m2] */ + strcpy(out_data[OUT_SWDOWN].varname, "OUT_SWDOWN"); /* incoming shortwave [W/m2] */ strcpy(out_data[OUT_SURF_COND].varname, "OUT_SURF_COND"); /* surface conductance [m/s] */ strcpy(out_data[OUT_VEGCOVER].varname, "OUT_VEGCOVER"); /* fractional area of plants within veg tile [fraction] */ strcpy(out_data[OUT_VP].varname, "OUT_VP"); /* near surface vapor pressure [kPa] */ @@ -201,8 +201,8 @@ create_output_list() strcpy(out_data[OUT_LATENT_BAND].varname, "OUT_LATENT_BAND"); /* net upward latent heat flux [W/m2] */ strcpy(out_data[OUT_LATENT_SUB_BAND].varname, "OUT_LATENT_SUB_BAND"); /* net upward latent heat flux from sublimation [W/m2] */ strcpy(out_data[OUT_MELT_ENERGY_BAND].varname, "OUT_MELT_ENERGY_BAND"); /* energy of fusion (melting) [W/m2] */ - strcpy(out_data[OUT_NET_LONG_BAND].varname, "OUT_NET_LONG_BAND"); /* net downward longwave flux [W/m2] */ - strcpy(out_data[OUT_NET_SHORT_BAND].varname, "OUT_NET_SHORT_BAND"); /* net downward shortwave flux [W/m2] */ + strcpy(out_data[OUT_LWNET_BAND].varname, "OUT_LWNET_BAND"); /* net downward longwave flux [W/m2] */ + strcpy(out_data[OUT_SWNET_BAND].varname, "OUT_SWNET_BAND"); /* net downward shortwave flux [W/m2] */ strcpy(out_data[OUT_RFRZ_ENERGY_BAND].varname, "OUT_RFRZ_ENERGY_BAND"); /* net energy used to refreeze liquid water in snowpack [W/m2] */ strcpy(out_data[OUT_SENSIBLE_BAND].varname, "OUT_SENSIBLE_BAND"); /* net upward sensible heat flux [W/m2] */ strcpy(out_data[OUT_SNOW_CANOPY_BAND].varname, "OUT_SNOW_CANOPY_BAND"); /* snow interception storage in canopy [mm] */ @@ -240,8 +240,8 @@ create_output_list() out_data[OUT_LATENT_BAND].nelem = options.SNOW_BAND; out_data[OUT_LATENT_SUB_BAND].nelem = options.SNOW_BAND; out_data[OUT_MELT_ENERGY_BAND].nelem = options.SNOW_BAND; - out_data[OUT_NET_LONG_BAND].nelem = options.SNOW_BAND; - out_data[OUT_NET_SHORT_BAND].nelem = options.SNOW_BAND; + out_data[OUT_LWNET_BAND].nelem = options.SNOW_BAND; + out_data[OUT_SWNET_BAND].nelem = options.SNOW_BAND; out_data[OUT_RFRZ_ENERGY_BAND].nelem = options.SNOW_BAND; out_data[OUT_SENSIBLE_BAND].nelem = options.SNOW_BAND; out_data[OUT_SNOW_CANOPY_BAND].nelem = options.SNOW_BAND; diff --git a/vic/drivers/shared/src/put_data.c b/vic/drivers/shared/src/put_data.c index a09947d42..cd698e294 100644 --- a/vic/drivers/shared/src/put_data.c +++ b/vic/drivers/shared/src/put_data.c @@ -153,7 +153,7 @@ put_data(all_vars_struct *all_vars, // Set output versions of input forcings out_data[OUT_AIR_TEMP].data[0] = atmos->air_temp[NR]; out_data[OUT_DENSITY].data[0] = atmos->density[NR]; - out_data[OUT_LONGWAVE].data[0] = atmos->longwave[NR]; + out_data[OUT_LWDOWN].data[0] = atmos->longwave[NR]; out_data[OUT_PREC].data[0] = atmos->out_prec; // mm over grid cell out_data[OUT_PRESSURE].data[0] = atmos->pressure[NR] / PA_PER_KPA; out_data[OUT_QAIR].data[0] = CONST_EPS * atmos->vp[NR] / @@ -167,7 +167,7 @@ put_data(all_vars_struct *all_vars, else { out_data[OUT_LAKE_CHAN_IN].data[0] = 0; } - out_data[OUT_SHORTWAVE].data[0] = atmos->shortwave[NR]; + out_data[OUT_SWDOWN].data[0] = atmos->shortwave[NR]; out_data[OUT_SNOWF].data[0] = atmos->out_snow; // mm over grid cell out_data[OUT_VP].data[0] = atmos->vp[NR] / PA_PER_KPA; out_data[OUT_VPD].data[0] = atmos->vpd[NR] / PA_PER_KPA; @@ -537,8 +537,8 @@ put_data(all_vars_struct *all_vars, // Energy terms out_data[OUT_REFREEZE].data[0] = (out_data[OUT_RFRZ_ENERGY].data[0] / CONST_LATICE) * dt_sec; - out_data[OUT_R_NET].data[0] = out_data[OUT_NET_SHORT].data[0] + - out_data[OUT_NET_LONG].data[0]; + out_data[OUT_R_NET].data[0] = out_data[OUT_SWNET].data[0] + + out_data[OUT_LWNET].data[0]; // Save current moisture state for use in next time step save_data->total_soil_moist = 0; @@ -588,8 +588,8 @@ put_data(all_vars_struct *all_vars, if (options.FULL_ENERGY) { out_data[OUT_ENERGY_ERROR].data[0] = \ calc_energy_balance_error(rec, - out_data[OUT_NET_SHORT].data[0] + - out_data[OUT_NET_LONG].data[0], + out_data[OUT_SWNET].data[0] + + out_data[OUT_LWNET].data[0], out_data[OUT_LATENT].data[0] + out_data[OUT_LATENT_SUB].data[0], out_data[OUT_SENSIBLE].data[0] + @@ -1000,10 +1000,10 @@ collect_eb_terms(energy_bal_struct energy, *Tcanopy_fbcount_total += energy.Tcanopy_fbcount; /** record net shortwave radiation **/ - out_data[OUT_NET_SHORT].data[0] += energy.NetShortAtmos * AreaFactor; + out_data[OUT_SWNET].data[0] += energy.NetShortAtmos * AreaFactor; /** record net longwave radiation **/ - out_data[OUT_NET_LONG].data[0] += energy.NetLongAtmos * AreaFactor; + out_data[OUT_LWNET].data[0] += energy.NetLongAtmos * AreaFactor; /** record incoming longwave radiation at ground surface (under veg) **/ if (snow.snow && overstory) { @@ -1130,11 +1130,11 @@ collect_eb_terms(energy_bal_struct energy, lakefactor; /** record band net downwards shortwave radiation **/ - out_data[OUT_NET_SHORT_BAND].data[band] += energy.NetShortAtmos * Cv * + out_data[OUT_SWNET_BAND].data[band] += energy.NetShortAtmos * Cv * lakefactor; /** record band net downwards longwave radiation **/ - out_data[OUT_NET_LONG_BAND].data[band] += energy.NetLongAtmos * Cv * + out_data[OUT_LWNET_BAND].data[band] += energy.NetLongAtmos * Cv * lakefactor; /** record band albedo **/ From 1818fb05a2d5d6543c3231e4ecaf9a7ed9293f5b Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Wed, 23 Mar 2016 11:18:02 -0700 Subject: [PATCH 12/13] update download script and docs for sample datasets --- samples/README.md | 6 +----- samples/VIC_sample_data | 2 +- samples/get_sample_data.bash | 7 ++----- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/samples/README.md b/samples/README.md index 37dd6fb0c..5d6d644c9 100644 --- a/samples/README.md +++ b/samples/README.md @@ -8,14 +8,10 @@ This directory includes complete sample datasets to run VIC. Sample datasets tha ## Classic Driver -*In progress* - -1. Stehekin -1. Rosemount +1. Stehekin - 10-days of forcings ## Summary of Datasets: 1. Stehekin: This is a distributed datasets that covers the entire Stehekin River Basin, located in Washington State, USA. -1. Rosemount: This is a single point dataset from Rosemount site, Illinois, USA. ## Getting the Datasets: The VIC sample datasets are in a "git submodule", to download the datasets to this directory, simply run the following command: diff --git a/samples/VIC_sample_data b/samples/VIC_sample_data index db0b320a1..b7b16cb0f 160000 --- a/samples/VIC_sample_data +++ b/samples/VIC_sample_data @@ -1 +1 @@ -Subproject commit db0b320a128fb7592c7ad42a92aa17d256b7a414 +Subproject commit b7b16cb0ff517767130a9d1a323349d09f5efee0 diff --git a/samples/get_sample_data.bash b/samples/get_sample_data.bash index 82d4c3b9f..3b1182a9f 100755 --- a/samples/get_sample_data.bash +++ b/samples/get_sample_data.bash @@ -6,6 +6,8 @@ set -e CWD=$PWD SAMPLES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +git submodule init + # Get the sample data cd $SAMPLES/VIC_sample_data git fetch origin @@ -14,8 +16,3 @@ git checkout master # back to the original directory cd $CWD - -# Check that the -if [ ! -d "~/workdir" ]; then - echo "WARNING: `~/workdir` does not exist. Sample data will not run without modifying the global parameter file." -fi From 8b85bfccb434ccc03264fff425793144c13165b9 Mon Sep 17 00:00:00 2001 From: Joe Hamman Date: Thu, 24 Mar 2016 16:24:24 -0700 Subject: [PATCH 13/13] update to sample dataset readme --- samples/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/samples/README.md b/samples/README.md index 5d6d644c9..ed08fc4ce 100644 --- a/samples/README.md +++ b/samples/README.md @@ -12,6 +12,7 @@ This directory includes complete sample datasets to run VIC. Sample datasets tha ## Summary of Datasets: 1. Stehekin: This is a distributed datasets that covers the entire Stehekin River Basin, located in Washington State, USA. +2. More will be added soon! ## Getting the Datasets: The VIC sample datasets are in a "git submodule", to download the datasets to this directory, simply run the following command: @@ -20,8 +21,8 @@ The VIC sample datasets are in a "git submodule", to download the datasets to th ./get_sample_data.bash ``` -You may also download the sample data to another location on your computer using the following command: +You may also download the sample data to another location on your computer by specifying the directory in which you would like to add the data: ``` -git clone https://github.com/jhamman/VIC_sample_data.git +git clone https://github.com/jhamman/VIC_sample_data.git path/folder_name ```