Skip to content

Commit

Permalink
fix for NCDatasets 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Mar 26, 2024
1 parent d6da6b7 commit 88ede28
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/WorldOceanDatabase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ function load!(dirname,indexname,varname,profiles,lons,lats,zs,times,ids)
# page 39, doi:10.7289/V5DF6P53
accepted = 0


for i = 1:length(cast)
id = @sprintf("wod_%09dO",cast[i])
wodname = joinpath(dirname,@sprintf("wod_%09dO.nc",cast[i]))
Expand All @@ -455,17 +454,16 @@ function load!(dirname,indexname,varname,profiles,lons,lats,zs,times,ids)
end

NCDatasets.Dataset(wodname) do nc
#@show wodname, varname in nc
if varname in nc
if haskey(nc,varname)
profile = nc[varname] |> Array
z = nc["z"] |> Array

profile = nc[varname][:]
z = nc["z"][:]
lon = nc["lon"][:]
lat = nc["lat"][:]
time = nc["time"][:]
lon = nc["lon"] |> Array
lat = nc["lat"] |> Array
time = nc["time"] |> Array

profileflag = nc["$(varname)_WODflag"][:]
sigfigs = nomissing(nc["$(varname)_sigfigs"][:])
profileflag = nc["$(varname)_WODflag"] |> Array
sigfigs = nomissing(nc["$(varname)_sigfigs"] |> Array)
# some date are flagged as accepted but have *_sigfigs equal
# to zero and bogus value

Expand Down Expand Up @@ -550,6 +548,7 @@ function load(T,basedir::AbstractString,varname; prefixid = "")
@warn "no file starting with ocldb found in directory $dirn"
end
end

return load(T,dirnames,indexnames,varname; prefixid = prefixid)
end

Expand Down

0 comments on commit 88ede28

Please sign in to comment.