get_ereefs_slice: Extract a vertical slice or depth-resolved transect from an...

View source: R/vertical_profiles.R

get_ereefs_sliceR Documentation

Extract a vertical slice or depth-resolved transect from an eReefs or other EMS netcdf output file.

Description

Extracts either a series of vertical profiles at points corresponding to a dataFrame of specified latitudes and longitudes (e.g. a cruise transect) or a vertical slice along a line between two specified points, at a specified point in time. Instead of interpolating, this function takes the values of cells intersected by the line segment, which can cause some striping when lines transect the grid diagonally.

Usage

get_ereefs_slice(
  var_names = c("Chl_a_sum", "TN"),
  location_latlon = data.frame(latitude = c(-20, -20), longitude = c(148.5, 149)),
  target_date = c(2016, 2, 4),
  input_file = "menu",
  input_grid = NA,
  eta_stem = NA,
  robust = FALSE,
  override_positive = FALSE
)

Arguments

location_latlon

A data frame of latitudes and longitudes. Defaults to data.frame(latitude=c(-20, -20), longitude=c(148.5, 149)). If length(location_lat_lon)==2, extract every grid cell along a straight line between the two points specified. Otherwise, extract only the locations corresponding to the cells nearest the specified points.

target_date

Target date to extract profile. Can be a date, or text formatted for as.Date(), or a (year, month, day) vector. Defaults to c(2016, 02, 04). If target_date is a vector, 0.499 is added to the calculated date to bring it as close to midday as possible.

input_file

is the URL or file location of any of the EMS output files or a THREDDS catalog URI. Defaults to a menu selection based on current NCI catalogs. Can also be set to "nci", "menu" or "catalog" for the same behaviour. Set to "old_menu" to provide old menu options instead of menu options from the NCI catalog. Numeric values are interpreted as references to selections available from the old menu. Short codes can be used for some options (codenames as used in https://research.csiro.au/ereefs/models/model-outputs/access-to-raw-model-output/ )

input_grid

Name of the locally-stored or opendap-served netcdf file that contains the grid coordinates for the top and bottom of each layer (z_grid). If not specified, the function will first look for z_grid can be found in the first INPUT_STEM file, and if not found, will check whether the size of the variables in the input file corresponds to the size expected for GBR4 or GBR1, and load an appropriate z grid from data files stored in this package. Alternatively, you can provide the location of a full (not simple-format) ereefs netcdf output file such as "http://dapds00.nci.org.au/thredds/dodsC/fx3/gbr4_hydro_all/gbr4_all_2016-09.nc"

eta_stem

The URI or file location of the model output files that contains the surface elevation (eta), or the stem of that filename minus the date components of the filename in the case of GBR1 or GBR4 files, and ommitting the file extension, ".nc". Needed only if eta is not in the file indicated by input_file (e.g. some GBR1 bgc files).

robust

If TRUE, extract one profile at a time to avoid running out of memory. Relatively robust but slow. Default FALSE.

override_positive

Reverse the value of the "positive" attribute of botz for BGC files, assuming that it is incorrect. Default FALSE

var_name

A vector of EMS variable names. Defailts to c('Chl_a_sum', 'TN'))

Value

a list containing an array of surface elevations (eta), bottom depths (botz), the locations of the cell centres of the intersected cells (cell_centres), the locations of the cell edge points where the line intersects the grid edges (cell_intersections), and the vertical grid (z_grid) and a data frame of tracer values from the model (values) and 'crossref', which indicates the starting cell in the returned values array associated with each input location.


BarbaraRobson/ereefs documentation built on April 23, 2023, 5:47 a.m.