Learn R Programming

⚠️There's a newer version (0.5.3) of this package.Take me there.

Resourcecode

The goal of {resourcecode} is to provide an easy access to the Resourcecode hindcast database of sea-states. More information on the database can be found here. This website only contains information about the way to retrieve data from this data base and the functionalities offred by this package.

Installation

The {resourcecode} package is on CRAN so you can simply run :

install.packages("resourcecode")

You can install the development version of {resourcecode} thanks to r-universe:

install.packages("resourcecode",
  repos = c(
    "https://resourcecode-project.r-universe.dev",
    "https://cloud.r-project.org"
  )
)

or using the classical:

devtools::install_github("Resourcecode-project/r-resourcecode")

This package depends on data in a data package {resourcecodedata} that is available on CRAN on will be installed when installing the package for the first time.

Examples

Plot the bathymetry used in the project

library(resourcecode)
library(resourcecodedata)
resourcecode::rscd_mapplot(rscd_field$depth, name = "Depth (m)", transform = "sqrt")

See the variables available in the database:

head(rscd_variables)
#>        name         longname         unit
#> 1 longitude        longitude  degree_east
#> 2  latitude         latitude degree_north
#> 3       tri              tri             
#> 4    MAPSTA       status map            1
#> 5       dpt            depth            m
#> 6      ucur eastward current        m s-1

Download a time series of significant wave height next to the coast of Finistère:

data <- get_parameters(node = "134865", parameters = "hs")
str(data)
#> tibble [8,760 × 2] (S3: tbl_df/tbl/data.frame)
#>  $ time: POSIXct[1:8760], format: "1994-01-01 00:00:00" "1994-01-01 01:00:00" ...
#>  $ hs  : num [1:8760] 4.82 4.98 5.19 5.37 5.48 ...
#>  - attr(*, "node")= num 134864
plot(data, type = "l")

Copy Link

Version

Install

install.packages('resourcecode')

Monthly Downloads

423

Version

0.5.1

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Nicolas Raillard

Last Published

December 16th, 2025

Functions in resourcecode (0.5.1)

zmcomp2metconv

Convert u/v to meteorological wind speed and direction
rscd_freq

Resourcecode frequency vector of 1D and 2D spectra
metconv2zmcomp

Convert meteorological wind speed and direction to u/v components
rscd_mapplot

Create a map of the provided variable on the RESOURCECODE field grid
plot_1d_specta

Plot a wave density 1D spectrum at a given time
weather_windows

Compute Weather Windows
plot_2d_specta

Plot a wave density 2D spectrum
fractional_day_of_year

Compute Fractional Day of Year from POSIXct
get_parameters

Download time series of sea-state parameters from RESOURCECODE database
rscd_data_example

Resourcecode data extract
rscd_dir

Resourcecode directional bins
resourcecode-package

resourcecode: Access to the 'RESOURCECODE' Hindcast Database
cut_seasons

Get season from date time object
compute_orbital_speeds

Compute the orbital speed at a given depth from the wave elevation 1D spectra
closest_point_field

Find the closest point of the FIELD grid to the specified position
closest_point_spec

Find the closest point of the SPEC grid to the specified position
compute_sea_state_2d_spectrum

Compute sea_state parameter from wave directional spectrum
compute_sea_state_1d_spectrum

Compute sea_state parameter from wave spectrum
fastTrapz

Fast implementation of pracma::trapz from the Armadillo C++ library
dispersion

Compute the dispersion relation of waves Find k s.t. (2.pi.f)^2 = g.k.tanh(k.d)
convert_spectrum_2d1d

Converts a 2D spectrum time series to a 1D spectrum
cut_directions

Directional binning
mean_direction

Mean Direction
get_2d_spectrum

Download the 2D spectrum data from IFREMER ftp
jonswap

JONWSAP spectrum
%nin%

Value Matching
get_1d_spectrum

Download the 1D spectrum data from IFREMER ftp