GRIBDatasets.COMPUTED_KEYSConstant

Dictionary which maps a key to a conversion method. The first function is the 'to' conversion, the second is 'from'.

Currently converts:

    "time" => (from_grib_date_time, to_grib_date_time)

    "valid_time" => (
        message -> from_grib_date_time(message, date_key="validityDate", time_key="validityTime"),
        message -> to_grib_date_time(message, date_key="validityDate", time_key="validityTime"),
    )

    "verifying_time" => (from_grib_month, m -> throw(ErrorException("Unimplemented")))

    "indexing_time" => (
        message -> from_grib_date_time(message, date_key="indexingDate", time_key="indexingTime"),
        message -> to_grib_date_time(message, date_key="indexingDate", time_key="indexingTime"),
    )

Example

A GRIB message containing 20160501 as the date key and 0 as the time key would end up calling:

julia> GDS.COMPUTED_KEYS["time"][1](20160501, 0)
1462060800
GRIBDatasets.ArtificialDimensionType
ArtificialDimension <: AbstractDim

This type needs to be used when it is needed to create an artificial dimension. Typically this happens when some variables are defined on a similar type of level, but not on the same level values. For example, u10 and t2 are both defined on heightAboveGround, but the first is only defined at 10m and the second at 2m. In that case a height and a height_2 level will be created.

GRIBDatasets.DiskValuesType
DiskValues{T, N, M} <: DA.AbstractDiskArray{T, N}

Object that maps the dimensions lookup to GRIB messages offsets. message_dims are the dimensions that are found in the GRIB message (namely longitudes and latitudes). other_dims are the dimensions that have been infered from reading the GRIB file index.

Example

julia> dv.other_dims
Dimensions:
         number = 10
         valid_time = 4
         level = 2

julia> size(dv.offsets)
(10, 4, 2)
julia> dv.message_dims
Dimensions:
         longitude = 120
         latitude = 61
GRIBDatasets.DiskValuesMethod
DiskValues(layer_index::FileIndex{T}, dims::Dimensions) where T

Create a DiskValues object from matching the GRIB messages headers in layer_index to the dimensions values in dims.

GRIBDatasets.FileIndexType

Store for the messages of a GRIB file. Keeps track of the offset of the GRIB messages so they can be easily seeked. The unique_headers property gives all the different values for the keys in the GRIB file.

GRIBDatasets.FileIndexMethod
FileIndex(grib_path::String; index_keys = ALL_KEYS, filter_by_values = Dict())

Construct a FileIndex for the file grib_path, storing only the keys in index_keys. It is possible to read only specific values by specifying them in filter_by_values. The values of the headers can be accessed with getindex.

GRIBDatasets.GRIBDatasetType
GRIBDataset{T, N}

Mapping of a GRIB file to a structure that follows the CF conventions.

It can be created with the path to the GRIB file:

ds = GRIBDataset(example_file);
GRIBDatasets.IndexedDimensionType
IndexedDimension <: AbstractDim

Dimension created from reading the index values with the keys in the COORDINATE_VARIABLES_KEYS constant.

GRIBDatasets.MessageDimensionType
MessageDimension <: AbstractDim

One dimension found in the data part of the GRIB message. Typically, this is lon and lat dimensions.

GRIBDatasets.MessageIndexType
MessageIndex

Stored information about a GRIB message. The keys can be accessed with getindex. The message offset and length are stored as property of the struct.

GRIBDatasets.MessageIndexMethod
MessageIndex(message::GRIB.Message; index_keys = ALL_KEYS)

Read a GRIB message and store the requested index_keys in memory as a MessageIndex.

f = GribFile(example_file) 
message = first(f)
mind = GDS.MessageIndex(message)
destroy(f)
mind["name"]

# output
"Geopotential"
GRIBDatasets.NonRegularGridType
NonRegularGrid <: Horizontal

Represent non-regular grid types. The typical messages data is a 2-D matrix.

GRIBDatasets.OtherGridType
OtherGrid <: Horizontal

Represent non-regular grid types, where the typical messages data is a 1-D vector.

GRIBDatasets.RegularGridType
RegularGrid <: Horizontal

Represent regular grid types (typically regularll and regulargg). The typical messages data is a 2-D matrix.

GRIBDatasets.VariableType
Variable <: AbstractArray

Variable of a dataset ds. It can be a layer or a dimension. In case of a layer, the values are lazily loaded when it's sliced.

Base.lengthMethod
length(index::FileIndex)

The number of messages in the index.

GRIBDatasets.additional_coordinates_varnamesMethod
additional_coordinates_varnames(dims::Dimensions)

In case of irregular grids, eccodes might provide the longitude and latitude. If so, this will then be stored as additionnal variables.

GRIBDatasets.build_valid_timeMethod
julia> GDS.build_valid_time([10, 10], [10, 10])
(("time", "step"), [36010 36010; 36010 36010])
julia> GDS.build_valid_time([10], [10])
((), 36010)
GRIBDatasets.filter_messagesMethod
filter_messages(index::FileIndex{T}, args...; kwargs...)

Filter the messages in the index and return a new updated index. The filtering keys must be expressed as keyword arguments pair.

index = FileIndex(example_file)

filtered = GRIBDatasets.filter_messages(index, shortName = "z", number = 1)
length(filtered)

# output
8
GRIBDatasets.from_grib_date_timeMethod
from_grib_date_time(date::Int, time::Int; epoch::DateTime=DEFAULT_EPOCH)

Seconds from epoch to the given date and time.

GRIBDatasets.from_grib_monthFunction
from_grib_month

Returns the integer seconds from the epoch to the verifying month value in the GRIB message.

GRIBDatasets.from_grib_stepFunction
from_grib_step(message::GRIB.Message, step_key::String="endStep", step_unit_key::String="stepUnits")

Returns the step_key value in hours.

GRIBDatasets.get_values_from_filteredMethod
get_values_from_filtered(index, key, tocheck)

For each index values in key, give the values in tocheck related with it.

index = FileIndex(example_file)

GDS.get_values_from_filtered(index, "cfVarName", "level")

# output
Dict{SubString{String}, Vector{Any}} with 2 entries:
  "t" => [500, 850]
  "z" => [500, 850]
GRIBDatasets.getoneMethod
getone(index::FileIndex, key::AbstractString)

Check if only one value exists in the index at the specified ´key´ and return the value.

GRIBDatasets.messages_indicesMethod
message_indices(index::FileIndex, mind::MessageIndex, dims::Dimensions)

Find at which indices in dims correspond each GRIB message in index.

GRIBDatasets.read_messageMethod
read_message(message::GRIB.Message, key::String)

Read a specific key from a GRIB.jl message. Attempts to convert the raw value associated with that key using the COMPUTED_KEYS mapping to from_grib_* functions.