Skip to contents

Function extracts precipitation (tp) or temperature (tas_) data from climate raster bricks (observed history obs_hist, GCM-simulated history hist_sim and GCM-simulated future (fut_sim) and prepares a dataframe for later import in RSMinerve (use readr::write_csv(.,col_names=FALSE)). tp and tas_ have to be exported, the function has to be called twice and the resulting tibble columns added.

Usage

gen_HRU_Climate_CSV_RSMinerve(
  climate_files,
  catchmentName,
  temp_or_precip,
  elBands_shp,
  startY,
  endY,
  obs_frequency,
  climate_data_type,
  crs_in_use,
  output_file_dir = 0,
  gcm_model = 0,
  gcm_scenario = 0,
  tz = "UTC"
)

Arguments

climate_files

List of either temperature or precipitation climate .nc files to process (do not mix!). Make sure the file list time interval is consistent with startY and endY.

catchmentName

Name of catchment for which data should be extracted

temp_or_precip

Either 'Temperature' or 'Precipitation'

elBands_shp

Shapefile with hydrological response units. The column containing the names of the hydrological response units must be name and the column containing the average elevation of the elevation band must be Z. Please make sure that the shape file is in UTM coordinates.

startY

Starting year for which data should be made available (assuming data 'is' available from the start of that year)

endY

Ending year from which data should be extracted (assuming data 'is' actually available until the end of that year)

obs_frequency

Climate observation frequency ('hour', 'day', 'month')

climate_data_type

String of denoting observation type. Either 'hist_obs' (historical observations, i.e. CHELSA V21 high resolution climate data), 'hist_sim' (GCM model output data over the historical period) and 'fut_sim' (fture GCM simulations)

crs_in_use

Proj code for crs in use. For example '+proj=longlat +datum=WGS84' for epsg 4326

output_file_dir

Path to output file dir (if empty, file will not be written)

tz

Time zone information. Default "UTC" which can be overridden.

Value

Dataframe tibble with temperature in deg. C. or precipitation in mm/h

Note

This function currently can only read input files with full years of data, that is, with data from January to December of a given year.