Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in list_layers() and download_dataset() #9

Merged
merged 2 commits into from
Jun 26, 2023
Merged

Changes in list_layers() and download_dataset() #9

merged 2 commits into from
Jun 26, 2023

Conversation

salvafern
Copy link
Member

Changes:

New helper function to get the default URL of ERDDAP.

erddap.bio_oracle.org <- function(){

Can be overriden via options('ERDDAP.BIO-ORACLE.URL') for testing

list_layers()

  • Allows now free text search, e.g. list_layers('Ocean Temperature')
  • Provides a simplified version by default with only the dataset ID, title and summary.
list_layers("Ocean Temperature", simplify = TRUE)
#> # A tibble: 28 × 3
#> dataset_id                          title                       summary
#> <chr>                               <chr>                       <chr>  
#> 1 thetao_baseline_2000_2019_depthmax  Bio-Oracle OceanTemperatur… "Uses …
#> 2 thetao_ssp119_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 3 thetao_ssp126_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 4 thetao_ssp245_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 5 thetao_ssp370_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 6 thetao_ssp460_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 7 thetao_ssp585_2020_2100_depthmax    Bio-Oracle OceanTemperatur… "Uses …
#> 8 thetao_baseline_2000_2019_depthmean Bio-Oracle OceanTemperatur… "Uses …
#> 9 thetao_ssp119_2020_2100_depthmean   Bio-Oracle OceanTemperatur… "Uses …
#> 10 thetao_ssp126_2020_2100_depthmean   Bio-Oracle OceanTemperatur… "Uses …
#> # … with 18 more rows

download_dataset()

# Example dataset
dataset_id = "tas_baseline_2000_2020_depthsurf"
time = c('2001-01-01T00:00:00Z', '2010-01-01T00:00:00Z')
latitude = c(10, 20)
longitude = c(120, 130)
variables = c("tas_mean")
constraints = list(time, latitude, longitude)
names(constraints) = c("time", "latitude", "longitude")

# Perform
download_dataset(dataset_id, variables, constraints, fmt = "raster")
#> Selected dataset tas_baseline_2000_2020_depthsurf.
#> Dataset info available at: http://erddap.bio-oracle.org/erddap/griddap/tas_baseline_2000_2020_depthsurf.html
#> Selected 1 variables: tas_mean
#> info() output passed to x; setting base url to: http://erddap.bio-oracle.org/erddap
#> class       : SpatRaster 
#> dimensions  : 201, 201, 4  (nrow, ncol, nlyr)
#> resolution  : 0.05000694, 0.0500139  (x, y)
#> extent      : 119.9667, 130.0181, 9.952765, 20.00556  (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 
#> sources     : f9db8428abb69301c6f80584b16feaf5.nc:tas_max  (2 layers) 
#> f9db8428abb69301c6f80584b16feaf5.nc:tas_min  (2 layers) 
#> varnames    : tas_max (Maximum AirTemperature) 
#> tas_min (Minimum AirTemperature) 
#> names       : tas_max_1, tas_max_2, tas_min_1, tas_min_2 
#> unit        :         K,         K,         K,         K 
#> time        : 2000-01-01 to 2010-01-01 UTC 

Copy link
Member

@vinisalazar vinisalazar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice job @salvafern. I will try to add the text search, simplify and memoisation features to the Python counterpart.

@jorgeassis
Copy link

jorgeassis commented Jun 25, 2023 via email

@salvafern salvafern removed the request for review from jorgeassis June 26, 2023 08:07
@salvafern salvafern merged commit 31176c6 into master Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants