From 8f5607c9c5adc588c82ce51eb9b7d159880bab42 Mon Sep 17 00:00:00 2001 From: lupemba Date: Wed, 21 Feb 2024 17:07:43 +0100 Subject: [PATCH 1/4] Add windows disclaimer and change int to Integer. --- README.md | 3 +++ src/messages.jl | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3376d1..eba6228 100644 --- a/README.md +++ b/README.md @@ -117,3 +117,6 @@ NCDatasets.write(netcdf_file,GRIBDataset(grib_file)) ``` ## Opening issues: GRIB format files may have a (very) large amount of different shapes. `GRIBDatasets` might not work for your specific edge case. If this happens, please open an issue, if possible providing the file triggering the bug. + +## Missing windows support +This package currently doesn't work on Windows. See issue GRIB.jl for more information https://github.com/weech/GRIB.jl/issues/14 \ No newline at end of file diff --git a/src/messages.jl b/src/messages.jl index 69371b8..fbc44b5 100644 --- a/src/messages.jl +++ b/src/messages.jl @@ -24,10 +24,10 @@ const GRIB_STEP_UNITS_TO_SECONDS = [ """ - from_grib_date_time(date::Int, time::Int; epoch::DateTime=DEFAULT_EPOCH) + from_grib_date_time(date::Integer, time::Integer; epoch::DateTime=DEFAULT_EPOCH) Seconds from epoch to the given date and time. """ -function from_grib_date_time(date::Int, time::Int; epoch::DateTime=DEFAULT_EPOCH)::Int +function from_grib_date_time(date::Integer, time::Integer; epoch::DateTime=DEFAULT_EPOCH)::Integer hour = time ÷ 100 minute = time % 100 year = date ÷ 10000 From 09791a5f1843f95ac2a81c09f22a4df199dc5a26 Mon Sep 17 00:00:00 2001 From: Tristan Carion Date: Fri, 23 Feb 2024 09:48:14 +0100 Subject: [PATCH 2/4] Update messages.jl --- src/messages.jl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/messages.jl b/src/messages.jl index fbc44b5..6a0cd09 100644 --- a/src/messages.jl +++ b/src/messages.jl @@ -58,7 +58,7 @@ end from_grib_step(message::GRIB.Message, step_key::String="endStep", step_unit_key::String="stepUnits") Returns the `step_key` value in hours. """ -function from_grib_step(message::GRIB.Message, step_key::String="endStep", step_unit_key::String="stepUnits")::Float64 +function from_grib_step(message::GRIB.Message, step_key::AbstractString="endStep", step_unit_key::AbstractString="stepUnits")::Float64 to_seconds = GRIB_STEP_UNITS_TO_SECONDS[message[step_unit_key] + 1] return message[step_key] * to_seconds / 3600.0 end @@ -72,7 +72,7 @@ end Returns the integer seconds from the epoch to the verifying month value in the GRIB message. """ -function from_grib_month(message::GRIB.Message, verifying_month_key::String="verifyingMonth", epoch::DateTime=DEFAULT_EPOCH)::Union{Int,Missing} +function from_grib_month(message::GRIB.Message, verifying_month_key::AbstractString="verifyingMonth", epoch::DateTime=DEFAULT_EPOCH)::Union{Int,Missing} if !haskey(message, verifying_month_key) return missing end @@ -96,7 +96,7 @@ julia> GDS.build_valid_time(10, 10) ((), 36010) ``` """ -function build_valid_time(time::Int, step::Int)::Tuple{Tuple{},Int64} +function build_valid_time(time::Integer, step::Integer)::Tuple{Tuple{},Int64} step_s = step * 3600 data = time + step_s @@ -111,7 +111,7 @@ julia> GDS.build_valid_time([10], 10) (("time",), [36010]) ``` """ -function build_valid_time(time::Array{Int,1}, step::Int)::Tuple{Tuple{String},Array{Int64,1}} +function build_valid_time(time::Array{Integer,1}, step::Integer)::Tuple{Tuple{String},Array{Int64,1}} step_s = step * 3600 data = time .+ step_s @@ -126,7 +126,7 @@ julia> GDS.build_valid_time(1, [10]) (("step",), [36001]) ``` """ -function build_valid_time(time::Int, step::Array{Int,1})::Tuple{Tuple{String},Array{Int64,1}} +function build_valid_time(time::Integer, step::Array{Integer,1})::Tuple{Tuple{String},Array{Int64,1}} step_s = step * 3600 data = time .+ step_s @@ -146,7 +146,7 @@ julia> GDS.build_valid_time([10], [10]) ((), 36010) ``` """ -function build_valid_time(time::Array{Int,1}, step::Array{Int,1}) +function build_valid_time(time::Array{Integer,1}, step::Array{Integer,1}) step_s = step * 3600 if length(time) == 1 && length(step) == 1 @@ -215,7 +215,7 @@ Read a specific key from a GRIB.jl message. Attempts to convert the raw value associated with that key using the [`COMPUTED_KEYS`](@ref COMPUTED_KEYS) mapping to `from_grib_*` functions. """ -function read_message(message::GRIB.Message, key::String) +function read_message(message::GRIB.Message, key::AbstractString) value = missing if key in keys(COMPUTED_KEYS) From a4cf043bf77dd1e14a415eae31065a12d80a879d Mon Sep 17 00:00:00 2001 From: Tristan Carion Date: Fri, 23 Feb 2024 09:57:38 +0100 Subject: [PATCH 3/4] replace some types with abstract --- src/messages.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/messages.jl b/src/messages.jl index 6a0cd09..36abb44 100644 --- a/src/messages.jl +++ b/src/messages.jl @@ -111,7 +111,7 @@ julia> GDS.build_valid_time([10], 10) (("time",), [36010]) ``` """ -function build_valid_time(time::Array{Integer,1}, step::Integer)::Tuple{Tuple{String},Array{Int64,1}} +function build_valid_time(time::Array{<:Integer,1}, step::Integer)::Tuple{Tuple{String},Array{Int64,1}} step_s = step * 3600 data = time .+ step_s @@ -126,7 +126,7 @@ julia> GDS.build_valid_time(1, [10]) (("step",), [36001]) ``` """ -function build_valid_time(time::Integer, step::Array{Integer,1})::Tuple{Tuple{String},Array{Int64,1}} +function build_valid_time(time::Integer, step::Array{<:Integer,1})::Tuple{Tuple{String},Array{Int64,1}} step_s = step * 3600 data = time .+ step_s @@ -146,7 +146,7 @@ julia> GDS.build_valid_time([10], [10]) ((), 36010) ``` """ -function build_valid_time(time::Array{Integer,1}, step::Array{Integer,1}) +function build_valid_time(time::Array{<:Integer,1}, step::Array{<:Integer,1}) step_s = step * 3600 if length(time) == 1 && length(step) == 1 From a63c3e8640d7ca0fdeebf967d9c2db69fc724901 Mon Sep 17 00:00:00 2001 From: lupemba Date: Fri, 23 Feb 2024 10:51:46 +0100 Subject: [PATCH 4/4] Windows support is experimental. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eba6228..f518a31 100644 --- a/README.md +++ b/README.md @@ -118,5 +118,5 @@ NCDatasets.write(netcdf_file,GRIBDataset(grib_file)) ## Opening issues: GRIB format files may have a (very) large amount of different shapes. `GRIBDatasets` might not work for your specific edge case. If this happens, please open an issue, if possible providing the file triggering the bug. -## Missing windows support -This package currently doesn't work on Windows. See issue GRIB.jl for more information https://github.com/weech/GRIB.jl/issues/14 \ No newline at end of file +## Windows support is experimental +The windows support is still under development. Most test cases works on windows but a few still fail. See issue GRIB.jl for more information https://github.com/weech/GRIB.jl/issues/14 \ No newline at end of file