Skip to content

Commit

Permalink
Update data_sources.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaqz authored Dec 5, 2024
1 parent 2bac84c commit 92a92d4
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions docs/src/data_sources.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
Rasters.jl uses a number of backends to load raster data. `Raster`, `RasterStack`
and `RasterSeries` will detect which backend to use for you, automatically.

## GRD
## GDAL

R GRD files can be loaded natively, using Julias `MMap` - which means they are very fast, but are not compressed. They are always 3 dimensional, and have `Y`, `X` and [`Band`](@ref) dimensions.
All files GDAL can access, such as `.tiff` and `.asc` files, can be loaded,
using [ArchGDAL.jl](https://github.com/yeesian/ArchGDAL.jl). These are
generally best loaded as `Raster("filename.tif")`, but can be loaded as
`RasterStack("filename.tif"; layersfrom=Band)`, taking layers from the `Band`
dimension, which is also the default.

## NetCDF

NetCDF `.nc` files are loaded using
NetCDF `.nc` and some HDF5 `.h5` files cab be loaded using
[NCDatasets.jl](https://github.com/Alexander-Barth/NCDatasets.jl). Layers from
files can be loaded as `Raster("filename.nc"; name=:layername)`. Without `name`
the first layer is used. `RasterStack("filename.nc")` will use all netcdf variables
Expand All @@ -19,26 +23,21 @@ NetCDF layers can have arbitrary dimensions. Known, common dimension names are
converted to `X`, `Y` `Z`, and `Ti`, otherwise `Dim{:layername}` is used. Layers
in the same file may also have different dimensions.

NetCDF files still have issues loading directly from disk for some operations.
Using `read(ncstack)` may help.
## Zarr

## GDAL
Zarr files can be loaded with the [ZarrDatasets.jl](https://github.com/JuliaGeo/ZarrDatasets.jl)
backend. `Raster(filename; source=Zarrsource())` may be needed where the file type cant be detected
from the filename. `write` does not yet work for Zarr but will in future.

All files GDAL can access, such as `.tiff` and `.asc` files, can be loaded,
using [ArchGDAL.jl](https://github.com/yeesian/ArchGDAL.jl/issues). These are
generally best loaded as `Raster("filename.tif")`, but can be loaded as
`RasterStack("filename.tif"; layersfrom=Band)`, taking layers from the `Band`
dimension, which is also the default.
## GRIB

## SMAP
GRIB files can be loaded with the [ZarrDatasets.jl](https://github.com/JuliaGeo/GRIBDatasets.jl).
`write` is not implemented for GRIB.

The [Soil Moisture Active-Passive](https://smap.jpl.nasa.gov/) dataset provides
global layers of soil moisture, temperature and other related data, in a custom
HDF5 format. Layers are always 2 dimensional, with `Y` and `X` dimensions.
## GRD

These can be loaded as multi-layered `RasterStack("filename.h5")`. Individual
layers can be loaded as `Raster("filename.h5"; name=:layername)`, without `name`
the first layer is used.
R GRD files can be loaded natively, using Julias `MMap` - which means they are very fast, but are not compressed.
They are always 3 dimensional, and have `Y`, `X` and [`Band`](@ref) dimensions.

````@example data_sources
using Rasters
Expand All @@ -50,13 +49,12 @@ smapseries

## Writing file formats to disk

Files can be written to disk in all formats other than SMAP HDF5 using
`write("filename.ext", A)`. See the docs for [`write`](@ref). They can (with
some caveats) be written to different formats than they were loaded in as,
providing file-type conversion for spatial data.
Files can be written to disk with ArchGDAL.jl and NCDatasets.jl backends using
`write("filename.ext", raster)`. See the docs for [`write`](@ref).

Some metadata may be lost in formats that store little metadata, or where
metadata conversion has not been completely implemented.
They can (with some caveats) be written to different formats than they were loaded in as,
providing file-type conversion for spatial data. Some metadata may be lost in formats that
store little metadata, or where metadata conversion has not been completely implemented.

## RasterDataSources.jl integration

Expand All @@ -75,4 +73,4 @@ Makie.plot(A)

See the docs for [`Raster`](@ref), [`RasterStack`](@ref) and [`RasterSeries`](@ref),
and the docs for `RasterDataSources.getraster` for syntax to specify various
data sources.
data sources.

0 comments on commit 92a92d4

Please sign in to comment.