Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of CommonDataModel sources #416

Merged
merged 23 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ version = "0.10.1"
[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
CommonDataModel = "1fbeeb36-5f17-413c-809b-666fb144f157"
ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DimensionalData = "0703355e-b756-11e9-17c0-8b28908087d0"
Expand All @@ -27,6 +28,7 @@ Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
[weakdeps]
ArchGDAL = "c9ce4bd3-c3d5-55b8-8973-c0e20141b8c3"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
GRIBDatasets = "82be9cdb-ee19-4151-bdb3-b400788d9abc"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Expand All @@ -35,6 +37,7 @@ RasterDataSources = "3cb90ccd-e1b6-4867-9617-4276c8b2ca36"
[extensions]
RastersArchGDALExt = "ArchGDAL"
RastersCoordinateTransformationsExt = "CoordinateTransformations"
RastersGRIBDatasetsExt = "GRIBDatasets"
RastersHDF5Ext = "HDF5"
RastersMakieExt = "Makie"
RastersNCDatasetsExt = "NCDatasets"
Expand All @@ -46,6 +49,7 @@ Adapt = "2, 3.0, 4"
ArchGDAL = "0.9, 0.10"
CFTime = "0.1"
ColorTypes = "0.10, 0.11"
CommonDataModel = "0.2.3"
ConstructionBase = "1"
CoordinateTransformations = "0.6.2"
DataFrames = "1"
Expand All @@ -54,13 +58,14 @@ DiskArrays = "^0.3.3"
Extents = "0.1"
FillArrays = "0.12, 0.13, 1"
Flatten = "0.4"
GRIBDatasets = "0.2, 0.3"
GeoFormatTypes = "0.4"
GeometryBasics = "0.4"
GeoInterface = "1"
HDF5 = "0.14, 0.15, 0.16"
Makie = "0.19, 0.20"
Missings = "0.4, 1"
NCDatasets = "0.10, 0.11, 0.12, 0.13"
NCDatasets = "0.13"
OffsetArrays = "1"
ProgressMeter = "1"
RasterDataSources = "0.5.7"
Expand All @@ -81,6 +86,7 @@ CFTime = "179af706-886a-5703-950a-314cd64e0468"
CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
GRIBDatasets = "82be9cdb-ee19-4151-bdb3-b400788d9abc"
HDF5 = "f67ccb44-e63f-5c2f-98bd-6dc0ccc4ba2f"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
Expand All @@ -92,4 +98,4 @@ Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeometryBasics", "HDF5", "NCDatasets", "Plots", "RasterDataSources", "SafeTestsets", "Shapefile", "Statistics", "Test"]
test = ["Aqua", "ArchGDAL", "CFTime", "CoordinateTransformations", "DataFrames", "GeometryBasics", "GRIBDatasets", "HDF5", "NCDatasets", "Plots", "RasterDataSources", "SafeTestsets", "Shapefile", "Statistics", "Test"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Sources and packages needed:
- `:netcdf`: `using NCDatasets`
- `:grd`: built-in.
- `:smap`: `using HDF5`
- `:grib`: not yet finished.
- `:grib`: `using GRIBDatasets`.

Other functionality in extensions:
- Raster data downloads, like `Worldclim{Climate}`: `using RasterDataSources`
Expand Down
33 changes: 33 additions & 0 deletions ext/RastersGRIBDatasetsExt/RastersGRIBDatasetsExt.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module RastersGRIBDatasetsExt

@static if isdefined(Base, :get_extension) # julia < 1.9
using Rasters, GRIBDatasets, CommonDataModel
else
using ..Rasters, ..GRIBDatasets, ..CommonDataModel
end

import DiskArrays,
FillArrays,
Extents,
GeoInterface,
Missings

using Dates,
DimensionalData,
GeoFormatTypes

using Rasters.LookupArrays
using Rasters.Dimensions
using Rasters: GRIBsource

using CommonDataModel: AbstractDataset

const RA = Rasters
const DD = DimensionalData
const DA = DiskArrays
const GI = GeoInterface
const LA = LookupArrays

include("gribdatasets_source.jl")

end
16 changes: 16 additions & 0 deletions ext/RastersGRIBDatasetsExt/gribdatasets_source.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const GDS = GRIBDatasets

RA.FileStack{GRIBsource}(ds::AbstractDataset, filename::AbstractString; write=false, keys) = RA.FileStack(GRIBsource, ds, filename; write, keys)

function RA.OpenStack(fs::RA.FileStack{GRIBsource,K}) where K
RA.OpenStack{GRIBsource,K}(GDS.GRIBDataset(RA.filename(fs)))
end

# In GRIBDatasets, the file is open for reading the values and closed afterwards.
Base.close(os::RA.OpenStack{GRIBsource}) = nothing

function RA._open(f, ::Type{GRIBsource}, filename::AbstractString; write=false, kw...)
isfile(filename) || _filenotfound_error(filename)
ds = GRIBDatasets.GRIBDataset(filename)
RA._open(f, GRIBsource, ds; kw...)
end
8 changes: 5 additions & 3 deletions ext/RastersNCDatasetsExt/RastersNCDatasetsExt.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module RastersNCDatasetsExt

@static if isdefined(Base, :get_extension) # julia < 1.9
using Rasters, NCDatasets
using Rasters, NCDatasets, CommonDataModel
else
using ..Rasters, ..NCDatasets
using ..Rasters, ..NCDatasets, ..CommonDataModel
end

import DiskArrays,
Expand All @@ -18,7 +18,9 @@ using Dates,

using Rasters.LookupArrays
using Rasters.Dimensions
using Rasters: NCDsource
using Rasters: CDMsource, NCDsource

using CommonDataModel: AbstractDataset

const RA = Rasters
const DD = DimensionalData
Expand Down
Loading
Loading