windscape 2.0.0
This release reorganizes windscape around a simpler workflow: download wind data or a pre-built wind rose, summarize the wind as a wind_rose, model connectivity with least-cost or random-walk functions that take the rose directly, and plot each step with ggplot2 layers.
Breaking changes
Wind data
-
cfsr_dl()andcfsr_dl_land()are replaced bydownload_wind_data()anddownload_land_mask(), which use NCAR’s Geoscience Data Exchange (see New features). -
cfsr_usaandkatrinadatasets replaced bywindscape_example(). -
wind_series()andwind_rose()now require lon/lat grids with (near-)square cells. - Selecting layers of a
wind_series,wind_field, orwind_rosewith[[orsubset(), or combining them withc(), now returns a plainSpatRaster, since the result no longer has the object’s structure. Usesubset_series()to select time steps of a series.
Wind roses
-
as_wind_rose()andread_wind_rose()are merged intowind_rose(), which builds a rose from awind_series, or loads a saved rose from an 8-layer raster or file path.rose()is no longer exported. -
wind_rose()no longer takes...(orcores); it gainsfilenameandoverwrite.transmust be a non-negative number or an elementwise function of wind speed. -
wind_rose(): cells missing wind data at any time step are nowNAin all eight layers, and calm time steps (zero wind speed) contribute no conductance whatevertransis (previously, withtrans = 0, they counted toward one fixed direction). -
terra::aggregate(),disagg(),resample(), andproject()now signal an error on awind_rose, since they would average conductances without accounting for cell size. Usedownscale(), or change the grid of thewind_seriesbefore building the rose.
Least-cost model
-
least_cost_surface()is renamedleast_cost(), andleast_cost_distance()is renamedpairwise_least_cost(). Both take awind_rosedirectly (awind_graphbuilt in advance is still accepted), andleast_cost()gains adirectionargument. -
vrcd()is removed.pairwise_least_cost()now places sites at their actual locations within grid cells (snap = FALSE, the default), replacing bothvrcd()and theadjustargument ofleast_cost_distance(). -
wind_graph():wrapnow defaults toNULL, which wraps global grids (spanning 360 degrees of longitude) automatically.
Random walk model
-
random_walk():"ratchet"mode removed; results are now a named list of rasters; arguments reordered (general arguments before mode-specific ones). The new latitude correction (on by default) changes results on lon/lat grids. -
random_walk()results are now per km^2 by default (density = TRUE). -
particle_flow()is replaced bywind_trails(), which traces trails for a given transport time (hours) or length (distance). -
tesselate()is removed; global grids now wrap automatically (seewraparguments).
New features
Wind data
-
download_wind_data()downloads hourly wind from NCAR’s Geoscience Data Exchange, with no account needed: ERA5 (1940 to present; 10 m and 100 m), CFSR (1979-2010), and CFSv2 (2011 to present; 10 m and pressure levels). Data are clipped to a bounding box on the server, can be limited to particulardaysandhours(down to a single hour), and are saved as one file per month, with downloads cached so interrupted runs resume. Large requests are split to fit the server’s size limit. -
download_land_mask()downloads a land-water layer on the same grid, e.g. forweight_conductance(). -
wind_series()combines file paths, rasters, or a list of series into one series that stays on disk. -
subset_series()selects time steps by month, hour, date range, or index, andwind_times()returns the time of each step. -
wind_field()gainsstep, to take one time step of a series as a field, andmean()of awind_seriesgives its mean wind field. -
windscape_example()loads small example data sets.
Wind roses
-
download_wind_rose()provides pre-built global wind roses (10 m CFSR, 1979-2010) for any combination of years and calendar months, optionally cropped to a region, which is read over the internet without downloading whole files.wind_rose_catalog()lists the available files andwind_rose_cache()manages downloaded ones. -
wind_rose()is about five times faster, processes long series in chunks of time steps without loading them into memory, and recordsn_stepsandtransin files written withfilename, so they reload withwind_rose(file)alone. -
combine_roses()combines roses built from different time periods, weighting them by their numbers of time steps. -
net_flow()returns a rose’s net flow as awind_field.
Least-cost model
-
least_cost_paths()traces fastest routes between sites and other points.
Random walk model
-
random_walk()gainsmode = "stream"(steady state of continuous release, returning residence time and deposition),half_life(deposition),latitude_correction,direction = "upwind"(catchments),flux(net flux of material),source, andwrap. -
pairwise_random_walk()computes random-walk connectivity among sets of sites. -
random_walk_paths()traces flux streamlines between a source and where its material goes, the random-walk analog ofleast_cost_paths(). -
rw_exit_prob()gives each cell’s probability of mass leaving the domain. -
rw_self_retention()for leave-one-out corrections of stream-mode results.
Plotting
- ggplot2 layers for each object:
geom_wind_arrow()andgeom_wind_trail()for wind fields,geom_wind_rose()for wind roses, andgeom_wind_path()for paths and trails, withscale_fill_bearing()andscale_colour_bearing()for direction-based colors, andfortify()methods for windscape objects.
Bug fixes
-
pairwise_least_cost()(formerlyleast_cost_distance(adjust = TRUE)) no longer returnsNaNon the diagonal. - windscape no longer masks
gdistance::geoCorrection(). - Removed hidden dependencies on dplyr and magrittr being attached.
