Giter Site home page Giter Site logo

rpaleoclim's Introduction

rpaleoclim: download paleoclimate data from PaleoClim in R

Project Status: Active โ€“ The project has reached a stable, usable state and is being actively developed. CRAN status R-CMD-check Codecov test coverage DOI

PaleoClim is a set of free, high resolution paleoclimate surfaces covering the whole globe. It includes data on surface temperature, precipitation and the standard bioclimatic variables commonly used in ecological modelling, derived from the HadCM3 general circulation model and downscaled to a spatial resolution of up to 2.5 minutes.

This package provides a simple interface for downloading PaleoClim data in R, with support for caching and filtering retrieved data by period, resolution, and geographic extent.

Installation

You can install the latest release of rpaleoclim from CRAN with:

install.packages("rpaleoclim")

Or the development version from GitHub using the remotes package:

remotes::install_github("joeroe/rpaleoclim")

Usage

The package includes two functions, paleoclim() and load_paleoclim(). paleoclim() downloads data from PaleoClim with the desired period and resolution and reads it into R as a SpatRaster object.

library("rpaleoclim")
library("terra") # For plotting

paleoclim("lh", "10m") |>
  plot()

By default, files from PaleoClim are cached in a local temporary directory to avoid repeated download of the same data. load_paleoclim() reads local PaleoClim files (in .zip format) in the same way.

For further details see the introduction to rpaleoclim vignette (vignette("rpaleoclim")).

Citation

Please follow the instructions from the authors when citing PaleoClim data. At time of writing, this includes a citation to the paper the describing the PaleoClim database:

As well as the original papers for the individual original datasets used.

Use citation("paleoclim") for more details and the references in BibTeX format.

rpaleoclim's People

Contributors

joeroe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hansonmenghan

rpaleoclim's Issues

Release rpaleoclim 1.0.1

Prepare for release:

  • git pull
  • Check current CRAN check results
  • Polish NEWS
  • urlchecker::url_check()
  • devtools::build_readme()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • revdepcheck::revdep_check(num_workers = 4)
  • Update cran-comments.md
  • git push

Submit to CRAN:

  • usethis::use_version('patch')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • usethis::use_github_release()
  • usethis::use_dev_version(push = TRUE)

pkgcheck results - master

Checks for rpaleoclim (v0.9)

git hash: 49e77025

  • โœ”๏ธ Package name is available
  • โœ”๏ธ has a 'CITATION' file.
  • โœ”๏ธ has a 'codemeta.json' file.
  • โœ–๏ธ does not have a 'contributing' file.
  • โœ”๏ธ uses 'roxygen2'.
  • โœ”๏ธ 'DESCRIPTION' has a URL field.
  • โœ”๏ธ 'DESCRIPTION' has a BugReports field.
  • โœ–๏ธ Package has no HTML vignettes
  • โœ–๏ธ These functions do not have examples: [construct_paleoclim_url, load_paleoclim, paleoclim].
  • โœ”๏ธ Package has continuous integration checks.
  • โœ”๏ธ Package coverage is 100%.
  • โœ”๏ธ R CMD check found no errors.
  • โœ”๏ธ R CMD check found no warnings.

Important: All failing checks above must be addressed prior to proceeding

Package License: MIT + file LICENSE

Add tests

The PaleoClim URLs don't seem to be particularly stable, so having tests to check that the downloads still work is essential for this package.

Issues pulling specific paleoclim rasters

I'm having issues downloading specific raster sets (at any resolution). These include the LGM and MPWP right now, but may also include others that I haven't tested yet. Any ideas why this might be?

trying URL 'http://sdmtoolbox.org/paleoclim.org/data/chelsa_LGM/chelsa_LGM_v1_2B_r10m.zip'
Content type 'application/zip' length 17468981 bytes (16.7 MB)

downloaded 63 KB

Error in utils::download.file(url, tmpfile, "auto") :
download from 'http://sdmtoolbox.org/paleoclim.org/data/chelsa_LGM/chelsa_LGM_v1_2B_r10m.zip' failed
In addition: Warning messages:
1: In utils::download.file(url, tmpfile, "auto") :
downloaded length 65380 != reported length 17468981
2: In utils::download.file(url, tmpfile, "auto") :
URL 'http://sdmtoolbox.org/paleoclim.org/data/chelsa_LGM/chelsa_LGM_v1_2B_r10m.zip': Timeout of 60 seconds was reached

curl timeout in workflows

Error in curl::curl_download(url, tmpfile, quiet = quiet) :
Timeout was reached: [] Connection timed out after 10000 milliseconds

I sporadically see this error in R CMD check workflows, in the example for paleoclim(). It varies from whether 1-3 will fail, but it's always at least one, and usually Windows. I haven't been able to reproduce it locally, even on very spotty connections and even after htting SDMtoolbox.org repeatedly.

The timeout is on receiving any response from the server, not downloading the file, so this is a separate issue from #2.

According to jeroen/curl#72 it could have something to do with bad DNS but I find it a bit surprising this would affect GitHub Actions.

I've tried working around it by dropping the example, but this is holding up submission to rOpenSci (#9) and is obviously not ideal anyway. I've also tried \donttest, but since this is now run on CRAN and using R CMD check --as-cran, it doesn't help. \dontrun maybe would, but it isn't recommended for CRAN submissions apparently.

Next to try: increasing the timeout limit manually per jeroen/curl#173

Release rpaleoclim 1.0.0

First release:

Prepare for release:

  • git pull
  • Check if any deprecation processes should be advanced, as described in Gradual deprecation
  • devtools::build_readme()
  • urlchecker::url_check()
  • devtools::check(remote = TRUE, manual = TRUE)
  • devtools::check_win_devel()
  • rhub::check_for_cran()
  • git push
  • Draft blog post

Submit to CRAN:

  • usethis::use_version('major')
  • devtools::submit_cran()
  • Approve email

Wait for CRAN...

  • Accepted ๐ŸŽ‰
  • git push
  • usethis::use_github_release()
  • usethis::use_dev_version()
  • git push
  • Finish blog post
  • Tweet
  • Add link to blog post in pkgdown news menu

Add cache_path parameter

Defaulting to fs::path_temp as now, but allowing the user to e.g. cache files in the working directory to reuse between sessions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.