Skip to content

Commit

Permalink
Fix names + Add °C + Add kwargs
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc committed Apr 16, 2021
1 parent 52bf254 commit 1041c25
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WorldOceanAtlasTools"
uuid = "04f20302-f1b9-11e8-29d9-7d841cb0a64a"
authors = ["Benoit Pasquier <briochemc@gmail.com>"]
version = "0.4.3"
version = "0.4.4"

[deps]
DataDeps = "124859b0-ceae-595e-8997-d05f6a7a8dfe"
Expand Down
1 change: 1 addition & 0 deletions src/convert_to_Unitful.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ convert_to_Unitful(v::String) = @match v begin
"meters" => u"m"
"degrees_north" => u"°"
"degrees_east" => u"°"
"degrees_celsius" => u"°C"
_ => nothing
end

Expand Down
9 changes: 7 additions & 2 deletions src/functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function get_gridded_3D_field(ds, tracer, field)
field3D .= field3D[:, lon_reordering, :]
return field3D, lat, lon, depth
end
function get_gridded_3D_field(tracer, field; kwargs...)
return Dataset(WOAfile(tracer=tracer; kwargs...), "r") do ds
get_gridded_3D_field(ds, tracer, field)
end
end

"""
mean_std_and_number_obs(ds, tracer)
Expand Down Expand Up @@ -195,8 +200,8 @@ Returns observations of `tracer` with its metadata.
obs = observations("po4")
```
"""
function observations(tracer::String; metadatakeys=("lat", "lon", "depth"))
return Dataset(WOAfile(tracer=tracer), "r") do ds
function observations(tracer::String; metadatakeys=("lat", "lon", "depth"), kwargs...)
return Dataset(WOAfile(tracer=tracer; kwargs...), "r") do ds
observations(ds, tracer, metadatakeys=metadatakeys)
end
end
Expand Down
4 changes: 2 additions & 2 deletions src/names.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ WOA_decade(tracer) = @match my_varname(tracer) begin
end

WOA_v2(tracer) = @match my_varname(tracer) begin
"Salt" || "Temp" => "v2"
"Dens" || "Cond" || "O2" || "O2sat" || "AOU" || "DSi" || "DIP" || "DIN" => ""
"Salt" => "v2"
"Dens" || "Temp" || "Cond" || "O2" || "O2sat" || "AOU" || "DSi" || "DIP" || "DIN" => ""
_ => error(incorrect_varname(tracer))
end

Expand Down

2 comments on commit 1041c25

@briochemc
Copy link
Owner 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/34455

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.4.4 -m "<description of version>" 1041c259fb8f420f40b84c3dbd395b73a3b64520
git push origin v0.4.4

Please sign in to comment.