diff --git a/Project.toml b/Project.toml index f49ec68..e1f1be6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "OceanRobots" uuid = "0b51df41-3294-4961-8d23-db645e32016d" authors = ["gaelforget "] -version = "0.2.3" +version = "0.2.4" [deps] CFTime = "179af706-886a-5703-950a-314cd64e0468" diff --git a/README.md b/README.md index acc8d65..5993f30 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ Global Data Coverage | Individual Data Platforms Research Vessels & Ships

-👉 [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) 👈

diff --git a/docs/make.jl b/docs/make.jl index 2b3bae2..9b0ecb1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -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 diff --git a/docs/src/examples.md b/docs/src/examples.md index 558d526..2b7f171 100644 --- a/docs/src/examples.md +++ b/docs/src/examples.md @@ -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 diff --git a/docs/src/reference.md b/docs/src/reference.md index 8e25102..55610d8 100644 --- a/docs/src/reference.md +++ b/docs/src/reference.md @@ -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)) ``` diff --git a/examples/Drifter_GDP.jl b/examples/Drifter_GDP.jl index 4b9a2d8..3cc6814 100644 --- a/examples/Drifter_GDP.jl +++ b/examples/Drifter_GDP.jl @@ -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]] @@ -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"] diff --git a/examples/OceanExpedition_CCHDO.jl b/examples/ShipCruise_CCHDO.jl similarity index 100% rename from examples/OceanExpedition_CCHDO.jl rename to examples/ShipCruise_CCHDO.jl diff --git a/ext/OceanRobotsMakieExt.jl b/ext/OceanRobotsMakieExt.jl index a6b8c36..8587ee4 100644 --- a/ext/OceanRobotsMakieExt.jl +++ b/ext/OceanRobotsMakieExt.jl @@ -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) @@ -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)) diff --git a/src/OceanRobots.jl b/src/OceanRobots.jl index dedaa65..d5cfee2 100644 --- a/src/OceanRobots.jl +++ b/src/OceanRobots.jl @@ -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 diff --git a/src/files.jl b/src/files.jl index 5231a3e..3989224 100644 --- a/src/files.jl +++ b/src/files.jl @@ -1,7 +1,7 @@ module CCHDO -import Downloads, Dataverse, NCDatasets +import Downloads, Dataverse, NCDatasets, Glob import NCDatasets: Dataset """ @@ -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 diff --git a/src/types.jl b/src/types.jl index ca6c9c0..822dc21 100644 --- a/src/types.jl +++ b/src/types.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 4d0213a..130e049 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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)