This function extracts climate data from the CORDEX-BC dataset and organizes
it into a nested list. The function requires the elevatr and raster
packages to be installed.
Arguments
- dir_path
 Character, path to the CORDEX-BC folder (e.g., "climate/CORDEX-BC"). NetCDF data to be recognized by the function should be saved with these specific file names:
"prec.nc" for precipitation,
"relHum.nc" for relative humidity,
"solarRad.nc" for solar radiation,
"Tmax.nc" for maximum daily temperature,
"Tmin.nc" for minimum daily temperature,
"windSpeed.nc" for wind speed. Ensure that the NetCDF files are correctly named and stored in the specified directory for the function to recognize them.'
- location
 Character or list. If character, provide the path to the catchment boundary file (e.g., "GIS/basin.shp"). If a list, use the nested list with dataframes. The nested structure is same as prepared by using
load_templateorload_swat_weatherfunctions.
Value
Nested list. The first nesting level is for RCP, the second for RCM model numbers,
and the rest follows the structure of meteo_lst. Nested structure: meteo_lst ->
  data -> Station ID -> Parameter -> Dataframe (DATE, PARAMETER),
meteo_lst -> stations -> Dataframe (ID, Name, Elevation, Source, geometry,
  Long, Lat). This nested list structure can be used with
other package functions (e.g., plot_weather(result$rcp26$"1", "PCP", "month", "sum")).
Examples
if (FALSE) { # \dontrun{
  # Specify the path to the catchment boundary file
  catchment_boundary_path <- system.file("extdata", "GIS/basin.shp", package = "SWATprepR") 
  
  # Specify the path to the CORDEX-BC data
  data_path <- "climate/CORDEX-BC"
  
  # Extract and organize climate data
  result <- load_netcdf_weather(data_path, catchment_boundary_path)
} # }
