Skip to content

R package to ease access to NetCDF data sources

License

Notifications You must be signed in to change notification settings

BigelowLab/rray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rray

An R package to explore easy access to NetCDF data sources modeled after the super convenient xarray. The desired outcomes are

  • ease of exploration of NetCDF contents

  • ease of extracting to georeferenced objects (sf, stars, terra)

Requirements

Installation

remotes::install_github("BigelowLab/rarr")
suppressPackageStartupMessages({
  library(rray)
  library(tidync)
  library(stars)
})

url = oisst_example_url()

Path 1: rolling up an R6 package

X = Rarr$new(url)
X
## dimension name: time   units: days since 1800-01-01 00:00:00   length: 365 
##   vals: 2023-01-01, 2023-01-02, 2023-01-03  ...  2023-12-28, 2023-12-29, 2023-12-30 
## dimension name: lat   units: degrees_north   length: 720 
##   vals: -89.875, -89.625, -89.375  ...  89.125, 89.375, 89.625 
## dimension name: lon   units: degrees_east   length: 1440 
##   vals: 0.125, 0.375, 0.625  ...  359.125, 359.375, 359.625 
## variable name: sst   units: degC   longname: Daily Sea Surface Temperature 
##   dims:  lon, lat, time [1440, 720, 365]

Path 2: using tidync

Y = tidync(url)
## not a file: 
## ' http://psl.noaa.gov/thredds/dodsC/Datasets/noaa.oisst.v2.highres/sst.day.mean.2023.nc '
## 
## ... attempting remote connection

## Connection succeeded.
Y
## 
## Data Source (1): sst.day.mean.2023.nc ...
## 
## Grids (4) <dimension family> : <associated variables> 
## 
## [1]   D2,D1,D0 : sst    **ACTIVE GRID** ( 378432000  values per variable)
## [2]   D0       : time
## [3]   D1       : lat
## [4]   D2       : lon
## 
## Dimensions 3 (all active): 
##   
##   dim   name  length      min    max start count     dmin   dmax unlim coord_dim 
##   <chr> <chr>  <dbl>    <dbl>  <dbl> <int> <int>    <dbl>  <dbl> <lgl> <lgl>     
## 1 D0    time     365  8.14e+4 8.18e4     1   365  8.14e+4 8.18e4 TRUE  TRUE      
## 2 D1    lat      720 -8.99e+1 8.99e1     1   720 -8.99e+1 8.99e1 FALSE TRUE      
## 3 D2    lon     1440  1.25e-1 3.60e2     1  1440  1.25e-1 3.60e2 FALSE TRUE

About

R package to ease access to NetCDF data sources

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages