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

Add windows disclaimer and change int to Integer. #26

Merged
merged 4 commits into from
Mar 3, 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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

## 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
18 changes: 9 additions & 9 deletions src/messages.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@


"""
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
Expand Down Expand Up @@ -58,7 +58,7 @@
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

Check warning on line 61 in src/messages.jl

View check run for this annotation

Codecov / codecov/patch

src/messages.jl#L61

Added line #L61 was not covered by tests
to_seconds = GRIB_STEP_UNITS_TO_SECONDS[message[step_unit_key] + 1]
return message[step_key] * to_seconds / 3600.0
end
Expand All @@ -72,7 +72,7 @@
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
Expand All @@ -96,7 +96,7 @@
((), 36010)
```
"""
function build_valid_time(time::Int, step::Int)::Tuple{Tuple{},Int64}
function build_valid_time(time::Integer, step::Integer)::Tuple{Tuple{},Int64}

Check warning on line 99 in src/messages.jl

View check run for this annotation

Codecov / codecov/patch

src/messages.jl#L99

Added line #L99 was not covered by tests
step_s = step * 3600

data = time + step_s
Expand All @@ -111,7 +111,7 @@
(("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}}

Check warning on line 114 in src/messages.jl

View check run for this annotation

Codecov / codecov/patch

src/messages.jl#L114

Added line #L114 was not covered by tests
step_s = step * 3600

data = time .+ step_s
Expand All @@ -126,7 +126,7 @@
(("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}}

Check warning on line 129 in src/messages.jl

View check run for this annotation

Codecov / codecov/patch

src/messages.jl#L129

Added line #L129 was not covered by tests
step_s = step * 3600

data = time .+ step_s
Expand All @@ -146,7 +146,7 @@
((), 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})

Check warning on line 149 in src/messages.jl

View check run for this annotation

Codecov / codecov/patch

src/messages.jl#L149

Added line #L149 was not covered by tests
step_s = step * 3600

if length(time) == 1 && length(step) == 1
Expand Down Expand Up @@ -215,7 +215,7 @@
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)
Expand Down
Loading