Skip to content

Commit

Permalink
Merge pull request #89 from JuliaOcean/v0p2p3a
Browse files Browse the repository at this point in the history
add plotting options (salinity, chi)
  • Loading branch information
gaelforget authored Sep 2, 2024
2 parents 29773fa + b3fc30d commit b50fbd1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ plot(argo,pol=pol)
```@example ex1
using OceanRobots, CairoMakie
cruise=OceanExpedition("33RR20160208")
plot(cruise)
plot(cruise,variable="salinity",colorrange=(33.5,35.0))
```

## NOAA Buoys
Expand Down
34 changes: 28 additions & 6 deletions ext/OceanRobotsMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -330,17 +330,39 @@ function plot(x::OceanExpedition;
size=(900,600),variable="temperature")

fig=Figure(size=size); ax=Axis(fig[1,1],title="$(variable) from cruise $(x.ID)")
list1=findall(occursin.(Ref("_ctd.nc"),x.list_files[:,"filename"]))
for f in x.list_files[list1,"filename"]
ds=CCHDO.read(f)
tim=fill(ds["time"][1],ds.dim["pressure"])
depth=-ds["pressure"][:]
scatter!(tim,depth,color=ds[variable][:],markersize=markersize,colorrange=colorrange)
if variable=="temperature"||variable=="salinity"
list1=findall(occursin.(Ref("_ctd.nc"),x.list_files[:,"filename"]))
for f in x.list_files[list1,"filename"]
ds=CCHDO.read(f)
tim=fill(ds["time"][1],ds.dim["pressure"])
depth=-ds["pressure"][:]
scatter!(tim,depth,color=ds[variable][:],markersize=markersize,colorrange=colorrange)
end
elseif variable=="chi_up"||variable=="chi_dn"
plot_chi!(x;variable=variable,colorrange=colorrange,markersize=markersize)
end
Colorbar(fig[1,2], colorrange=colorrange, height=Relative(0.65))
fig
end

function plot_chi!(x;variable="chi_up",colorrange=(-12.0,-10.0),markersize=3)
fil0=basename(CCHDO.ancillary_files(x.ID).chipod)
ii=findall(occursin.(Ref(fil0),x.list_files[:,"filename"]))[1]
fil1=x.list_files[ii,"filename"]
ds=CCHDO.read(fil1)

time=permutedims(repeat(ds["time"][:],1,ds.dim["pressure"]))
pressure=permutedims(repeat(ds["pressure"][:]',ds.dim["station"],1))
y=ds[variable][:,:]

ii=findall((!ismissing).(y))
a=DateTime.(time[ii])
b=Float64.(-pressure[ii])
c=log10.(Float64.(y[ii]))

scatter!(a,b,color=c,markersize=3,colorrange=colorrange)
end

"""
plot(x::ArgoFloat; option=:standard, markersize=2,pol=Any[])
Expand Down

0 comments on commit b50fbd1

Please sign in to comment.