RasterDataSources.jl
RasterDataSources — Module
RasterDataSources.jl
RasterDataSources downloads raster data for local use or for integration into other spatial data packages, like Rasters.jl. The collection is largely focussed on datasets relevant to ecology, but will have a lot of crossover with other sciences.
Currently sources include:
| Source | URL | Status |
|---|---|---|
| CHELSA | https://chelsa-climate.org | BioClim, BioClimPlus, and Climate |
| WorldClim | https://www.worldclim.org | Climate, Weather, BioClim, and Elevation |
| EarthEnv | http://www.earthenv.org | LandCover and HabitatHeterogeneity |
| AWAP | http://www.bom.gov.au/jsp/awap/index.jsp | Complete |
| ALWB | http://www.bom.gov.au/water/landscape/ | Complete |
| ERA5 | https://registry.opendata.aws/nsf-ncar-era5/ | Complete |
| SRTM | https://www2.jpl.nasa.gov/srtm/ | Complete |
| CopernicusDEM | https://registry.opendata.aws/copernicus-dem/ | GLO-30 (30m) and GLO-90 (90m) |
| MODIS | https://modis.ornl.gov | Complete (beta) |
| TerraClimate | https://www.climatologylab.org/terraclimate.html | Historical, Plus2C, Plus4C |
| NCEP | https://psl.noaa.gov/data/gridded/data.ncep.reanalysis.html | Complete |
| SLGA | https://esoil.io/TERNLandscapes/Public/Pages/SLGA/index.html | Soil attributes and CoarseFragments |
| GADS | https://zenodo.org/records/19246341 | Spectral aerosol optical depths |
| CRUCL2 | https://zenodo.org/records/20754689 | Monthly mean climate 1961–1990 |
| CPCSoil | https://psl.noaa.gov/data/gridded/data.cpcsoil.html | LTM climatology and historical monthly means |
Please open an issue if you need more datasets added, or (even better) open a pull request following the form of the other datasets where possible.
Retrieving data
Usage is generally via the getraster method - which will download the raster data source if it isn't available locally, or simply return the path/s of the raster file/s:
julia> using RasterDataSources
julia> getraster(WorldClim{Climate}, :wind; month=1:12)
12-element Array{String,1}:
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_01.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_02.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_03.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_04.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_05.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_06.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_07.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_08.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_09.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_10.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_11.tif"
"/home/user/Data/WorldClim/Climate/wind/wc2.1_10m_wind_12.tif"Installation and setup
Install as usual with:
] add RasterDataSourcesTo download data you will need to specify a folder to put it in. You can do this by assigning the environment variable RASTERDATASOURCES_PATH:
ENV["RASTERDATASOURCES_PATH"] = "/home/user/Data/"This can be put in your startup.jl file or the system environment.
RasterDataSources was based on code from the SimpleSDMDataSoures.jl package by Timothée Poisot.
getraster
RasterDataSources.jl only exports a single function, getraster.
RasterDataSources.getraster — Function
getraster(source::Type, [layer]; kw...)Download raster layers layers from the data source, returning a String for a single layer, or a NamedTuple for a Tuple of layers.
getraster provides a standardised interface to download data sources, and return the filename/s of the selected files.
getraster can be called with any RasterDataSource. See the docstrings of these types for the specific keywords and arguments. RasterDataSource with documented getraster usage are WorldClim, EarthEnv, CHELSA, AWAP, ALWB, ERA5, NCEP, and MODIS. All these implementations follow the template specified below.
Arguments
source: defines theRasterDataSourceand (if it there is more than one) the specificRasterDataSetfrom which to download data.layer: choose the namedSymbol/s or numberedInt/s (forBioClim) layer/s of the data source. Iflayeris not passed, all layers will be downloaded, returning aNamedTupleof filenames.
Keywords
Keyword arguments specify subsets of a data set, such as by date or resolution. As much as possible these are standardised for all sources where they are relevent.
date:DateTimedate, range of dates, or tuple of start and end dates. Usually for weather datasets.month: month or range of months to download for climatic datasets, asIntegers from 1 to 12.res: spatial resolion of the file, as aStringwith units, e.g. "10m".
Return values
The return value is either a single String, a Tuple/Array of String, or a Tuple/Array of Tuple/Array of String –- depending on the arguments. If multiple layers are specified, this may return multiple filenames. If multiple months or dates are specified, this may also return multiple filenames.
Keyword arguments depend on the specific data source. They may modify the return value, following a pattern:
monthkeywords ofAbstractArraywill return aVector{String}orVector{<:NamedTuple}.datekeywords ofAbstractArraywill return aVector{String}orVector{<:NamedTuple}.datekeywords ofTuple{start,end}will take all the dates between the start and end dates as aVector{String}orVector{<:NamedTuple}.
Where date and month keywords coexist, Vector{Vector{String}} of Vector{Vector{NamedTuple}} is the result. date ranges are always the outer Vector, month the inner Vector with layer tuples as the inner NamedTuple. No other keywords can be Vector.
Specific implementations are included with each source, below.
Data sources
RasterDataSources.RasterDataSource — Type
RasterDataSourceAbstract supertype for raster data collections.
ALWB
RasterDataSources.ALWB — Type
ALWB{Union{Deciles,Values},Union{Day,Month,Year}} <: RasterDataSourceData from the Australian Landscape Water Balance (ALWB) data source.
See: www.bom.gov.au/water/landscape
The dataset contains NetCDF files. They have a time dimension so that multiple dates are stored in each file.
The available layers are: (:rain_day, :s0_pct, :ss_pct, :sd_pct, :sm_pct, :qtot, :etot, :e0, :ma_wet, :pen_pet, :fao_pet, :asce_pet, :msl_wet, :dd), available in daily, monthly and annual resolutions, and as Values or relative Deciles.
getraster for ALWB must use a date keyword to specify the date to download.
Usage with getraster
getraster(source::Type{<:ALWB{Union{Deciles,Values},Union{Day,Month,Year}}}, [layer]; date)Download ALWB weather data as values or deciles with timesteps of Day, Month or Year.
Arguments
layer:SymbolorTupleofSymbolfrom(:rain_day, :s0_pct, :ss_pct, :sd_pct, :sm_pct, :qtot, :etot, :e0, :ma_wet, :pen_pet, :fao_pet, :asce_pet, :msl_wet, :dd). Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned.
Keywords
date: aDateTime,AbstractVectorofDateTimeor aTupleof start and end dates. For multiple dates, aVectorof multiple filenames will be returned. ALWB is available with a daily, monthly, and yearly, timestep.
Example
This will return the file containing annual averages, including your date:
julia> getraster(ALWB{Values,Year}, :ss_pct; date=Date(2001, 2))
"/your/RASTERDATASOURCES_PATH/ALWB/values/month/ss_pct.nc"Returns the filepath/s of the downloaded or pre-existing files.
AWAP
RasterDataSources.AWAP — Type
AWAP <: RasterDataSource
Daily weather data from the Australian Water Availability Project, developed by CSIRO.
See: www.csiro.au/awap
The AWAP dataset contains ASCII .grid files.
Usage with getraster
getraster(source::Type{AWAP}, [layer]; date)Arguments
layer:SymbolorTupleofSymbolforlayers in(:solar, :rainfall, :vprpress09, :vprpress15, :tmin, :tmax). Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned.
Keywords
date: aDateTime,AbstractVectorofDateTimeor aTupleof start and end dates. For multiple dates, AVectorof multiple filenames will be returned. AWAP is available with a daily timestep.
Example
Download rainfall for the first month of 2001:
julia> getraster(AWAP, :rainfall; date=Date(2001, 1, 1):Day(1):Date(2001, 1, 31))
31-element Vector{String}:
"/your/path/AWAP/rainfall/totals/20010101.grid"
"/your/path/AWAP/rainfall/totals/20010102.grid"
...
"/your/path/AWAP/rainfall/totals/20010131.grid"Returns the filepath/s of the downloaded or pre-existing files.
CHELSA
RasterDataSources.CHELSA — Type
CHELSA{Union{BioClim,BioClimPlus,Climate,<:Future}} <: RasterDataSourceData from CHELSA, currently implements the BioClim, BioClimPlus, and Climate variables for current and future conditions.
See: chelsa-climate.org for the dataset, and the getraster docs for implementation details.
Usage with getraster
getraster(source::Type{CHELSA{BioClim}}, [layer]; [version], [patch])
getraster(source::Type{CHELSA{BioClimPlus}}, [layer]; [version], [patch])
getraster(T::Type{CHELSA{Climate}}, [layer]; month)
getraster(T::Type{CHELSA{Future{BioClim}}}, [layer]; date
getraster(T::Type{CHELSA{Future{Climate}}}, [layer]; date, month)Download CHELSA BioClim data from chelsa-climate.org.
Arguments
layer:Integer,Symbolor tuple/range of these. Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned. Available layers are:BioClim: Integers 1 to 19 or Symbols :bio1 to :bio19BioClimPlus: IncludesBioClimlayers and many additional layers. SeeRasterDataSources.layers(BioClimPlus).Climate: (:clt, :cmi, :hurs, :ncdf, :pet, :pr, :rsds, :sfcWind, :tas, :tasmax, :tasmin, :vpd)
Keyword arguments
version:Integerindicating the CHELSA version, currently either1or2. Defaults to 2.patch:Integerindicating the CHELSA patch number. Defaults to the latest patch (V1.2 and V2.1)month:IntegerorAbstractArrayofInteger. Chosen from1:12.date: aDateorDateTimeobject, a Vector, or Tuple of start/end dates. Note that CHELSA CMIP5 only has two datasets, for the periods 2041-2060 and 2061-2080. CMIP6 has datasets for the periods 2011-2040, 2041-2070, and 2071-2100. Dates must fall within these ranges.
Example
using RasterDataSources, Dates
getraster(CHELSA{Future{BioClim, CMIP6, GFDL_ESM4, SSP370}}, 1, date = Date(2050))EarthEnv
RasterDataSources.EarthEnv — Type
EarthEnv{Union{HabitatHeterogeneity,LandCover}} <: RasterDataSourceData from the EarthEnv including HabitatHeterogeneity and LandCover
See: www.earthenv.org
Usage with getraster
getraster(T::Type{EarthEnv{HabitatHeterogeneity}}, [layer]; res="25km")
getraster(T::Type{EarthEnv{LandCover}}, [layer]; discover=false)Download EarthEnv habitat heterogeneity data.
Arguments
layer:Integer,Symbolor tuple/range of these. Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned. Available layers are:HabitatHeterogeneity: (:cv, :evenness, :range, :shannon, :simpson, :std, :Contrast, :Correlation, :Dissimilarity, :Entropy, :Homogeneity, :Maximum, :Uniformity, :Variance)LandCover: Integers 1 to 12 or Symbols (:needleleaftrees, :evergreenbroadleaftrees, :deciduousbroadleaftrees, :othertrees, :shrubs, :herbaceous, :cultivatedandmanaged, :regularlyflooded, :urbanbuiltup, :snowice, :barren, :openwater)
Keywords
res:Stringchosen from("1km", "5km", "25km"), defaulting to "25km".discover::Bool: whether to download the dataset that integrates the DISCover model.
Returns the filepath/s of the downloaded or pre-existing files.
ERA5
RasterDataSources.ERA5 — Type
ERA5 <: RasterDataSourceData from the ERA5 reanalysis dataset, accessed via Google's ARCO-ERA5 cloud-optimized Zarr store.
See: ARCO-ERA5
The dataset contains hourly data at 0.25° resolution from 1940 to present (~3 month lag). Data is accessed lazily - only the chunks you read are downloaded and cached locally.
Available layers
(:t2m, :d2m, :u10, :v10, :u100, :v100, :sp, :msl, :skt, :sst, :sd, :swvl1, :swvl2, :swvl3, :swvl4, :stl1, :stl2, :stl3, :stl4, :tcc, :lcc, :mcc, :hcc, :cape, :blh, :tcwv, :tco3, :tp, :ssrd, :ssr, :str, :strd, :slhf, :sshf, :e, :ro, :lsm)
Common layers:
:t2m- 2m temperature:d2m- 2m dewpoint temperature:u10,:v10- 10m wind components:sp- Surface pressure:msl- Mean sea level pressure:tp- Total precipitation:ssrd- Surface solar radiation downwards:tcc- Total cloud cover
Usage
using RasterDataSources, Zarr
# Get cloud source reference
source = getraster(ERA5)
# Create caching store and open
store = Zarr.CachingHTTPStore(source)
ds = zopen(Zarr.ConsolidatedStore(store, ""))
# Access a variable (chunks download on demand and are cached)
temp = ds["2m_temperature"]
# Or use the layer symbol helper
varname = layername(ERA5, :t2m) # "2m_temperature"
temp = ds[varname]The local cache is stored at RasterDataSources.rasterpath(ERA5). Subsequent runs reuse cached chunks without re-downloading.
WorldClim
RasterDataSources.WorldClim — Type
WorldClim{Union{BioClim,Climate,Elevation,Weather,<:Future}} <: RasterDataSourceData from WorldClim datasets, either BioClim, Climate, Weather, Climate, or Future variables for current and future conditions.
Future variables are available for BioClim and Climate data. See the docstring of Future for available model choices and implementation details.
See: www.worldclim.org
Usage with getraster
getraster(T::Type{WorldClim{BioClim}}, [layer::Union{Tuple,Int,Symbol}]; res)
getraster(T::Type{WorldClim{Climate}}, [layer::Union{Tuple,Symbol}]; month, res)
getraster(T::Type{WorldClim{Elevation}}; res)
getraster(T::Type{WorldClim{Weather}}, [layer::Union{Tuple,Symbol}]; date)
getraster(T::Type{WorldClim{Future}}, [layer]; date, res) => StringArguments
layer:Integer,Symbolor tuple/range of these. Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned. Available layers are:BioClim: Integers 1 to 19 or Symbols :bio1 to :bio19Climate: (:tmin, :tmax, :tavg, :prec, :srad, :wind, :vapr)Elevation: Only has a single layer, :elevWeather: (:tmin, :tmax, :prec)Future{Climate}: (:tmin, :tmax, :prec)
Keywords
res:Stringchosen from ("30s", "2.5m", "5m", "10m"), "10m" by default.month:IntegerorAbstractArrayofInteger. Chosen from1:12.date: aDateorDateTimeobject, aVectorof dates, orTupleof start/end dates.WorldClim{Weather}is available with a daily timestep. Future data is available in 20-year intervals from 2021 to 2100.
Examples
using RasterDataSources, Dates
bio_current = getraster(WorldClim{BioClim}, res = "5m")
bio_future = getraster(WorldClim{Future{BioClim, CMIP6, GFDL_ESM4, SSP370}}, date = Date(2050), res = "5m")MODIS
RasterDataSources.MODIS — Type
MODIS{ModisProduct} <: RasterDataSourceMODIS/VIIRS Land Product Database. Vegetation indices, surface reflectance, and more land cover data. Data from ModisProducts datasets.
See: modis.ornl.gov
Usage with getraster
getraster(T::Union{Type{<:ModisProduct}, Type{MODIS{X}}}, [layer::Union{Tuple,AbstractVector,Integer, Symbol}]; kwargs...) => Union{String, AbstractVector, NamedTuple}Download MODIS data for a given ModisProduct as ASCII raster(s).
Arguments
layer:Integeror tuple/range ofIntegerorSymbols. Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned.
Available layers for a given product can be looked up using RasterDataSources.layerkeys(T::Type{<:ModisProduct}).
Keywords
latandlon: Coordinates in decimal degrees of the approximate center of the raster. The MODIS API will try to match its pixel grid system as close as possible to those coordinates.km_abandkm_lr: Half-width and half-height of the raster in kilometers (kilometers above/below and left/right). Currently onlyIntegervalues are supported, up to 100.date:String,Date,DateTime,AbstractVectorof dates orTupleof a start and end date for the request.Strings should be in format YYYY-MM-DD but can be in similar formats as long as they are comprehensible byDates.Date. The available date interval for MODIS is 16 days, reset every first of January.
Example
Download 250m NDVI in the western part of Britanny, France, from winter to late spring, 2002:
julia> getraster(MOD13Q1, :NDVI; lat = 48.25, lon = -4, km_ab = 50, km_lr = 50, date = (Date(2002,1,1), Date(2002,6,1)))
10-element Vector{String}:
"/your/path/MODIS/MOD13Q1/250m_16_days_NDVI/47.8313_-4.5899_2002-01-01.asc"
...
"/your/path/MODIS/MOD13Q1/250m_16_days_NDVI/47.8313_-4.5899_2002-05-25.asc"Will attempt to download several files, one for each date and layer combination, and returns the filepath/s of the downloaded or pre-existing files. Coordinates in the file names correspond to the lower-left corner of the raster.
RasterDataSources.ModisProduct — Type
ModisProduct <: RasterDataSetAbstract supertype for MODIS/VIIRS products.
Usage
Some commonly used products are MOD13Q1 (250m resolution MODIS vegetation indices) and VNP13A1 (500m resolution VIIRS vegetation indices). Refer to the MODIS documentation for detailed product information.
RasterDataSources.layerkeys — Method
layerkeys(T::Type{<:ModisProduct}) => TupleTuple of Symbols corresponding to the available layers for a given product. May issue a request to MODIS server to get the layers list, or might just read this information if the correctly named file is available.
TerraClimate
RasterDataSources.TerraClimate — Type
TerraClimate{<:WarmingScenario} <: RasterDataSourceData from the TerraClimate dataset, a high-resolution global dataset of monthly climate and climatic water balance.
See: climatologylab.org/terraclimate
The dataset contains NetCDF files with monthly data. Each file covers one year and contains 12 monthly layers. Coverage is from years 1950-present.
The available layers are: (:aet, :def, :PDSI, :pet, :ppt, :q, :soil, :srad, :swe, :tmax, :tmin, :vap, :vpd, :ws).
Available scenarios:
TerraClimate{Historical}or justTerraClimate: Historical dataTerraClimate{Plus2C}: +2°C warming scenarioTerraClimate{Plus4C}: +4°C warming scenario
getraster for TerraClimate must use a date keyword to specify the year to download.
Usage with getraster
getraster(source::Type{<:TerraClimate}, [layer]; date)Download TerraClimate data for the specified scenario.
Arguments
layer:SymbolorTupleofSymbolfrom(:aet, :def, :PDSI, :pet, :ppt, :q, :soil, :srad, :swe, :tmax, :tmin, :vap, :vpd, :ws). Without alayerargument, all layers will be downloaded, and aNamedTupleof paths returned.
Keywords
date: aDateTime,AbstractVectorofDateTimeor aTupleof start and end dates. For multiple dates, aVectorof multiple filenames will be returned.
Example
julia> getraster(TerraClimate, :tmax; date=Date(2020))
"/path/to/storage/TerraClimate/historical/TerraClimate_tmax_2020.nc"
julia> getraster(TerraClimate{Plus2C}, :tmax; date=Date(2000))
"/path/to/storage/TerraClimate/plus2c/TerraClimate_plus2C_tmax_2000.nc"Returns the filepath/s of the downloaded or pre-existing files.
NCEP
RasterDataSources.NCEP — Type
NCEP{C<:NCEPCategory} <: RasterDataSourceData from the NCEP/NCAR Reanalysis 1 (1948-Present) and NCEP/DOE Reanalysis 2 (1979-Present) datasets.
See: https://psl.noaa.gov/data/gridded/data.ncep.reanalysis.html
Type Parameters
C: The category of data to download. One ofSixHourlyPressure,SixHourlySurface,DailyPressure,DailySurface,DailySurfaceReanalysis2,MonthlyPressure,MonthlySurface, orSurfaceGauss.
Usage
getraster(NCEP{<category>}, layer; date, dataset)Keywords
date: ADateorDateTimeobject. The year is used to select the file for daily data.dataset: "reanalysis" or "reanalysis2". Defaults to "reanalysis".
Layers
| Layer Symbol | Description | Units | Categories |
|---|---|---|---|
:tmax | Max Temperature | K | SurfaceGauss |
:tmin | Min Temperature | K | SurfaceGauss |
:air_2m | Air Temperature (2m) | K | SurfaceGauss |
:shum_2m | Specific Humidity (2m) | kg/kg | SurfaceGauss |
:prate | Precipitation Rate | Kg/m²/s | SurfaceGauss |
:pres | Pressure | Pa | SurfaceGauss |
:dswrf | Downward Shortwave Flux | W/m² | SurfaceGauss |
:dlwrf | Downward Longwave Flux | W/m² | SurfaceGauss |
:ulwrf | Upward Longwave Flux | W/m² | SurfaceGauss |
:uwnd_10m | U-Wind (10m) | m/s | SurfaceGauss |
:vwnd_10m | V-Wind (10m) | m/s | SurfaceGauss |
:tcdc | Total Cloud Cover | % | SurfaceGauss (2005 only) |
:hgt | Geopotential Height | m | SixHourlyPressure, DailyPressure, MonthlyPressure |
:rhum | Relative Humidity | % | SixHourlyPressure, DailyPressure, MonthlyPressure |
:shum | Specific Humidity | kg/kg | SixHourlyPressure, DailyPressure, MonthlyPressure |
:air | Air Temperature | K | SixHourlyPressure, DailyPressure, MonthlyPressure |
:uwnd | U-Wind | m/s | SixHourlyPressure, DailyPressure, MonthlyPressure |
:vwnd | V-Wind | m/s | SixHourlyPressure, DailyPressure, MonthlyPressure |
:omega | Vertical Velocity | Pa/s | SixHourlyPressure, DailyPressure, MonthlyPressure |
:slp | Sea Level Pressure | Pa | DailySurface, MonthlySurface |
:pr_wtr | Precipitable Water | kg/m² | SixHourlySurface, MonthlySurface |
:pres_sfc | Surface Pressure | Pa | SixHourlySurface, DailySurfaceReanalysis2 |
:lftx | Surface Lifted Index | K | SixHourlySurface |
:mslp | Mean Sea Level Pressure | Pa | DailySurfaceReanalysis2 |
:pres_sfc | Surface Pressure | Pa | DailySurfaceReanalysis2 |
:pr_wtr_eatm | Precipitable Water | kg/m² | DailySurfaceReanalysis2 |
Example
getraster(NCEP{DailyPressure}, :hgt; date=Date(2001), dataset="reanalysis")CopernicusDEM
RasterDataSources.CopernicusDEM — Type
CopernicusDEM <: RasterDataSourceThe Copernicus Digital Elevation Model (GLO-30 and GLO-90), a global digital surface model derived from the WorldDEM, hosted as Cloud-Optimized GeoTIFFs on the AWS Open Data registry (no authentication required).
The dataset is split into 1°×1° tiles. Oceanic tiles that contain no land are absent from the dataset and are returned as missing.
Usage with getraster
getraster(T::Type{CopernicusDEM}; extent, res) => Matrix{Union{String,Missing}}
getraster(T::Type{CopernicusDEM}; bounds, res) => Matrix{Union{String,Missing}}
getraster(T::Type{CopernicusDEM}; tile_index, res) => StringKeywords
res:Stringchosen from("30m", "90m"),"30m"by default.extent: anExtents.Extent, the canonical spatial selector. All 1°×1° tiles intersecting the extent are downloaded, returning aMatrixof file paths (withmissingfor non-existent oceanic tiles).bounds: a legacy alias forextent, also accepting aTupleof(longitudes, latitudes)bounds.tile_index: aCartesianIndex(orCartesianIndices) addressing tiles by the integer degrees of their south-west corner. Mostly used internally.
Example
using RasterDataSources, Extents
# 30m tiles intersecting an extent over Italy
getraster(CopernicusDEM; extent=Extent(X=(10, 12), Y=(41, 43)), res="30m")SRTM
RasterDataSources.SRTM — Type
SRTM <: RasterDataSourceThe Shuttle Radar Topography Mission digital elevation model at ~90 m (3 arcsecond) resolution, served from the CGIAR-CSI SRTM 4.1 mirror as GeoTIFFs in WGS84.
The dataset is split into 5°×5° tiles spanning latitudes 60°N to 60°S. Oceanic tiles that contain no land are absent from the dataset.
See: SRTM at CGIAR-CSI
Usage with getraster
getraster(SRTM; extent) => Matrix{String}
getraster(SRTM; bounds) => Matrix{String}
getraster(SRTM; tile_index) => StringKeywords
extent: anExtents.Extent, the canonical spatial selector. All 5°×5° tiles intersecting the extent are downloaded, returning aMatrixof file paths.bounds: a legacy alias forextent, also accepting aTupleof(longitudes, latitudes)bounds.tile_index: aCartesianIndex(orCartesianIndices) addressing tiles directly. Mostly used internally.
Example
using RasterDataSources, Extents
# tiles intersecting an extent over Italy
getraster(SRTM; extent=Extent(X=(10, 12), Y=(41, 43)))SLGA
RasterDataSources.SLGA — Type
SLGA <: RasterDataSourceSoil and Landscape Grid of Australia at ~90 m (3 arcsecond) resolution from CSIRO/TERN. Files are Cloud Optimised GeoTIFFs in WGS84 (EPSG:4326), covering continental Australia.
Available layers
| Key | Code | Description | Units | Date Created |
|---|---|---|---|---|
| clay | CLY | Clay content | % | 20210902 |
| silt | SLT | Silt content | % | 20210902 |
| sand | SND | Sand content | % | 20210902 |
| bdod | BDW | Bulk density (whole soil) | g/cm³ | 20230607 |
| soc | SOC | Soil organic carbon | % | 20220727 |
| phc | PHC | pH (CaCl₂) | — | 20210913 |
| phw | PHW | pH (water) | — | 20220520 |
| awc | AWC | Available water capacity | % vol | 20210614 |
| ece | ECE | Effective cation exchange capacity | meq/100g | 20140801 |
| cec | CEC | Cation exchange capacity | meq/100g | 20220826 |
| nto | NTO | Total nitrogen | % | 20231101 |
| pto | PTO | Total phosphorus | % | 20231101 |
| avp | AVP | Available phosphorus (Colwell) | mg/kg | 20220826 |
| dul | DUL | Drained upper limit (field capacity) | % vol | 20210614 |
| l15 | L15 | Lower limit (wilting point, -1500 kPa) | % vol | 20210614 |
| der | DER | Depth to a restricting layer | m | 20150601 |
| des | DES | Depth of soil (regolith) | m | 20190901 |
Coarse fragments (cfg) have a distinct multi-file structure; use SLGA{CoarseFragments} instead.
Use depth and component keywords with getraster:
depth: 0-5cm, 5-15cm, 15-30cm, 30-60cm, 60-100cm, 100-200cm:deronly supports "0-999cm":desonly supports "0-200cm"
component: EV, 05, 95
Examples
getraster(SLGA, :clay; depth="0-5cm", component="EV")
getraster(SLGA, :clay; component="EV") # returns all depths
getraster(SLGA, (:clay, :sand); depth="5-15cm", component="05")
getraster(SLGA, :clay; depth=["0-5cm", "5-15cm"]) # returns Vector
getraster(SLGA, :der) # single-depth layerGADS
RasterDataSources.GADS — Type
GADS <: RasterDataSourceA global 5-degree gridded product of spectral aerosol optical depths, derived from the Global Aerosol Data Set (Koepke et al. 1997) via the NicheMapR R package.
The dataset provides climatological aerosol optical properties for a global 5-degree grid based on measurements and models of 11 aerosol components. It covers two representative seasons (summer and winter, Northern Hemisphere) and a range of relative humidity conditions.
The file gads.nc contains a single variable OPTDEPTH with dimensions:
- Longitude: 72 points (−180° to 175°, 5° resolution)
- Latitude: 37 points (−90° to 90°, 5° resolution)
- Relative humidity: 8 levels (0, 50, 70, 80, 90, 95, 98, 99%)
- Season: 2 values (0 = NH summer/July, 1 = NH winter/January)
- Wavelength: 25 bands (250–4000 nm)
See: zenodo.org/records/19246341 and github.com/mrke/Global-Aerosol-Data-Set
Reference: Koepke, P., Hess, M., Schult, I., and Shettle, E.P. (1997). Global Aerosol Data Set. MPI-Report No. 243, Max-Planck-Institut für Meteorologie, Hamburg.
Usage with getraster
getraster(source::Type{GADS})Example
julia> getraster(GADS)
"/path/to/storage/GADS/gads.nc"Returns the filepath of the downloaded or pre-existing file.
CRUCL2
RasterDataSources.CRUCL2 — Type
CRUCL2 <: RasterDataSourceMonthly mean climate for the global land surface at 10-minute (~18 km) resolution, based on station observations from 1961–1990 (CRU CL 2.0).
The file cru_cl2.nc contains the following variables with a month dimension (1–12), except elv which has no month dimension:
| Variable | Description | Units |
|---|---|---|
tmp | Mean temperature | °C |
dtr | Diurnal temperature range | °C |
pre | Precipitation | mm |
rd0 | Wet-day frequency | days |
frs | Frost-day frequency | days |
reh | Relative humidity | % |
sunp | Sunshine percentage | % |
wnd | Wind speed | m/s |
elv | Elevation | m |
Minimum and maximum temperature can be derived as tmp ± dtr/2.
See: zenodo.org/records/20754689 and github.com/mrke/CRU-CL-2
Reference: New, M., Lister, D., Hulme, M. and Makin, I., 2002. A high-resolution data set of surface climate over global land areas. Climate Research, 21: 1–25.
Example
julia> getraster(CRUCL2)
"/path/to/storage/CRUCL2/cru_cl2.nc"Returns the filepath of the downloaded or pre-existing file.
CPCSoil
RasterDataSources.Mean — Type
MeanType parameter for data sources that provide a long-term mean (or historical mean) product in addition to a climatological one. Currently used with CPCSoil:
getraster(CPCSoil{Mean}) # full monthly time series 1948–presentRasterDataSources.CPCSoil — Type
CPCSoil{X} <: RasterDataSourceMonthly soil moisture data from the NOAA Climate Prediction Center (CPC), on a global 0.5° grid.
Two products are available:
Long-term mean (LTM) — CPCSoil (default): 12 monthly climatological means for a selected 30-year period. Use the period keyword to select the climatology:
"1991-2020"(default, 9.5 MB)"1981-2010"(3.2 MB)
Historical monthly means — CPCSoil{Mean}: Full monthly time series from 1948 to present (254 MB).
See: psl.noaa.gov/data/gridded/data.cpcsoil.html
Reference: Fan, Y. and van den Dool, H. (2004). Climate Prediction Center global monthly soil moisture data set at 0.5° resolution for 1948 to present. Journal of Geophysical Research, 109, D10102.
Usage with getraster
getraster(source::Type{CPCSoil}; period="1991-2020")
getraster(source::Type{CPCSoil{Mean}})Examples
julia> getraster(CPCSoil)
"/path/to/storage/CPCSoil/soilw.mon.1991-2020.ltm.v2.nc"
julia> getraster(CPCSoil; period="1981-2010")
"/path/to/storage/CPCSoil/soilw.mon.1981-2010.ltm.v2.nc"
julia> getraster(CPCSoil{Mean})
"/path/to/storage/CPCSoil/soilw.mon.mean.v2.nc"Returns the filepath of the downloaded or pre-existing file.
Datasets
RasterDataSources.RasterDataSet — Type
RasterDataSetAbstract supertype for datasets that belong to a RasterDataSource.
RasterDataSources.BioClim — Type
BioClim <: RasterDataSetBioClim datasets. Usually containing layers from 1:19. These can also be accessed with :bioX, e.g. :bio5.
They do not usually use month or date keywords, but may use date in past/future scenarios.
Currently implemented for WorldClim and CHELSA as WorldClim{BioClim}, WorldClim{Future{BioClim}}, CHELSA{BioClim}, CHELSA{Future{BioClim, args..}}.
See the CHELSA and WorldClim docs for implementation details.
RasterDataSources.BioClimPlus — Type
BioClimPlus <: RasterDataSetExtended BioClim datasets, available from CHELSA. More information on the CHELSA website: https://chelsa-climate.org/exchelsa-extended-bioclim/
Some of these are available as average annual maximum, minimum, mean, and range. Others have a single value, more like the regular BioClim variables.
They do not usually use month or date keywords, but may use date in past/future scenarios.
Currently implemented for CHELSA as CHELSA{BioClim} and CHELSA{Future{BioClim, args..}}, specifying layer names as Symbols.
See the CHELSA docs for implementation details.
RasterDataSources.Climate — Type
Climate <: RasterDataSetClimate datasets. These are usually months of the year, not specific dates, and use a month keyword in getraster. They also use date in past/future scenarios.
Currently implemented for WorldClim and CHELSA as WorldClim{Climate}, WorldClim{Future{Climate, args..}} CHELSA{Climate} and CHELSA{Future{Climate, args..}}.
See the CHELSA and WorldClim docs for implementation details.
RasterDataSources.Weather — Type
Weather <: RasterDataSetWeather datasets. These are usually large time-series of specific dates, and use a date keyword in getraster.
Currently implemented for WorldClim as WorldClim{Weather}.
See the WorldClim docs for implementation details.
RasterDataSources.Elevation — Type
Elevation <: RasterDataSetElevation datasets.
Currently implemented for WorldClim as WorldClim{Elevation}.
See the WorldClim docs for implementation details.
RasterDataSources.LandCover — Type
LandCover <: RasterDataSetLand-cover datasets.
Currently implemented for EarthEnv as EarthEnv{LandCover}.
See the EarthEnv docs for implementation details.
RasterDataSources.HabitatHeterogeneity — Type
HabitatHeterogeneity <: RasterDataSetHabitat heterogeneity datasets.
Currently implemented for EarthEnv as EarthEnv{HabitatHeterogeneity}.
See the EarthEnv docs for implementation details.
RasterDataSources.CoarseFragments — Type
CoarseFragments <: RasterDataSetCoarse fragments (>=2 mm soil particles, % vol) dataset.
Used as a type parameter on SLGA: SLGA{CoarseFragments} selects the Soil and Landscape Grid of Australia coarse-fragments product, which has a distinct multi-file structure from the standard SLGA attribute layers — each depth produces 7 files (six coarse-fragment probability class maps and one dominant class map). getraster(SLGA{CoarseFragments}; depth=...) returns a NamedTuple with keys :class1–:class6 and :dominant.
Examples
paths = getraster(SLGA{CoarseFragments}; depth="0-5cm")
paths.class1 # estimated probability of coarse fragment class 1
paths.dominant # dominant coarse fragment class
getraster(SLGA{CoarseFragments}; depth=["0-5cm", "5-15cm"]) # returns Vector{NamedTuple}RasterDataSources.Future — Type
Future{<:RasterDataSet,<:CMIPphase,<:ClimateModel,<:ClimateScenario}Future climate datasets specified with a dataset, phase, model, and scenario.
Type Parameters
RasterDataSet
Currently BioClim and Climate are implemented for CHELSA and WorldClim. Future WorldClim is only available for CMIP6.
CMIPphase
ClimateModel
Climate models can be chosen from:
RasterDataSources.ACCESS1_0, RasterDataSources.BNU_ESM, RasterDataSources.CCSM4, RasterDataSources.CESM1_BGC, RasterDataSources.CESM1_CAM5, RasterDataSources.CMCC_CMS, RasterDataSources.CMCC_CM, RasterDataSources.CNRM_CM5, RasterDataSources.CSIRO_Mk3, RasterDataSources.CanESM2, RasterDataSources.FGOALS_g2, RasterDataSources.FIO_ESM, RasterDataSources.GFDL_CM3, RasterDataSources.GFDL_ESM2G, RasterDataSources.GFDL_ESM2M, RasterDataSources.GISS_E2_H_CC, RasterDataSources.GISS_E2_H, RasterDataSources.GISS_E2_R_CC, RasterDataSources.GISS_E2_R, RasterDataSources.HadGEM2_AO, RasterDataSources.HadGEM2_CC, RasterDataSources.IPSL_CM5A_LR, RasterDataSources.IPSL_CM5A_MR, RasterDataSources.MIROC_ESM_CHEM, RasterDataSources.MIROC_ESM, RasterDataSources.MIROC5, RasterDataSources.MPI_ESM_LR, RasterDataSources.MPI_ESM_MR, RasterDataSources.MRI_CGCM3, RasterDataSources.MRI_ESM1, RasterDataSources.NorESM1_M, RasterDataSources.bcc_csm_1, RasterDataSources.inmcm4 for CMIP5;
RasterDataSources.ACCESS_CM2, RasterDataSources.BCC_CSM2_MR, RasterDataSources.CMCC_ESM2, RasterDataSources.EC_Earth3_Veg, RasterDataSources.FIO_ESM_2_0, RasterDataSources.GFDL_ESM4, RasterDataSources.GISS_E2_1_G, RasterDataSources.HadGEM3_GC31_LL, RasterDataSources.INM_CM5_0, RasterDataSources.IPSL_CM6A_LR, RasterDataSources.MIROC6, RasterDataSources.MPI_ESM1_2_HR, RasterDataSources.MRI_ESM2_0, RasterDataSources.UKESM1_0_LL for CMIP6;"
ClimateScenario
CMIP5 Climate scenarios are all RepresentativeConcentrationPathway and can be chosen from: RCP26, RCP45, RCP60, RCP85
CMIP6 Climate scenarios are all SharedSocioeconomicPathway and can be chosen from: SSP126, SSP245, SSP370, SSP585
However, note that not all climate scenarios are available for all models.
Example
using RasterDataSources
datasource = CHELSA{Future{BioClim, CMIP5, GFDL_ESM4, SSP370}}Models, phases and scenarios for Future data.
RasterDataSources.ClimateModel — Type
ClimateModelAbstract supertype for climate models use in Future datasets.
RasterDataSources.CMIPphase — Type
CMIPphaseAbstract supertype for phases of the CMIP, the Coupled Model Intercomparison Project.
Subtypes are CMIP5 and CMIP6.
RasterDataSources.CMIP5 — Type
CMIP5 <: CMIPphaseThe Coupled Model Intercomparison Project, Phase 5.
RasterDataSources.CMIP6 — Type
CMIP6 <: CMIPphaseThe Coupled Model Intercomparison Project, Phase 6.
RasterDataSources.ClimateScenario — Type
ClimateScenarioAbstract supertype for scenarios used in CMIPphase models.
RasterDataSources.RepresentativeConcentrationPathway — Type
RepresentativeConcentrationPathwayAbstract supertype for Representative Concentration Pathways (RCPs) for CMIP5.
Subtypes are: RCP26, RCP45, RCP60, RCP85
RasterDataSources.SharedSocioeconomicPathway — Type
SharedSocioeconomicPathwayAbstract supertype for Shared Socio-economic Pathways (SSPs) for CMIP6.
Subtypes are: SSP126, SSP245, SSP370, SSP585
Other
RasterDataSources.Values — Type
Values <: DataModeGet the dataset as regular measured values.
RasterDataSources.Deciles — Type
Deciles <: DataModeGet the dataset in relative deciles.
Internal interface
These methods are not exported at this stage, but are for the most part internally consistent. Any new sources added to the package should use these methods in a consistent way for readability, consistency and the potential to use them for other things later.
RasterDataSources.layerkeys — Function
layerkeys(T::Type{<:ModisProduct}) => TupleTuple of Symbols corresponding to the available layers for a given product. May issue a request to MODIS server to get the layers list, or might just read this information if the correctly named file is available.
RasterDataSources.rastername — Function
rastername(source::Type, [layer]; kw...)Returns the name of the file, without downloading it.
Arguments are the same as for getraster
Returns a String or multiple Strings.
RasterDataSources.rasterpath — Function
rasterpath(source::Type, [layer]; kw...)Returns the name of the file, without downloading it.
Arguments are the same as for getraster
Returns a String or multiple Strings.
RasterDataSources.rasterurl — Function
rasterurl(source::Type, [layer]; kw...)If the file has a single url, returns it without downloading.
Arguments are the same as for getraster.
Returns a URIs.jl URI or mulitiple URIs.
RasterDataSources.zipname — Function
zipname(source::Type, [layer]; kw...)If the url is a zipped file, returns its name.
Arguments are as the same for getraster where possible.
Returns a String or multiple Strings.
RasterDataSources.zippath — Function
zippath(source::Type, [layer]; kw...)If the url is a zipped file, returns its path when downloaded. (This may not exist after extraction with getraster)
Arguments are the same as for getraster where possible.
Returns a String or multiple Strings.
RasterDataSources.zipurl — Function
zipurl(source::Type, [layer]; kw...)If the url is a zipped file, returns its zip path without downloading.
Arguments are the same as for getraster where possible.
Returns a URIs.jl URI or mulitiple URIs.
Internal MODIS interface
Unlike all the other currently supported data sources, MODIS data is not available online in raster file format. Building rasters out of the available information therefore requires internal functions that are not exported. They might be extended as needed if other similar sources get supported.
Requesting to server and building raster files
RasterDataSources.modis_request — Function
modis_request(T::Type{<:ModisProduct}, args...)Lowest level function for requests to modis server. All arguments are assumed correct.
Arguments
layer:Stringmatching the "exact" layer name (i.e. as it is written in the MODIS dataset itself) for the given product. e.g."250m_16_days_EVI".lat,lon,km_ab,km_lrin correct typesfrom,to:Strings of astronomical dates for start and end dates of downloaded data, e.g."A2002033"for "2002-02-02"
Returns a NamedTuple of information relevant to build a raster header, and a Vector of Dicts containing raster data, directly downloaded from MODIS. Those will almost always directly be passed to RasterDataSources.process_subset
RasterDataSources.process_subset — Function
process_subset(T::Type{<:ModisProduct}, subset::Vector{Any}, pars::NamedTuple)Process a raw subset and argument parameters and create several raster files. Any already existing file is not overwritten.
For each band, a separate folder is created, containing a file for each of the required dates. This is inspired by the way WorldClim{Climate} treats the problem of possibly having to download several dates AND bands.
Can theoretically be used for MODIS data that does not directly come from RasterDataSources.modis_request, but caution is advised.
Returns the filepath/s of the created or pre-existing files.
Miscellaneous
RasterDataSources.product — Function
product(T::Type{<:ModisProduct})Extracts ModisProduct product name as a String
RasterDataSources.sinusoidal_to_latlon — Function
sinusoidal_to_latlon(x::Real, y::Real)Convert x and y in sinusoidal projection to lat and lon in dec. degrees
This function uses Proj for coordinate conversions. Use import Proj to make it available.