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

specify netcdf variable names in global parameter file #379

Merged
merged 1 commit into from
Feb 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions docs/Development/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.

3. Changed the name of the variable VEGCOVER to FCANOPY, since this more accurately captures the meaning of the term (i.e., the fractional area of the plant canopy within the veg tile). Similarly changed OUT_VEGCOVER to OUT_FCANOPY.

Expand Down
4 changes: 2 additions & 2 deletions docs/Documentation/Drivers/Classic/ForcingData.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/m<sup>2</sup> |
| LONGWAVE | Incoming longwave radiation | W/m<sup>2</sup> |
| SWDOWN | Incoming shortwave radiation | W/m<sup>2</sup> |
| LWDOWN | Incoming longwave radiation | W/m<sup>2</sup> |
| VP | Vapor pressure | kPa |
| WIND | Wind speed | m/s |

Expand Down
12 changes: 6 additions & 6 deletions docs/Documentation/OutputVarList.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ Using options within the *global parameter file*, any combination of the variabl
| OUT_LATENT | Net upward latent heat flux | W/m<sup>2</sup> |
| OUT_LATENT_SUB | Net upward latent heat flux from sublimation | W/m<sup>2</sup> |
| OUT_MELT_ENERGY | Energy of fusion (melting) in snowpack | W/m<sup>2</sup> |
| OUT_NET_LONG | Net downward longwave flux | W/m<sup>2</sup> |
| OUT_NET_SHORT | Net downward shortwave flux | W/m<sup>2</sup> |
| OUT_LWNET | Net downward longwave flux | W/m<sup>2</sup> |
| OUT_SWNET | Net downward shortwave flux | W/m<sup>2</sup> |
| OUT_R_NET | Net downward radiation flux | W/m<sup>2</sup> |
| OUT_RFRZ_ENERGY | Net energy used to refreeze liquid water in snowpack | W/m<sup>2</sup> |
| OUT_SENSIBLE | Net upward sensible heat flux | W/m<sup>2</sup> |
Expand All @@ -138,11 +138,11 @@ Using options within the *global parameter file*, any combination of the variabl
| OUT_FCANOPY | Vegetation canopy cover fraction | fraction |
| OUT_FDIR | fraction of incoming shortwave that is direct | fraction |
| OUT_LAI | Leaf Area Index | fraction |
| OUT_LONGWAVE | Incoming longwave | W/m<sup>2</sup> |
| OUT_LWDOWN | Incoming longwave | W/m<sup>2</sup> |
| 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/m<sup>2</sup> |
| OUT_SWDOWN | Incoming shortwave | W/m<sup>2</sup> |
| OUT_SURF_COND | Surface conductance | m/s |
| OUT_TSKC | (release 4.1.2 and later) Cloud fraction | fraction |
| OUT_VP | Near surface vapor pressure | kPa (ALMA_OUTPUT: Pa) |
Expand All @@ -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/m<sup>2</sup> |
| OUT_LATENT_SUB_BAND | Net upward latent heat flux due to sublimation | W/m<sup>2</sup> |
| OUT_MELT_ENERGY_BAND | Energy of fusion (melting) in snowpack | W/m<sup>2</sup> |
| OUT_NET_LONG_BAND | Net downward longwave flux | W/m<sup>2</sup> |
| OUT_NET_SHORT_BAND | Net downward shortwave flux | W/m<sup>2</sup> |
| OUT_LWNET_BAND | Net downward longwave flux | W/m<sup>2</sup> |
| OUT_SWNET_BAND | Net downward shortwave flux | W/m<sup>2</sup> |
| OUT_RFRZ_ENERGY_BAND | Net energy used to refreeze liquid water in snowpack | W/m<sup>2</sup> |
| OUT_SENSIBLE_BAND | Net upward sensible heat flux | W/m<sup>2</sup> |
| OUT_SNOW_CANOPY_BAND | Snow interception storage in canopy | mm |
Expand Down
50 changes: 26 additions & 24 deletions samples/global.param.sample.image.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
#######################################################################
Expand Down Expand Up @@ -105,32 +117,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)
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
Expand Down
1 change: 0 additions & 1 deletion vic/drivers/classic/include/vic_driver_classic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this not needed for classic? Wasn't this just introduced? Does that mean that in vic_classic the user still needs to specify the number of forcing variables?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just moved to driver/shared

void compute_cell_area(soil_con_struct *);
size_t count_outfile_nvars(FILE *gp);
Expand Down
68 changes: 11 additions & 57 deletions vic/drivers/classic/src/get_force_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ get_force_type(char *cmdstr,
type = LAI_IN;
}
/* type 7: 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 8: photosynthetically active radiation [uE/m2s] */
else if (strcasecmp("PAR", optstr) == 0) {
Expand All @@ -108,16 +107,19 @@ get_force_type(char *cmdstr,
else if (strcasecmp("VP", optstr) == 0) {
type = VP;
}
/* type 12: rainfall [mm] */
else if (strcasecmp("SHORTWAVE",
optstr) == 0 || strcasecmp("SWDOWN", optstr) == 0) {
type = SHORTWAVE;
/* type 12: incoming shortwave radiation [W/m2] */
else if (strcasecmp("SWDOWN", optstr) == 0) {
type = SWDOWN;
}
/* type 13: wind speed [m/s] */
/* type 13: vegetation cover fraction */
else if (strcasecmp("FCANOPY", optstr) == 0) {
type = FCANOPY;
}
/* type 14: wind speed [m/s] */
else if (strcasecmp("WIND", optstr) == 0) {
type = WIND;
}
/* type 14: unused (blank) data */
/* type 15: unused (blank) data */
else if (strcasecmp("SKIP", optstr) == 0) {
type = SKIP;
}
Expand Down Expand Up @@ -147,51 +149,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;
}
18 changes: 10 additions & 8 deletions vic/drivers/classic/src/parse_output_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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.");
}
Expand All @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions vic/drivers/classic/src/set_output_defaults.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ set_output_defaults(out_data_struct *out_data)
set_output_var(out_data_files, true, filenum, out_data,
"OUT_RAD_TEMP", varnum++, "%.4f", OUT_TYPE_FLOAT, 1);
}
set_output_var(out_data_files, true, filenum, out_data, "OUT_NET_SHORT",
set_output_var(out_data_files, true, filenum, out_data, "OUT_SWNET",
varnum++, "%.4f", OUT_TYPE_FLOAT, 1);
set_output_var(out_data_files, true, filenum, out_data, "OUT_R_NET",
varnum++, "%.4f", OUT_TYPE_FLOAT, 1);
Expand Down Expand Up @@ -254,10 +254,10 @@ set_output_defaults(out_data_struct *out_data)
OUT_TYPE_FLOAT, 1);
}
set_output_var(out_data_files, true, filenum, out_data,
"OUT_NET_SHORT_BAND", varnum++, "%.4f",
"OUT_SWNET_BAND", varnum++, "%.4f",
OUT_TYPE_FLOAT, 1);
set_output_var(out_data_files, true, filenum, out_data,
"OUT_NET_LONG_BAND", varnum++, "%.4f",
"OUT_LWNET_BAND", varnum++, "%.4f",
OUT_TYPE_FLOAT, 1);
set_output_var(out_data_files, true, filenum, out_data,
"OUT_ALBEDO_BAND", varnum++, "%.4f", OUT_TYPE_FLOAT,
Expand Down
Loading