View source: R/misc functions.R
Window | R Documentation |
This function works out how much of a netcdf file to read, to capture the data between a given Lat-Lon window.
Window(file, w = NULL, e = NULL, s = NULL, n = NULL, shift = FALSE, sf = NULL)
file |
The full name of a netcdf file containing a longitude and latitude dimension. |
w |
Degrees West to read from. |
e |
Degrees East to read to. |
s |
Degrees South to read from. |
n |
Degrees North to read to. |
shift |
True/False does the file use 0-360 longitudes? If yes, negative longitudes are corrected. |
sf |
An sf polygon can be supplied instead of 'w','e','s', and 'n'. The function takes these values from the bounding box. |
The function reads in a vector for both latitudes and longitudes, and tests whether each entry is within the specified window. The max and min position in these vectors where the condition == TRUE are taken to define the ends of the window to import. The vectors of latitudes and longitudes between these limits are kept, so they can be added to the variables of interest during extraction.
A list of three elements:
Lats - A vector of latitudes from 's' to 'n'.
Lons - A vector of longitudes from 'w' to 'e'.
Limits - A dataframe containing the index to start reading from (Lon_start, Lat_start) and the length of the vector to read (Lon_count, Lat_count.
Other NEMO-MEDUSA spatial tools:
Update-drivers
,
sfc_as_cols()
,
vectors_2_direction()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.