step_earthtide: step_earthtide

View source: R/api_recipes.R

step_earthtideR Documentation

step_earthtide

Description

Generate synthetic Earth tide waves and wave groups.

Usage

step_earthtide(
  .rec,
  terms,
  do_predict = TRUE,
  method = "gravity",
  latitude = 0,
  longitude = 0,
  elevation = 0,
  azimuth = 0,
  gravity = 0,
  earth_radius = 6378136.3,
  earth_eccentricity = 0.0066943979514,
  cutoff = 1e-06,
  catalog = "ksm04",
  eop = NULL,
  scale = TRUE,
  n_thread = 1L,
  astro_update = 1L,
  interp_factor = 1L,
  role = "predictor",
  ...
)

Arguments

.rec

the R6 recipe object.

terms

the unquoted names of the variables to use or a selector function. terms replaces the '...' of the recipes package but requires variables to be included within 'c()'. For example to include variables x and y you would write 'c(x,y)' in the hydrorecipes package.

do_predict

run in predict or analyze mode

method

One or more of "gravity", "tidal_potential", "tidal_tilt", "vertical_displacement", "horizontal_displacement", "n_s_displacement", "e_w_displacement", "vertical_strain", "areal_strain", "volume_strain", "horizontal_strain", or "ocean_tides", "pole_tide", "lod_tide". The pole tide and lod_tide are used in predict mode even if do_predict is FALSE. More than one value can only be used if do_predict == TRUE.

latitude

The station latitude (numeric) defaults to 0.

longitude

The station longitude (numeric) defaults to 0.

elevation

The station elevation (m) (numeric) defaults to 0.

azimuth

Earth azimuth (numeric) defaults to 0.

gravity

Gravity at the station (m/s^2) (numeric) 0 to estimate gravity from elevation and latitude.

earth_radius

Radius of earth (m) (numeric) defaults to 6378136.3

cutoff

Cutoff amplitude for constituents (numeric) defaults to 1e-6.

catalog

Use the "hw95s" catalog or "ksm04" catalog (character).

eop

User defined Earth Orientation Parameter (EOP) data.frame with the following columns: datetime, ddt, ut1_utc, lod, x, y, dx, dy

scale

Scale results when do_predict is FALSE

n_thread

Number of threads to use for parallel processing (integer).

astro_update

How often to update astro parameters in number of samples. This speeds up code but may make it slightly less accurate.

interp_factor

calculate for every interp_factor samples. This may be faster while being more accurate than adjusting the cutoff.

role

character - the name of the role

...

additional arguments

Value

an updated recipe

Examples

data(kennel_2020)
latitude     <- 34.23411                           # latitude
longitude    <- -118.678                           # longitude
elevation    <- 500                                # elevation
cutoff       <- 1e-5                               # cutoff
catalog      <- 'ksm04'                            # hartmann wenzel catalog
astro_update <- 300                                # how often to update astro parameters
method       <- 'volume_strain'                    # which potential to calculate

wave_groups_dl <- as.data.table(earthtide::eterna_wavegroups)
wave_groups_dl <- na.omit(wave_groups_dl[time == '1 month'])
wave_groups_dl <- wave_groups_dl[wave_groups_dl$start > 0.5,]
wave_groups_dl <- wave_groups_dl[, list(start, end)]
ngr <- nrow(wave_groups_dl)

rec <- recipe(wl~baro+datetime, data = kennel_2020) |>
  step_earthtide(datetime,
                 wave_groups = wave_groups_dl,
                 latitude = latitude,
                 longitude = longitude,
                 elevation = elevation,
                 cutoff = cutoff,
                 catalog = catalog)

jkennel/hydrorecipes documentation built on Dec. 24, 2024, 5:38 p.m.