Difference between revisions of "Climate data"
(23 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | ==Met Station Based Climate Data== | ||
+ | |||
+ | Climate data in this form is based on having a single file for each meteorological station available. Each base station is represented by | ||
+ | it's own base station file, and separate files for each climate variable as listed in the base station file. At the very least, daily time | ||
+ | series of tmin, tmax, and rain are required. | ||
+ | |||
Climate inputs are linked to particular zones by the climate station ID affiliated with that zone. A single climate station (or base station) will typically serve multiple zones within the landscape. Each base station is described by a base station file. | Climate inputs are linked to particular zones by the climate station ID affiliated with that zone. A single climate station (or base station) will typically serve multiple zones within the landscape. Each base station is described by a base station file. | ||
Line 32: | Line 38: | ||
|- | |- | ||
| tmax||maximum daily temperature* required||°C | | tmax||maximum daily temperature* required||°C | ||
+ | |- | ||
+ | | tavg||average daily temperature||°C | ||
|- | |- | ||
| dayl||day length||seconds | | dayl||day length||seconds | ||
Line 37: | Line 45: | ||
| daytime_rain_duration||duration of rainfall||hours | | daytime_rain_duration||duration of rainfall||hours | ||
|- | |- | ||
− | | LAI_scalar||zone and seasonal scaling of LAI | + | | LAI_scalar||zone and seasonal scaling of LAI -<br> only applied to stratum of non-zero height||Unitless |
− | |||
− | |||
|- | |- | ||
| Ldown||incoming longwave radiation||KJ / (meters2)/day | | Ldown||incoming longwave radiation||KJ / (meters2)/day | ||
Line 68: | Line 74: | ||
|- | |- | ||
| CO2||Carbon Dioxide||parts per million/year | | CO2||Carbon Dioxide||parts per million/year | ||
+ | |- | ||
+ | | lapse_rate_tmin || minimum daily temperature lapse rate with elevation || °C/m | ||
+ | |- | ||
+ | | lapse_rate_tmax || maximum daily temperature lapse rate with elevation || °C/m | ||
+ | |||
|} | |} | ||
− | All possible base station filenames must be listed in the worldfile header, as described in the discussion of | + | All possible base station filenames must be listed in the worldfile header, as described in the discussion of grass2world below. |
+ | |||
+ | ===Format for Time Series Input Files=== | ||
+ | The first line of each input time series file must give the start date of the time series. The start date of the input must precede the start date listed in the worldfile. Following the start date, time series values are listed sequentially. For example: | ||
+ | example_simulation_daily.rain will contain the following | ||
+ | |||
+ | <pre> | ||
+ | 1986 1 1 1 | ||
+ | 0.0028 | ||
+ | 0.000 | ||
+ | 0.0157 | ||
+ | 0.000 | ||
+ | … | ||
+ | </pre> | ||
+ | |||
+ | ==ASCII Gridded Climate Data== | ||
+ | |||
+ | Climate data in gridded form is not tied to any particular met station, but is a grid of climate data over the watershed such as an interpolation | ||
+ | between multiple climate stations, or downscaled data from a climate model. While it is possible to fake gridded climate data by representing each grid cell as a unique climate station, using gridded climate files is easier to work with. | ||
+ | |||
+ | Gridded climate data will have only a single base file, and a single file for each climate variable. The base file is identical to that of non-gridded climate data, | ||
+ | except that the first line that set the base station id is replaced with a line specifying the total number of grid cells. So if you had a gridded climate dataset | ||
+ | identical to the one specified above, but with 4 cells, your climate base file would be:<br> | ||
+ | <pre> | ||
+ | 4 grid_cells | ||
+ | 100.0 x_coordinate | ||
+ | 100.0 y_coordinate | ||
+ | 22.9 z_coordinate | ||
+ | 2.0 effective_lai | ||
+ | 22.9 screen_height | ||
+ | clim\rbw_prime_annual annual_climate_prefix | ||
+ | 0 number_non_critical_annual_sequences | ||
+ | clim\rbw_prime_monthly monthly_climate_prefix | ||
+ | 0 number_non_critical_monthly_sequences | ||
+ | clim\rbw daily_climate_prefix | ||
+ | 2 | ||
+ | ndep_NO3 | ||
+ | ndep_NH4 | ||
+ | 0 | ||
+ | clim\rbw_prime_hourly hourly_climate_prefix | ||
+ | 0 number_non_critical_hourly_sequences | ||
+ | </pre> | ||
+ | |||
+ | The climate variable files will look similar to those from the standard met station based climate input with three important differences. | ||
+ | <br>(1) The first line specifies the total number of grid cells at the top of the climate file. | ||
+ | <br>(2) The third line (after the start date, which is now your second line) specifies the grid cell index for each column of data. These numbers must match | ||
+ | up with the values of the GIS map specified as the base_station_ID variable in your template file. | ||
+ | <br>(3) The fourth line is the elevation for the grid cell, which will also match the values of your zone elevations within your world file.<br> | ||
+ | The following is a climate file with four grid cells with index numbers 1-4, their elevations, and four climate data values specific to their cell: | ||
+ | |||
+ | |||
+ | {| {{table}} | ||
+ | | align="center" style="background:#f0f0f0;"|'''Grid Cell Index''' | ||
+ | | align="center" style="background:#f0f0f0;"|'''Elevation''' | ||
+ | | align="center" style="background:#f0f0f0;"|'''Climate Data for Grid Cell Index''' | ||
+ | |- | ||
+ | | 1|| 100.1|| 24, 24, 21, 19|| | ||
+ | |- | ||
+ | | 2|| 200.2|| 26, 25, 23, 21|| | ||
+ | |- | ||
+ | | 3|| 300.3|| 27, 25, 22, 19|| | ||
+ | |- | ||
+ | | 4|| 400.4|| 23, 21, 22, 18|| | ||
+ | |} | ||
+ | <pre> | ||
+ | 4 | ||
+ | 1986 1 1 1 | ||
+ | 1 2 3 4 | ||
+ | 100.1 200.2 300.3 400.4 | ||
+ | 24 26 27 23 | ||
+ | 24 25 25 21 | ||
+ | 21 23 22 22 | ||
+ | 19 21 19 18 | ||
+ | … | ||
+ | </pre> | ||
+ | |||
+ | ===Running RHESSys with ASCII Gridded Climate Data=== | ||
+ | |||
+ | # Edit your template file to refer to the climate base file. | ||
+ | # When running RHESSys, use the command line option '-asciigrid' and RHESSs will properly deal with your ASCII gridded climate data. | ||
+ | |||
+ | |||
+ | <br><br> | ||
+ | |||
+ | ==NetCDF Gridded Climate Data== | ||
+ | |||
+ | Similar to the ASCII gridded climate strategy described above, RHESSys can read NetCDF files as spatially distributed climate inputs. The method to implement is also similar: (1) setup a unique ID grid based on your NetCDF grid cells and assign zone IDs, (2) use a script to setup a NetCDF base station file, (3) run RHESSys with the NetCDF grid flag.<br> | ||
+ | |||
+ | There is a bit of setup required to use NetCDF climate inputs. In particular, you need to create a unique ID map to match zone IDs to NetCDF cells and you need to create ID, elevation, lai, and screen height ascii maps to use as inputs to the <i>createbas_netcdf</i> script to create a NetCDF base station file. Specific steps are described below.<br> | ||
+ | |||
+ | Steps to generate x and y maps for using netcdf climate files: | ||
+ | <ol><li>Run gdal steps to convert from netcdf to TIF for one variable.</li> | ||
+ | <li>Create new GRASS location using TIF file as region/projection.</li> | ||
+ | <li>Use g.region to set resolution to match your patch map (e.g., 30m).</li> | ||
+ | <li>Use r.proj to import your full basin extent.</li> | ||
+ | <li>Use g.region to set region to basin extent.</li> | ||
+ | <li>Use cxy to generate x and y maps and unique ID map.</li> | ||
+ | <li>Import dem and lai maps into netcdf location and generate summary statistics by unique grid cell ID.</li> | ||
+ | <li>Generate screen height map.</li> | ||
+ | <li>Export cellid, dem, lai, and screen ascii files.</li> | ||
+ | <li>Generate x and y coord text files.</li> | ||
+ | <li>Use createbas_netcdf and ascii maps to generate base station file.</li> | ||
+ | <li>Use r.proj to import the grid cell unique ID map into your main location (where patch map, etc. live).</li> | ||
+ | <li>Generate worldfile using the unique cell ID map as the zone base station ID map.</li></ol> | ||
+ | <br> | ||
+ | ===Example Commands (using DAYMET NetCDF format)=== | ||
+ | <b>Steps to convert NetCDF to TIF:</b><br> | ||
+ | Get metadata: | ||
+ | <pre> | ||
+ | gdalinfo tmax.nc | ||
+ | gdalinfo NETCDF:tmax.nc:lat | ||
+ | </pre> | ||
+ | Replace the coordinates in the ullr below with the ones reported in the metadata (upperleft_x upperleft_y lowerright_x lowerright_Y):<br> | ||
+ | (projection info below is for DAYMET; replace for other climate inputs) | ||
+ | <pre> | ||
+ | gdal_translate -of GTiff -a_ullr -535000.000 -672000.000 -347000.000 -895000.000 -a_srs "+proj=lcc +datum=WGS84 +lat_1=25 n +lat_2=60n +lat_0=42.5n +lon_0=100w" NETCDF:"tmax.nc":tmax tmax1980.tif | ||
+ | </pre> | ||
+ | <b>GRASS processing:</b><br> | ||
+ | In GRASS, create a new NetCDF location to match the TIF you just created.<br> | ||
+ | Import needed maps from your main project GRASS location:<br> | ||
+ | <pre> | ||
+ | r.in.gdal input=tmax1980.tif output=tmax80 band=1 | ||
+ | g.region res=100 | ||
+ | r.proj location=grasssf mapset=patch_fullveg input=basin.fullveg output=basin --overwrite | ||
+ | r.proj location=grasssf mapset=patch_fullveg input=dem30m output=dem --overwrite | ||
+ | r.proj location=GRASStemp mapset=upforks input=modlaigap_090829 output=modlai --overwrite | ||
+ | </pre> | ||
+ | Create unique ID map:<br> | ||
+ | (example below is for DAYMET at 1000-m resolution) | ||
+ | <pre> | ||
+ | g.region rast=tmax80 | ||
+ | cxy -v xmap=xmap1k ymap=ymap1k --overwrite | ||
+ | r.mapcalc "xy1k=xmap1k+ymap1k" | ||
+ | g.region rast=basin align=tmax80 res=1000 | ||
+ | r.clump input=xy1k output=uni1k --overwrite | ||
+ | </pre> | ||
+ | Generate average elevation by unique cell ID and clip grid cells to extent of DEM (matches basin): | ||
+ | <pre> | ||
+ | g.region res=100 | ||
+ | r.statistics base=uni1k cover=dem method=average output=dem1k_rc --overwrite | ||
+ | g.region res=1000 | ||
+ | r.mapcalc "dem1k=@dem1k_rc" | ||
+ | r.mapcalc "uni1k=if(isnull(dem1k),dem1k,uni1k)" | ||
+ | r.clump input=uni1k output=uni1k --overwrite | ||
+ | </pre> | ||
+ | Generate average LAI by unique cell ID: | ||
+ | <pre> | ||
+ | g.region res=100 | ||
+ | r.statistics base=uni1k cover=modlai method=average output=lai1k_rc --overwrite | ||
+ | g.region res=1000 | ||
+ | r.mapcalc "lai1k=@lai1k_rc" | ||
+ | </pre> | ||
+ | Generate screen height map:<br> | ||
+ | (this example sets screen height to 2 m for all grid cells) | ||
+ | <pre> | ||
+ | r.mapcalc "two=2.0" | ||
+ | </pre> | ||
+ | Output ascii files: | ||
+ | <pre> | ||
+ | r.out.arc input=uni1k output=cellid.asc | ||
+ | r.out.arc input=dem1k output=dem.asc | ||
+ | r.out.arc input=lai1k output=lai.asc | ||
+ | r.out.arc input=two output=screen.asc | ||
+ | </pre> | ||
+ | <b>Create base station file:</b><br> | ||
+ | Generate files for coords table:<br> | ||
+ | First convert to integer for running statistics (may use multipliers to maintain precision if needed): | ||
+ | <pre> | ||
+ | g.region res=1000 | ||
+ | r.mapcalc "xmap1ki=int(xmap1k)" | ||
+ | r.statistics base=uni1k cover=xmap1ki method=average output=xmap1ki_rc --overwrite | ||
+ | r.category xmap1ki_rc > id_x.txt | ||
+ | r.mapcalc "ymap1ki=int(ymap1k)" | ||
+ | r.statistics base=uni1k cover=ymap1ki method=average output=ymap1ki_rc --overwrite | ||
+ | r.category ymap1ki_rc > id_y.txt | ||
+ | </pre> | ||
+ | Outside of GRASS, merge these two x, y coord text files into one list with: ID XCOORD YCOORD<br> | ||
+ | The file should look something like: | ||
+ | <pre> | ||
+ | 1 -1609500 -432500 | ||
+ | 2 -1608500 -432500 | ||
+ | 3 -1607500 -432500 | ||
+ | ... | ||
+ | </pre> | ||
+ | Run script to make base station file: | ||
+ | <pre> | ||
+ | createbas_netcdf cellid.asc lai.asc dem.asc screen.asc id_xy.txt netcdf_base.txt | ||
+ | </pre> | ||
+ | Your base station file should look something like the sample below. Edit lines 2-12 as needed: | ||
+ | <pre> | ||
+ | 1111 grid_cells | ||
+ | 708 location_searching_distance /* Max distance that the routine will search for a NetCDF grid cell in native units. This value is for a 1000-m grid cell resolution. */ | ||
+ | 1980 year_start_index /* In DAYMET, the time index counts up from 1/1/1980. Change this year to start the index at another year (on 1/1/XXXX). */ | ||
+ | 0 day_offset /* If you need to offset the day index. There is some issue with NetCDF4 where this should be 1 (left in from orig mingliang code). */ | ||
+ | 1 leap_year_include /* Whether or not to include leap year additional days (1=include, 0=clip to 365). */ | ||
+ | 0.001 precip_multiplier /* Precip multiplier if needed (e.g., this value converts from NetCDF precip in mm to RHESSys precip in m). */ | ||
+ | ../clim/daymet_netcdf/tmax_19802011.nc netcdf_tmax_filename /* Pathname to the Tmax NetCDF file. */ | ||
+ | tmax netcdf_var_tmax /* Variable name for tmax in the NetCDF file. */ | ||
+ | ../clim/daymet_netcdf/tmin_19802011.nc netcdf_tmin_filename /* Pathname to the Tmin NetCDF file. */ | ||
+ | tmin netcdf_var_tmin /* Variable name for tmin in the NetCDF file. */ | ||
+ | ../clim/daymet_netcdf/prcp_19802011.nc netcdf_rain_filename /* Pathname to the Precip NetCDF file. */ | ||
+ | prcp netcdf_var_rain /* Variable name for precip in the NetCDF file. */ | ||
+ | 1 base_station_id | ||
+ | -1609500.000000 x_coordinate | ||
+ | -432500.000000 y_coordinate | ||
+ | 1892.823486 z_coordinate | ||
+ | 2.900000 effective_lai | ||
+ | 2.000000 screen_height | ||
+ | 2 base_station_id | ||
+ | -1608500.000000 x_coordinate | ||
+ | -432500.000000 y_coordinate | ||
+ | 1856.814819 z_coordinate | ||
+ | 2.900000 effective_lai | ||
+ | 2.000000 screen_height | ||
+ | ... | ||
+ | </pre> | ||
+ | Go to your main project GRASS location (where your patch map, etc. live).<br> | ||
+ | Import necessary maps: | ||
+ | <pre> | ||
+ | r.proj location=grass_daymet mapset=PERMANENT input=uni1k output=uni1k --overwrite | ||
+ | </pre> | ||
+ | Use this map in the template as the zone base station ID map. | ||
+ | |||
+ | |||
+ | ===Running RHESSys with NetCDF Gridded Climate Data=== | ||
+ | |||
+ | # Edit your template file to refer to the NetCDF climate base file. | ||
+ | # When running RHESSys, use the command line option '-netcdfgrid' and RHESSs will properly deal with your NetCDF gridded climate data. |
Latest revision as of 11:21, 25 October 2012
Contents
Met Station Based Climate Data
Climate data in this form is based on having a single file for each meteorological station available. Each base station is represented by it's own base station file, and separate files for each climate variable as listed in the base station file. At the very least, daily time series of tmin, tmax, and rain are required.
Climate inputs are linked to particular zones by the climate station ID affiliated with that zone. A single climate station (or base station) will typically serve multiple zones within the landscape. Each base station is described by a base station file.
Example Base Station File:
101 base_station_id 100.0 x_coordinate 100.0 y_coordinate 22.9 z_coordinate 2.0 effective_lai 22.9 screen_height clim\rbw_prime_annual annual_climate_prefix 0 number_non_critical_annual_sequences clim\rbw_prime_monthly monthly_climate_prefix 0 number_non_critical_monthly_sequences clim\rbw daily_climate_prefix 2 ndep_NO3 ndep_NH4 0 clim\rbw_prime_hourly hourly_climate_prefix 0 number_non_critical_hourly_sequences
Climate Input Sequence Name / File Extension | Description | Units |
rain | precipitation (rain + snow)* required | meters |
tmin | minimum daily temperature* required | °C |
tmax | maximum daily temperature* required | °C |
tavg | average daily temperature | °C |
dayl | day length | seconds |
daytime_rain_duration | duration of rainfall | hours |
LAI_scalar | zone and seasonal scaling of LAI - only applied to stratum of non-zero height |
Unitless |
Ldown | incoming longwave radiation | KJ / (meters2)/day |
Kdown_direct | incoming direct shortwave radiation | KJ / (meters2)/day |
Kdown_diffuse | incoming diffuse shortwave radiation | KJ / (meters2)/day |
ndep_NO3 | nitrogen deposition as NO3 | kg / (meters2)/day |
ndep_NH4 | nitrogen deposition as NH4 | kg / (meters2) /day |
PAR_direct | incoming direct PAR radiation | KJ / (meters2)/day |
PAR_diffuse | incoming diffuse PAR radiation | KJ / (meters2)/day |
relative_humidity | Relative Humidity | Range (0-1) |
tday | Mean Daytime Temperature | °C |
tnightmax | Night time temperature at sundown (used for soil heat flux) | °C |
tsoil | Soil temperature | °C |
vpd | Vapour pressure deficit | Pa |
wind | Wind speed | meters/ sec. |
CO2 | Carbon Dioxide | parts per million/year |
lapse_rate_tmin | minimum daily temperature lapse rate with elevation | °C/m |
lapse_rate_tmax | maximum daily temperature lapse rate with elevation | °C/m |
All possible base station filenames must be listed in the worldfile header, as described in the discussion of grass2world below.
Format for Time Series Input Files
The first line of each input time series file must give the start date of the time series. The start date of the input must precede the start date listed in the worldfile. Following the start date, time series values are listed sequentially. For example: example_simulation_daily.rain will contain the following
1986 1 1 1 0.0028 0.000 0.0157 0.000 …
ASCII Gridded Climate Data
Climate data in gridded form is not tied to any particular met station, but is a grid of climate data over the watershed such as an interpolation between multiple climate stations, or downscaled data from a climate model. While it is possible to fake gridded climate data by representing each grid cell as a unique climate station, using gridded climate files is easier to work with.
Gridded climate data will have only a single base file, and a single file for each climate variable. The base file is identical to that of non-gridded climate data,
except that the first line that set the base station id is replaced with a line specifying the total number of grid cells. So if you had a gridded climate dataset
identical to the one specified above, but with 4 cells, your climate base file would be:
4 grid_cells 100.0 x_coordinate 100.0 y_coordinate 22.9 z_coordinate 2.0 effective_lai 22.9 screen_height clim\rbw_prime_annual annual_climate_prefix 0 number_non_critical_annual_sequences clim\rbw_prime_monthly monthly_climate_prefix 0 number_non_critical_monthly_sequences clim\rbw daily_climate_prefix 2 ndep_NO3 ndep_NH4 0 clim\rbw_prime_hourly hourly_climate_prefix 0 number_non_critical_hourly_sequences
The climate variable files will look similar to those from the standard met station based climate input with three important differences.
(1) The first line specifies the total number of grid cells at the top of the climate file.
(2) The third line (after the start date, which is now your second line) specifies the grid cell index for each column of data. These numbers must match
up with the values of the GIS map specified as the base_station_ID variable in your template file.
(3) The fourth line is the elevation for the grid cell, which will also match the values of your zone elevations within your world file.
The following is a climate file with four grid cells with index numbers 1-4, their elevations, and four climate data values specific to their cell:
Grid Cell Index | Elevation | Climate Data for Grid Cell Index | |
1 | 100.1 | 24, 24, 21, 19 | |
2 | 200.2 | 26, 25, 23, 21 | |
3 | 300.3 | 27, 25, 22, 19 | |
4 | 400.4 | 23, 21, 22, 18 |
4 1986 1 1 1 1 2 3 4 100.1 200.2 300.3 400.4 24 26 27 23 24 25 25 21 21 23 22 22 19 21 19 18 …
Running RHESSys with ASCII Gridded Climate Data
- Edit your template file to refer to the climate base file.
- When running RHESSys, use the command line option '-asciigrid' and RHESSs will properly deal with your ASCII gridded climate data.
NetCDF Gridded Climate Data
Similar to the ASCII gridded climate strategy described above, RHESSys can read NetCDF files as spatially distributed climate inputs. The method to implement is also similar: (1) setup a unique ID grid based on your NetCDF grid cells and assign zone IDs, (2) use a script to setup a NetCDF base station file, (3) run RHESSys with the NetCDF grid flag.
There is a bit of setup required to use NetCDF climate inputs. In particular, you need to create a unique ID map to match zone IDs to NetCDF cells and you need to create ID, elevation, lai, and screen height ascii maps to use as inputs to the createbas_netcdf script to create a NetCDF base station file. Specific steps are described below.
Steps to generate x and y maps for using netcdf climate files:
- Run gdal steps to convert from netcdf to TIF for one variable.
- Create new GRASS location using TIF file as region/projection.
- Use g.region to set resolution to match your patch map (e.g., 30m).
- Use r.proj to import your full basin extent.
- Use g.region to set region to basin extent.
- Use cxy to generate x and y maps and unique ID map.
- Import dem and lai maps into netcdf location and generate summary statistics by unique grid cell ID.
- Generate screen height map.
- Export cellid, dem, lai, and screen ascii files.
- Generate x and y coord text files.
- Use createbas_netcdf and ascii maps to generate base station file.
- Use r.proj to import the grid cell unique ID map into your main location (where patch map, etc. live).
- Generate worldfile using the unique cell ID map as the zone base station ID map.
Example Commands (using DAYMET NetCDF format)
Steps to convert NetCDF to TIF:
Get metadata:
gdalinfo tmax.nc gdalinfo NETCDF:tmax.nc:lat
Replace the coordinates in the ullr below with the ones reported in the metadata (upperleft_x upperleft_y lowerright_x lowerright_Y):
(projection info below is for DAYMET; replace for other climate inputs)
gdal_translate -of GTiff -a_ullr -535000.000 -672000.000 -347000.000 -895000.000 -a_srs "+proj=lcc +datum=WGS84 +lat_1=25 n +lat_2=60n +lat_0=42.5n +lon_0=100w" NETCDF:"tmax.nc":tmax tmax1980.tif
GRASS processing:
In GRASS, create a new NetCDF location to match the TIF you just created.
Import needed maps from your main project GRASS location:
r.in.gdal input=tmax1980.tif output=tmax80 band=1 g.region res=100 r.proj location=grasssf mapset=patch_fullveg input=basin.fullveg output=basin --overwrite r.proj location=grasssf mapset=patch_fullveg input=dem30m output=dem --overwrite r.proj location=GRASStemp mapset=upforks input=modlaigap_090829 output=modlai --overwrite
Create unique ID map:
(example below is for DAYMET at 1000-m resolution)
g.region rast=tmax80 cxy -v xmap=xmap1k ymap=ymap1k --overwrite r.mapcalc "xy1k=xmap1k+ymap1k" g.region rast=basin align=tmax80 res=1000 r.clump input=xy1k output=uni1k --overwrite
Generate average elevation by unique cell ID and clip grid cells to extent of DEM (matches basin):
g.region res=100 r.statistics base=uni1k cover=dem method=average output=dem1k_rc --overwrite g.region res=1000 r.mapcalc "dem1k=@dem1k_rc" r.mapcalc "uni1k=if(isnull(dem1k),dem1k,uni1k)" r.clump input=uni1k output=uni1k --overwrite
Generate average LAI by unique cell ID:
g.region res=100 r.statistics base=uni1k cover=modlai method=average output=lai1k_rc --overwrite g.region res=1000 r.mapcalc "lai1k=@lai1k_rc"
Generate screen height map:
(this example sets screen height to 2 m for all grid cells)
r.mapcalc "two=2.0"
Output ascii files:
r.out.arc input=uni1k output=cellid.asc r.out.arc input=dem1k output=dem.asc r.out.arc input=lai1k output=lai.asc r.out.arc input=two output=screen.asc
Create base station file:
Generate files for coords table:
First convert to integer for running statistics (may use multipliers to maintain precision if needed):
g.region res=1000 r.mapcalc "xmap1ki=int(xmap1k)" r.statistics base=uni1k cover=xmap1ki method=average output=xmap1ki_rc --overwrite r.category xmap1ki_rc > id_x.txt r.mapcalc "ymap1ki=int(ymap1k)" r.statistics base=uni1k cover=ymap1ki method=average output=ymap1ki_rc --overwrite r.category ymap1ki_rc > id_y.txt
Outside of GRASS, merge these two x, y coord text files into one list with: ID XCOORD YCOORD
The file should look something like:
1 -1609500 -432500 2 -1608500 -432500 3 -1607500 -432500 ...
Run script to make base station file:
createbas_netcdf cellid.asc lai.asc dem.asc screen.asc id_xy.txt netcdf_base.txt
Your base station file should look something like the sample below. Edit lines 2-12 as needed:
1111 grid_cells 708 location_searching_distance /* Max distance that the routine will search for a NetCDF grid cell in native units. This value is for a 1000-m grid cell resolution. */ 1980 year_start_index /* In DAYMET, the time index counts up from 1/1/1980. Change this year to start the index at another year (on 1/1/XXXX). */ 0 day_offset /* If you need to offset the day index. There is some issue with NetCDF4 where this should be 1 (left in from orig mingliang code). */ 1 leap_year_include /* Whether or not to include leap year additional days (1=include, 0=clip to 365). */ 0.001 precip_multiplier /* Precip multiplier if needed (e.g., this value converts from NetCDF precip in mm to RHESSys precip in m). */ ../clim/daymet_netcdf/tmax_19802011.nc netcdf_tmax_filename /* Pathname to the Tmax NetCDF file. */ tmax netcdf_var_tmax /* Variable name for tmax in the NetCDF file. */ ../clim/daymet_netcdf/tmin_19802011.nc netcdf_tmin_filename /* Pathname to the Tmin NetCDF file. */ tmin netcdf_var_tmin /* Variable name for tmin in the NetCDF file. */ ../clim/daymet_netcdf/prcp_19802011.nc netcdf_rain_filename /* Pathname to the Precip NetCDF file. */ prcp netcdf_var_rain /* Variable name for precip in the NetCDF file. */ 1 base_station_id -1609500.000000 x_coordinate -432500.000000 y_coordinate 1892.823486 z_coordinate 2.900000 effective_lai 2.000000 screen_height 2 base_station_id -1608500.000000 x_coordinate -432500.000000 y_coordinate 1856.814819 z_coordinate 2.900000 effective_lai 2.000000 screen_height ...
Go to your main project GRASS location (where your patch map, etc. live).
Import necessary maps:
r.proj location=grass_daymet mapset=PERMANENT input=uni1k output=uni1k --overwrite
Use this map in the template as the zone base station ID map.
Running RHESSys with NetCDF Gridded Climate Data
- Edit your template file to refer to the NetCDF climate base file.
- When running RHESSys, use the command line option '-netcdfgrid' and RHESSs will properly deal with your NetCDF gridded climate data.