310 likes | 552 Views
VIC Output Processing (and other stuff). Theodore Bohn Land Surface Hydrology Lab September 25, 2006. Overview. Why process VIC output? VIC assumptions & routing Overview: how to run VIC VIC output files How to get a hydrograph Routing program Input files Basin delineation
E N D
VIC Output Processing(and other stuff) Theodore Bohn Land Surface Hydrology Lab September 25, 2006
Overview • Why process VIC output? • VIC assumptions & routing • Overview: how to run VIC • VIC output files • How to get a hydrograph • Routing program • Input files • Basin delineation • How to run rout • Output files • Aggregation • Customizing VIC output • Future versions of VIC
Why process VIC output? What we typically want: • Hydrograph at various points in stream network • Monthly average water and/or energy budget of a basin What VIC (currently) gives us: • Moisture and energy fluxes and states for individual grid cells • Output interval = model time step We generally must process VIC’s output before we can use it
VIC assumptions & routing • Most other models run in “image” mode • For each time step, they compute fluxes and state for all grid cells • VIC currently runs in “vector” mode • For each grid cell, it runs the entire simulation period (all time steps) • This means each grid cell’s water and energy balance is independent of its neighbors
Why can VIC get away with this behavior? Assumptions: • The vast majority of grid cell runoff goes into the grid cell’s local channel network • Very little runoff goes from one grid cell’s soil to its neighbor’s soil • Water from the channel does not recharge into the soil (water transport is one-way)
Why can VIC get away with this behavior? These assumptions are valid if: • Grid cells are large (typically we have 1/8 degree; 12.5 km on a side) • Groundwater flow is small relative to surface and near-surface flow • Lakes/wetlands do not have significant channel inflows • Flooding (over banks) is insignificant These conditions hold most of the time
Consequences • VIC gives us a separate set of output files for each grid cell • VIC does not (currently) perform channel routing of runoff • VIC does not give us a hydrograph • Routing is performed by a stand-alone program (“rout”) • A benefit: VIC uses very little memory • system only needs to store state and fluxes of one grid cell at a time
Overview: how to run VIC VIC inputs: • Forcing files (1 per grid cell): • Meteorological inputs (precip, tmin, tmax, wind speed, etc) • Soil parameter file: • Soil porosity, hydraulic conductivity, VIC calibration parameters, etc. • Veg parameter file: • Number of veg tiles for each grid cell, and the types of vegetation in each tile • Veg library file: • Characteristics of each veg type, e.g. LAI, architectural resistance, roughness, albedo • Lake parameter file (version 4.1.0 only): • Lake depth-area relationship, etc • Snow_band file (optional): • Break each grid cell into portions (“bands”) with different elevations • For each band: list area fraction, elevation, precipitation fraction • Mainly useful in mountainous regions with snowmelt-driven streamflow • State file (optional): • Initial model state of each grid cell, e.g. soil moisture and temperature, snow water equivalent, etc
Overview: how to run VIC • Global parameter file: • Tells VIC where to find the other input files • Simulation options • Start/end date/time • Time step length • Modes of operation • Full energy balance or just water balance • Whether to run with snow bands • etc • Input options • Whether to start from initial state file or “cold” • Baseflow parameter format • etc • Output options • Whether to save a state file and at what point to do so • Binary or ascii • etc • An example global parameter file is included with the VIC code
Example global param file ####################################################################### # Simulation Parameters ####################################################################### TIME_STEP 3 # model time step in hours (set to 24 if FULL_ENERGY = FALSE, set to < 24 if FULL_ENERGY = TRUE) SNOW_STEP 3 # time step in hours for which to solve the snow model (should = TIME_STEP if TIME_STEP < 24) STARTYEAR 2000 # year model simulation starts STARTMONTH 01 # month model simulation starts STARTDAY 01 # day model simulation starts STARTHOUR 00 # hour model simulation starts ENDYEAR 2000 # year model simulation ends ENDMONTH 12 # month model simulation ends ENDDAY 31 # day model simulation ends FULL_ENERGY TRUE # TRUE = calculate full energy balance; FALSE = compute water balance only FROZEN_SOIL TRUE # TRUE = calculate frozen soils QUICK_FLUX FALSE # TRUE = use simplified ground heat flux method of Liang et al (1999); FALSE = use finite element method of Cherkauer et al (1999) NO_FLUX FALSE # TRUE = use no flux lower boundary for ground heat flux computation; FALSE = use constant flux lower boundary condition. If NO_FLUX = TRUE, QUICK_FLUX MUST = FALSE DIST_PRCP FALSE # TRUE = use distributed precipitation CORRPREC FALSE # TRUE = correct precipitation for gauge undercatch MIN_WIND_SPEED 0.1 # minimum allowable wind speed (m/s) PREC_EXPT 0.6 # exponent for use in distributed precipitation eqn (only used if DIST_PRCP is TRUE) MAX_SNOW_TEMP 0.5 # maximum temperature (C) at which snow can fall MIN_RAIN_TEMP -0.5 # minimum temperature (C) at which rain can fall ####################################################################### # State Files and Parameters ####################################################################### #INIT_STATE (put the initial state path/filename here) # Initial state path/file #STATENAME (put the path/prefix of output state file here) # Output state file path/prefix. The date (STATEYEAR,STATEMONTH,STATEDAY) will be appended to the prefix automatically in the format yyyymmdd. #STATEYEAR 2000 # year to save model state #STATEMONTH 12 # month to save model state #STATEDAY 31 # day to save model state #BINARY_STATE_FILE FALSE # TRUE if state file should be binary format; FALSE if ascii
Example global param file (cont) ####################################################################### # 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 # # There must be 1 FORCE_TYPE entry for each variable (column) in the forcing file # # 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 "_" GRID_DECIMAL 4 # Number of digits after decimal point in forcing file names 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_DT 24 # Forcing time step length (hours) FORCEYEAR 1915 # Year of first forcing record FORCEMONTH 01 # Month of first forcing record FORCEDAY 01 # Day of first forcing record FORCEHOUR 00 # Hour of first forcing record WIND_H 10.0 # height of wind speed measurement (m) MEASURE_H 2.0 # height of humidity measurement (m)
Example global param file (cont) ####################################################################### # Land Surface Files and Parameters ####################################################################### NLAYER 3 # number of soil layers NODES 10 # number of soil thermal nodes SOIL (put the soil parameter path/file here) # Soil parameter path/file BASEFLOW ARNO # ARNO = columns 5-8 are the standard VIC baseflow parameters; NIJSSEN2001 = columns 5-8 of soil file are baseflow parameters from Nijssen et al (2001) ARC_SOIL FALSE # TRUE = read soil parameters from ARC/INFO ASCII grids VEGPARAM (put the veg parameter path/file here) # Veg parameter path/file GLOBAL_LAI TRUE # TRUE = read LAI from veg param file; FALSE = read LAI from veg library file ROOT_ZONES 3 # Number of root zones (must match format of veg param file) VEGLIB (put the veg library path/file here) # Veg library path/file SNOW_BAND 1 # Number of snow bands; if number of snow bands > 1, you must insert the snow band path/file after the number of bands (e.g. SNOW_BAND 5 my_path/my_snow_band_file) COMPUTE_TREELINE FALSE # TRUE = replace any overstory veg types with the default understory veg type in all snow bands for which the average July Temperature <= 10 C; if TRUE, you must specify the default understory veg type after it (e.g. COMPUTE_TREELINE TRUE 11) ####################################################################### # Output Files and Parameters ####################################################################### RESULT_DIR (put the result directory path here) # Results directory path (with trailing "/") OUT_STEP 0 # Output interval (hours); if 0, OUT_STEP = TIME_STEP SKIPYEAR 0 # Number of years of output to omit from the output files COMPRESS FALSE # TRUE = compress input and output files when done BINARY_OUTPUT FALSE # TRUE = binary output files ALMA_OUTPUT FALSE # TRUE = ALMA-compliant output variable units PRT_SNOW_BAND FALSE # TRUE = write a "snowband" output file, containing band-specific values of snow variables
Overview: how to run VIC To run VIC: • Get VIC code cp –r /nfs/ontario/home/build/models/vic/VIC_4.0.6_r1 . • Compile VIC cd VIC_4.0.6_r1 make • At the command line, type: vicNl –g global_param_file where global_param_file = name (with path!) of your VIC global parameter file
Overview: how to run VIC Note: • There are some simulation options that are set in the source file user_def.h, and NOT in your global parameter file • To change them, you must edit user_def.h and then recompile VIC To see what these options are set to, type vicNl –o To see what version of VIC you have, type vicNl -v
VIC output files Current versions of VIC produce the following files: • fluxes: water & energy budget terms (actually, both fluxes and states) • snow: details of snow fluxes and states If FROZEN_SOIL = TRUE in global parameter file: • fdepth: soil freeze/thaw depths If PRT_SNOW_BANDS = TRUE in global parameter file: • snowbands: fluxes/states for each snow band If STATEFILE is specified in global parameter file: • state: model state Version 4.1.0 only: • lake: details of lake fluxes and states
VIC output files • For all output files except the state file, one file is produced per grid cell, e.g. fluxes_44.3175_-114.0625 • Format can be either binary or ascii, depending on setting of BINARY_OUTPUT in global parameter file • Typical ASCII fluxes file has following format: year month day prec evap runoff baseflow ... (more data...) • Units/dimensionality: • Moisture fluxes: total amount (depth over grid cell) (mm) over interval • Moisture states: depth (mm) over grid cell • Energy fluxes: rate (W/m2) • Energy states: temperatures in C (mostly; radiative temperature in K)
How to get a hydrograph Routing program: “rout” • Takes VIC fluxes files for all cells in basin • Reads daily runoff and baseflow totals • Convolves local (runoff+baseflow) with unit hydrograph response function • Adds local hydrograph response to flow from upstream • Propagates flow downstream Runoff + baseflow Runoff + baseflow Runoff + baseflow Runoff + baseflow
Input files for routing • Fraction file: how much of each cell in basin? • Flow direction file: direction of flow in each cell • Unit hydrograph file: shape of unit hydrograph • VIC daily fluxes files • Must be ASCII • Must have following format: year month day prec evap runoff baseflow … • Year, month and day must be columns 1-3 • Runoff and baseflow must be columns 6 and 7 • All other columns are ignored • Must be daily totals • Global parameter file • Tells rout location of input files, simulation modes, etc
Example fraction file ncols 128 nrows 96 xllcorner -125.000000 yllcorner 41.000000 cellsize 0.125000 NODATA_value 0 0 0 0 0 0 0 0 0.16 0.23 0.12 0.81 1 1 0.89 0.400 0 0 0 0 0 0 0 0 0 0 0.33 1 1 1 1 1 1 1 1 0.54 0 0 0 0 0 0 0 0 0 0.78 1 1 1 1 1 1 1 1 1 0.28 0 0 0 0
Example flow direction file ncols 128 nrows 96 xllcorner -125.000000 yllcorner 41.000000 cellsize 0.125000 NODATA_value -1 -1 -1 -1 -1 -1 -1 -1 5 5 5 3 4 5 6 7 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 3 3 1 7 4 5 5 7 6 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 1 1 1 3 5 7 7 5 5 5 -1 -1 -1 -1
Example unit hydrograph file day fraction of runoff 0 0.0100 1 0.2400 2 0.3300 3 0.1800 4 0.1200 5 0.0500 6 0.0200 7 0.0100 8 0.0100 9 0.0100 10 0.0100 11 0.0100
Example Global Parameter File - routing # salmon Routing Information # NAME OF FLOW DIRECTION FILE /my_path/salmon/params/route/pnw_125.flowd.final # NAME OF VELOCITY FILE .false. 2.00 # NAME OF DIFF FILE .false. 800 # NAME OF XMASK FILE .false. 12500 # NAME OF FRACTION FILE .true. /my_path/salmon/params/route/pnw_125.fract # NAME OF STATION FILE /my_path/salmon/params/route/pnw_125.stnloc.SALMO # NAME OF UNIT HYDROGRAPH FILE /my_path/salmon/params/route/UH_ALL # PATH OF INPUT FILES AND PRECISION /my_path/salmon/results/fluxes_ .4 # INPUT FORMAT IS NETCDF (=.true.) OR VIC (=.false.) .false. # GRID_TYPE (LATLON or EQAREA) and RESOLUTION (cell width in degrees or cell area in km2) LATLON 0.125 # LAT and LON files - only necessary if input files are EQAREA #/my_path/salmon/params/route/latitude.salmon #/my_path/salmon/params/route/longitude.salmon # UNITS ARE ALMA (=.true) OR STANDARD (=.false) .false. # PATH OF OUTPUT FILES /my_path/salmon/results/route/ # YEAR AND MONTH OF VIC OUTPUT TO ROUTE & ROUTED OUTPUT TO WRITE 1949 01 1999 12 1949 01 1999 12 # OUTPUT UNITS ARE ft**3/sec (=.true.) or m**3/sec (=.false.) .false. # AREA FILE /my_path/salmon/results/route/area.txt
Basin delineation • To create basin mask, fraction file, flow direction file, etc, we must delineate the basin • This involves using arc/info and the Hydro1k global DEM • For details, please see Jenny’s tutorial at: http://www.ce.washington.edu/~jenny/web_tutorial/tutorial.htm • Nathalie also has information: http://www.ce.washington.edu/~nathalie/arcinfo.html
How to run “rout” To run rout: • Get rout code cp –r /nfs/ontario/home/build/models/route/route_1.1 . • Compile VIC cd route_1.1 make • At the command line, type: rout global_param_file where global_param_file = name (with path!) of your routing global parameter file
Output files from routing Daily, monthly, and annual discharge, in both volumetric units (m3/s or cfd) and mm over the basin Example: SALMO.day 1949 01 01 0.049014 1949 01 02 1.391608 1949 01 03 7.281677 SALMO.day_mm 1949 01 01 0.00012604 1949 01 02 0.00357849 1949 01 03 0.01872469 SALMO.month 1949 01 52.7108 1949 02 66.7425 1949 03 106.1719
Aggregation • Temporal • Typical examples: • VIC sub-daily to daily (for use by routing program) • VIC daily to monthly • Methods: • Moisture fluxes: accumulate the amount (mm) over the new interval • Energy fluxes: average the rate (W/m2) over the new interval • Moisture and energy states: • to preserve the water/energy budget, take the end-of-interval value • depending on your goal, you may want to take the average (e.g. for temperature or albedo over the interval) instead • Spatial • Typical example: • Averaging over a basin • Simply average all values over the basin • If grid cells differ significantly in area across the basin, you may need to weight the average by grid cell area • Compositing • Typical example: monthly average • For each month, average that month’s values over all years
Aggregation • In general you’ll need to write your own shell script to do aggregation • However, many people in the lab have written aggregation scripts – just ask
Customizing VIC output • Currently, VIC writes MANY variables to the output files, yet may not write the variable you’re interested in. • This means that VIC output files take up a lot of space, and you won’t use most of the data. • What can you do? You can modify your copy of VIC to make the output you want. • VIC output functions: • put_data.c: gathers fluxes and states into one output structure • write_data.c: writes these values to the output files • But wait! Help is on the way…
Future versions of VIC In the latest versions of VIC (4.0.6_r1 and 4.1.0_r4), you can control VIC output with your global parameter file: • Number and names of output files • Which variables to put in each output file • What output interval to use • This only aggregates from sub-daily to daily • Useful for sub-daily full energy balance runs
Future versions of VIC Example: if you are running VIC at a 3-hour time step and want to output just the basic water and energy balance terms aggregated to daily interval, you could put this in your global parameter file: OUT_STEP 24 # Output interval (hours); if 0, OUT_STEP = TIME_STEP N_OUTFILES 2 OUTFILE wbal 7 OUTVAR OUT_PREC OUTVAR OUT_EVAP OUTVAR OUT_RUNOFF OUTVAR OUT_BASEFLOW OUTVAR OUT_SWE OUTVAR OUT_WDEW OUTVAR OUT_SOIL_MOIST OUTFILE ebal 7 OUTVAR OUT_NET_SHORT OUTVAR OUT_NET_LONG OUTVAR OUT_LATENT OUTVAR OUT_SENSIBLE OUTVAR OUT_GRND_FLUX OUTVAR OUT_SNOW_FLUX OUTVAR OUT_DELTACC number of output files number of variables name of output file (_lat_lon will be appended) names of variables (see vicNl_def.h for complete list)
Versions of VIC VIC 4.0.3 VIC 4.0.4 VIC 4.1.0_r1 Latest official version VIC 4.0.5 VIC 4.1.0_r3 Currently under testing; has flexible output configuration VIC 4.0.6_r1 VIC 4.1.0_r4 Currently under testing; has flexible output configuration 4.1.x: Lakes/wetlands Canopy energy balance Permafrost dynamics 4.0.x: “Traditional” features