Skip to content

Commit

Permalink
add option for varname for mapcube
Browse files Browse the repository at this point in the history
  • Loading branch information
meggart committed Jul 24, 2024
1 parent 3b89b6c commit 6ad167c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Cubes/Cubes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ end
Base.read(d::YAXArray) = getindex_all(d)

function formatbytes(x)
exts = ["bytes", "KB", "MB", "GB", "TB"]
exts = ["bytes", "KB", "MB", "GB", "TB","PB"]
i = 1
while x >= 1024
i = i + 1
Expand Down
8 changes: 6 additions & 2 deletions src/DatasetAPI/Datasets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,10 @@ function createdataset(DS::Type,axlist; kwargs...)
* `persist::Bool=true` shall the disk data be garbage-collected when the cube goes out of scope?
* `overwrite::Bool=false` overwrite cube if it already exists
* `properties=Dict{String,Any}()` additional cube properties
* `globalproperties=Dict{String,Any}` global attributes to be added to the dataset
* `fillvalue= T>:Missing ? defaultfillval(Base.nonmissingtype(T)) : nothing` fill value
* `datasetaxis="Variable"` special treatment of a categorical axis that gets written into separate zarr arrays
* `layername="layer"` Fallback name of the variable stored in the dataset if no `datasetaxis` is found
"""
function createdataset(
DS,
Expand All @@ -665,7 +667,9 @@ function createdataset(
chunkoffset = ntuple(i -> 0, length(axlist)),
overwrite::Bool = false,
properties = Dict{String,Any}(),
globalproperties = Dict{String,Any}(),
datasetaxis = "Variable",
layername = "layer",
kwargs...,
)
if persist === nothing
Expand Down Expand Up @@ -698,7 +702,7 @@ function createdataset(
end
end
if groupaxis === nothing
cubenames = ["layer"]
cubenames = [layername]
else
cubenames = DD.lookup(groupaxis)
end
Expand All @@ -712,7 +716,7 @@ function createdataset(
dshandle = YAXArrayBase.create_dataset(
DS,
path,
Dict{String,Any}(),
globalproperties,
string.(getproperty.(axdata,:name)),
getproperty.(axdata,:data),
getproperty.(axdata,:attrs),
Expand Down

0 comments on commit 6ad167c

Please sign in to comment.