Skip to content

Commit

Permalink
Merge pull request #93 from JuliaOcean/v0p2p4a
Browse files Browse the repository at this point in the history
V0p2p4a
  • Loading branch information
gaelforget authored Sep 3, 2024
2 parents 896c3ea + d40c27e commit 6dd5e1e
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 40 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "OceanRobots"
uuid = "0b51df41-3294-4961-8d23-db645e32016d"
authors = ["gaelforget <[email protected]>"]
version = "0.2.3"
version = "0.2.4"

[deps]
CFTime = "179af706-886a-5703-950a-314cd64e0468"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Global Data Coverage | Individual Data Platforms
<summary> Research Vessels & Ships </summary>
<p>

👉 [CTD Profiles notebook](https://juliaocean.github.io/OceanRobots.jl/dev/examples/OceanExpedition_CCHDO.html) 👈
👉 [CTD Profiles notebook](https://juliaocean.github.io/OceanRobots.jl/dev/examples/ShipCruise_CCHDO.html) 👈

</p>
</details>
Expand Down
2 changes: 1 addition & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ makedocs(;
GliderFiles.check_for_file_Spray("GulfStream.nc")
GliderFiles.check_for_file_Spray("CUGN_along.nc")

lst=("OceanExpedition_CCHDO.jl","Drifter_CloudDrift.jl","SatelliteAltimetry.jl",
lst=("ShipCruise_CCHDO.jl","Drifter_CloudDrift.jl","SatelliteAltimetry.jl",
"Buoy_NWP_NOAA_monthly.jl","Glider_Spray.jl","OceanOPS.jl",
"Buoy_NWP_NOAA.jl","Mooring_WHOTS.jl","Drifter_GDP.jl","Float_Argo.jl")
for i in lst
Expand Down
14 changes: 6 additions & 8 deletions docs/src/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,17 @@
!!! note
The static `html` rendering of the notebooks (this website) lack the interactivity that comes from [Running Examples](@ref) yourself.

## List of Notebooks

The suite of examples includes :
## Included Notebooks

- [OceanOPS.jl](OceanOPS.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/OceanOPS.jl)) : global ocean observing systems
- [Buoy\_NWP\_NOAA.jl](Buoy_NWP_NOAA.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Buoy_NWP_NOAA.jl)) : NOAA [station](https://www.ndbc.noaa.gov/) data (a few days)
- [Buoy\_NWP\_NOAA\_monthly.jl](Buoy_NWP_NOAA_monthly.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Buoy_NWP_NOAA_monthly.jl)) : NOAA [station](https://www.ndbc.noaa.gov/) data (monthly means)
- [Mooring\_WHOTS.jl](Mooring_WHOTS.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Mooring_WHOTS.jl)) : WHOTS [mooring](http://www.soest.hawaii.edu/whots/wh_data.html) data
- [ShipCruise\_CCHDO.jl](ShipCruise_CCHDO.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/ShipCruise_CCHDO.jl)) : [ship](https://cchdo.ucsd.edu) CTD and other data
- [Float\_Argo.jl](Float_Argo.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Float_Argo.jl)) : Argo profiling [float](https://argo.ucsd.edu) data
- [Drifter\_GDP.jl](Drifter_GDP.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Drifter_GDP.jl)) : [drifter](https://www.aoml.noaa.gov/phod/gdp/hourly_data.php) time series
- [Drifter\_CloudDrift.jl](Drifter_CloudDrift.html) (➭ [code link](https://github.com/JuliaOcean/OceanRobots.jl/blob/master/examples/Drifter_CloudDrift.jl)) : drifter statistics
- [Float\_Argo.jl](Float_Argo.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Float_Argo.jl)) : Argo profiling [float](https://argo.ucsd.edu) data
- [OceanExpedition\_CCHDO.jl](OceanExpedition_CCHDO.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/OceanExpedition_CCHDO.jl)) : [ship](https://cchdo.ucsd.edu) CTD and other data
- [Glider\_Spray.jl](Glider_Spray.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Glider_Spray.jl)) : underwater [glider](http://spraydata.ucsd.edu/projects/) data
- [Buoy\_NWP\_NOAA.jl](Buoy_NWP_NOAA.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Buoy_NWP_NOAA.jl)) : NOAA [station](https://www.ndbc.noaa.gov/) data (a few days)
- [Buoy\_NWP\_NOAA\_monthly.jl](Buoy_NWP_NOAA_monthly.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Buoy_NWP_NOAA_monthly.jl)) : NOAA [station](https://www.ndbc.noaa.gov/) data (monthly means)
- [Mooring\_WHOTS.jl](Mooring_WHOTS.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/Mooring_WHOTS.jl)) : WHOTS [mooring](http://www.soest.hawaii.edu/whots/wh_data.html) data
- [SatelliteAltimetry.jl](SatelliteAltimetry.html) (➭ [code link](https://raw.githubusercontent.com/JuliaOcean/OceanRobots.jl/master/examples/SatelliteAltimetry.jl)) : gridded satellite data

## More Notebooks
Expand Down
2 changes: 1 addition & 1 deletion docs/src/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ plot(argo,pol=pol)

```@example ex1
using OceanRobots, CairoMakie
cruise=OceanExpedition("33RR20160208")
cruise=ShipCruise("33RR20160208")
plot(cruise,variable="salinity",colorrange=(33.5,35.0))
```

Expand Down
12 changes: 6 additions & 6 deletions examples/Drifter_GDP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ uuid = "f0e56b4a-5159-44fe-b623-3e5288b988bb"
version = "2.4.2"
[[deps.ConstructionBase]]
deps = ["LinearAlgebra"]
git-tree-sha1 = "a33b7ced222c6165f624a3f2b55945fac5a598d9"
git-tree-sha1 = "76219f1ed5771adbb096743bff43fb5fdd4c1157"
uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
version = "1.5.7"
weakdeps = ["IntervalSets", "StaticArrays"]
version = "1.5.8"
weakdeps = ["IntervalSets", "LinearAlgebra", "StaticArrays"]
[deps.ConstructionBase.extensions]
ConstructionBaseIntervalSetsExt = "IntervalSets"
ConstructionBaseLinearAlgebraExt = "LinearAlgebra"
ConstructionBaseStaticArraysExt = "StaticArrays"
[[deps.Contour]]
Expand Down Expand Up @@ -1153,9 +1153,9 @@ version = "0.5.5"
[[deps.OceanRobots]]
deps = ["CFTime", "CSV", "DataFrames", "DataStructures", "Dataverse", "Dates", "Downloads", "FTPClient", "Glob", "HTTP", "Interpolations", "JSON3", "LightXML", "NCDatasets", "Printf", "Statistics", "URIs"]
git-tree-sha1 = "cc465516ec877501c515bf04429cec576e0102f2"
git-tree-sha1 = "70e15a9c6fe33aaf969f91b986dce3383a94c3c2"
uuid = "0b51df41-3294-4961-8d23-db645e32016d"
version = "0.2.2"
version = "0.2.3"
[deps.OceanRobots.extensions]
OceanRobotsArgoDataExt = ["ArgoData"]
Expand Down
File renamed without changes.
17 changes: 7 additions & 10 deletions ext/OceanRobotsMakieExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -316,25 +316,25 @@ function plot_standard(wmo,arr,spd,T_std,S_std; markersize=2,pol=Any[],size=(900
end

"""
plot(x::OceanExpedition;
plot(x::ShipCruise;
markersize=6,pol=Any[],colorrange=(2,20),
size=(900,600),variable="temperature")
```
using OceanRobots, CairoMakie
x=OceanExpedition("33RR20160208")
x=ShipCruise("33RR20160208")
plot(x)
```
"""
function plot(x::OceanExpedition;
function plot(x::ShipCruise;
markersize=6,pol=Any[],colorrange=(2,20),
size=(900,600),variable="temperature")

fig=Figure(size=size); ax=Axis(fig[1,1],title="$(variable) from cruise $(x.ID)")
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)
list1=CCHDO.list_CTD_files(x)
for f in list1
ds=CCHDO.NCDatasets.Dataset(f)
tim=fill(ds["time"][1],ds.dim["pressure"])
depth=-ds["pressure"][:]
scatter!(tim,depth,color=ds[variable][:],markersize=markersize,colorrange=colorrange)
Expand All @@ -347,10 +347,7 @@ function plot(x::OceanExpedition;
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)
ds=CCHDO.open_chipod_file(x)

time=permutedims(repeat(ds["time"][:],1,ds.dim["pressure"]))
pressure=permutedims(repeat(ds["pressure"][:]',ds.dim["station"],1))
Expand Down
2 changes: 1 addition & 1 deletion src/OceanRobots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ include("gridded_data.jl")
export cmems_sla, podaac_sla

export NOAAbuoy, NOAAbuoy_monthly, ArgoFloat, SurfaceDrifter, Gliders
export OceanSite, CloudDrift, SeaLevelAnomaly, OceanExpedition
export OceanSite, CloudDrift, SeaLevelAnomaly, ShipCruise

end # module
10 changes: 7 additions & 3 deletions src/files.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

module CCHDO

import Downloads, Dataverse, NCDatasets
import Downloads, Dataverse, NCDatasets, Glob
import NCDatasets: Dataset

"""
Expand Down Expand Up @@ -103,10 +103,14 @@ function ancillary_files(cruise::Union{Symbol,String})
end
end

function read(fil)
ds=Dataset(fil)
open_chipod_file(x) = begin
fil0=basename(CCHDO.ancillary_files(x.ID).chipod)
fil1=joinpath(x.path,fil0)
Dataset(fil1)
end

list_CTD_files(x) = Glob.glob(x.ID*"*_ctd.nc",x.path)

end


Expand Down
10 changes: 4 additions & 6 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ end

SeaLevelAnomaly() = SeaLevelAnomaly(:unknown,[],"")

Base.@kwdef struct OceanExpedition <: AbstractOceanRobotData
Base.@kwdef struct ShipCruise <: AbstractOceanRobotData
ID::String
data::Union{Array,Dataset}
list_files::DataFrame
path::String
end

OceanExpedition(ID::String)=begin
ShipCruise(ID::String)=begin
path=CCHDO.download(ID)
filenames=joinpath.(Ref(path),readdir(path))
list1=DataFrames.DataFrame(:filename=>filenames)
OceanExpedition(ID,[],list1)
ShipCruise(ID,[],path)
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ using Test
path=CCHDO.download(ID)
@test ispath(path)

cruise=OceanExpedition(ID)
@test isa(cruise,OceanExpedition)
cruise=ShipCruise(ID)
@test isa(cruise,ShipCruise)

fig=plot(cruise)
@test isa(fig,Figure)
Expand Down

0 comments on commit 6dd5e1e

Please sign in to comment.