Skip to content

Commit

Permalink
add option for varname for mapcube (#415)
Browse files Browse the repository at this point in the history
* add option for varname for mapcube

* update project.toml
  • Loading branch information
meggart authored Jul 24, 2024
1 parent 3b89b6c commit 8307db1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "YAXArrays"
uuid = "c21b50f5-aa40-41ea-b809-c0f5e47bfa5c"
authors = ["Fabian Gans <[email protected]>"]
version = "0.5.8"
version = "0.5.9"

[deps]
CFTime = "179af706-886a-5703-950a-314cd64e0468"
Expand Down
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

2 comments on commit 8307db1

@meggart
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/111663

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.9 -m "<description of version>" 8307db1a09250c1441bcfdb263c9098ea809eddb
git push origin v0.5.9

Please sign in to comment.