It’s been a while coming, but I’m happy to announce that GeoData.jl is finally registered!
GeoData is a package for loading and manipulating spatial data - predominantly raster arrays and multilayered stacks of rasters, or even whole directories of files arrays or stacks. But it will eventually handle other kinds of spatial data to allow easy interop/conversion between formats.
The key idea is that a set of GDAL arrays can be accessed with identical syntax to netcdf stacks or custom HDF5 data formats - so we can build packages on top of GeoData.jl that don’t have to specialise code for the underlying format. Next week I’ll release GrowthMaps.jl as an example of this.
GeoData.jl also builds on DimensionalData.jl (which is getting quite mature) so all spatial data can be indexed and subsetted using dimensional syntax. A lot of work has gone into selectors like Between
and Contains
to allow accurately subsetting data that represents intervals as well as points - which is a lot of spatial data.
Anyway heres a simple example, there are lots more in the readme and docs as well.
julia> using GeoData, NCDatasets
julia> url = "https://www.unidata.ucar.edu/software/netcdf/examples/tos_O1_2001-2002.nc";
julia> filename = download(url, "tos_O1_2001-2002.nc");
julia> A = NCDarray(filename)
NCDarray (named tos) with dimensions:
Longitude (type Lon): Float64[1.0, 3.0, …, 357.0, 359.0] (Converted: Ordered Regular Intervals)
Latitude (type Lat): Float64[-79.5, -78.5, …, 88.5, 89.5] (Converted: Ordered Regular Intervals)
Time (type Ti): DateTime360Day[DateTime360Day(2001-01-16T00:00:00), DateTime360Day(2001-02-16T00:00:00), …, DateTime360Day(2002-11-16T00:00:00), DateTime360Day(2002-12-16T00:00:00)] (Sampled: Ordered Irregular Intervals)
and data: 180×170×24 Array{Union{Missing, Float32},3}
[:, :, 1]
missing missing missing … 271.437 271.445 271.459
missing missing missing 271.438 271.445 271.459
Now plot every third month in the first year:
julia> using Plots
juila> A[Ti(1:3:12)] |> plot