Skip to content

Commit

Permalink
update website
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaconet committed May 14, 2024
1 parent 83bb123 commit 1de55c2
Show file tree
Hide file tree
Showing 34 changed files with 394 additions and 2,684 deletions.
50 changes: 28 additions & 22 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
Package: modisfast
Title: Fast and efficient access to MODIS (and MODIS-like) data in R using the OPeNDAP Capacities
Title: Fast and efficient access to MODIS (and MODIS-like) data in R using
the OPeNDAP Capacities
Version: 0.1.0
Authors@R:
person(given = "Paul",
family = "Taconet",
role = c("aut", "cre"),
email = "[email protected]",
person("Paul", "Taconet", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7429-7204"))
Description: Provides functions to download MODIS and MODIS-like Earth science datacubes in a time-saving and efficient way : by sampling it at the very downloading phase (spatially, temporally and dimensionally) using the OPeNDAP framework.
Description: Provides functions to download MODIS and MODIS-like Earth
science datacubes in a time-saving and efficient way : by sampling it
at the very downloading phase (spatially, temporally and
dimensionally) using the OPeNDAP framework.
License: GPL-3
URL: https://github.com/ptaconet/modisfast
BugReports: https://github.com/ptaconet/modisfast/issues
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
VignetteBuilder: knitr
Depends: R (>= 2.10)
Depends:
R (>= 2.10)
Imports:
magrittr,
curl,
dplyr,
httr,
curl,
sf,
purrr,
lubridate,
xml2,
stringr,
rvest,
utils,
magrittr,
ncdf4,
parallel,
terra
purrr,
raster,
rvest,
sf,
stats,
stringr,
terra,
xml2
Suggests:
testthat,
emo,
knitr,
mapview,
rmarkdown
rmarkdown,
testthat
VignetteBuilder:
knitr
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.3.1
12 changes: 4 additions & 8 deletions NAMESPACE
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,13 @@ importFrom(lubridate,second)
importFrom(lubridate,yday)
importFrom(lubridate,year)
importFrom(magrittr,"%>%")
importFrom(ncdf4,nc_open)
importFrom(ncdf4,ncvar_get)
importFrom(raster,brick)
importFrom(raster,flip)
importFrom(raster,merge)
importFrom(raster,raster)
importFrom(raster,t)
importFrom(rvest,html_table)
importFrom(stars,read_stars)
importFrom(stats,ave)
importFrom(stringr,str_match)
importFrom(stringr,str_replace)
importFrom(stringr,word)
importFrom(terra,flip)
importFrom(terra,merge)
importFrom(terra,rast)
importFrom(terra,t)
importFrom(xml2,read_html)
3 changes: 1 addition & 2 deletions R/mf_get_url.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
#'
#' require(sf)
#' require(magrittr)
#' require(raster)
#' require(stars)
#' require(terra)
#'
#' ### First mf_login to EOSDIS Earthdata with username and password.
#' # To create an account go to : https://urs.earthdata.nasa.gov/.
Expand Down
35 changes: 9 additions & 26 deletions R/mf_import_data.R
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
#' @name mf_import_data
#' @aliases mf_import_data
#' @title Import the time series in R as a \code{SpatRaster} or a \code{stars} object
#' @description Import a time series as a \code{SpatRaster} or a \code{stars} object
#' @title Import the time series in R as a \code{SpatRaster} object
#' @description Import a time series as a \code{SpatRaster}object
#'
#' @param dir_path string character vector. mandatory. The path to the local directory where the data are stored.
#' @param collection_source character string. mandatory. The collection source (one of "MODIS", "VIIRS", "GPM")
#' @param output_class character string. Output object class. "SpatRaster" or "stars". See Details.
#' @param output_class character string. Output object class. Currently only "SpatRaster" implemented.
#' @param proj_epsg character string. EPSG of the desired projection for the output raster (default : 4326)
#'
#' @details
#' \code{output} : Currently "SpatRaster" implemented for all the collections and "stars" only for MODIS and VIIRS collections
#'
#' @import purrr
#' @importFrom terra rast t merge flip
#' @importFrom stars read_stars
#' @importFrom ncdf4 nc_open ncvar_get
#' @importFrom magrittr %>%
#' @export
#'
Expand All @@ -25,45 +20,33 @@
#' require(sf)
#' require(magrittr)
#' require(terra)
#' require(stars)
#'
#' username <- Sys.getenv("earthdata_un")
#' password <- Sys.getenv("earthdata_pw")
#' log <- mf_login(credentials = c(username,password), source = "earthdata")
#' log <- mf_login(credentials = c(username,password))
#'
#' roi_name <- "korhogo
#' roi_id <- "korhogo"
#' roi = st_as_sf(data.frame(
#' geom="POLYGON ((-5.82 9.54, -5.42 9.55, -5.41 8.84, -5.81 8.84, -5.82 9.54))"),
#' wkt="geom",crs = 4326)
#'
#' time_range = as.Date(c("2017-01-01","2017-01-30"))
#'
#' urls_mod11a1 <- mf_get_url(collection = "MOD11A1.006",
#' urls_mod11a1 <- mf_get_url(collection = "MOD11A1.061",
#' variables = c("LST_Day_1km","LST_Night_1km"),
#' roi = roi,
#' roi_name = roi_name,
#' roi_id = roi_id,
#' time_range = time_range
#' )
#'
#' res_dl <- mf_download_data(urls_mod11a1)
#'
#' ## import as RasterBrick
#' # here we import only the band LST_Day_1km
#' (mod11a1_rast <- mf_import_data(df_data_to_import = urls_mod11a1,
#' collection = "MOD11A1.006",
#' variable = "LST_Day_1km",
#' output_class = "RasterBrick"))
#' ## import as terra::SpatRast
#'
#' ## import os stars
#' # in a stars object, all the bands are imported, so no need to specify a variable
#' (mod11a1_stars <- mf_import_data(df_data_to_import = urls_mod11a1,
#' collection = "MOD11A1.006",
#' output = "stars"))
#' modis_ts <- mf_import_data(file.path(roi_id,"MOD11A1.061"), collection_source = "MODIS")
#'
#' plot(mod11a1_rast)
#'
#' plot(mod11a1_stars)
#'
#' }

mf_import_data <- function(dir_path,
Expand Down
Loading

0 comments on commit 1de55c2

Please sign in to comment.