Open dankelley opened 3 hours ago
The items at the top came from a UHDAS-style netcdf file provided by @marecotec, who I think might find the present issue of interest.
I am thinking of developing a new dictionary for the UHDAS naming convention. (Adding such things to existing dictionaries seems like a bad way to work, because eventually conflicts may arise. And, heck, each entry is just maybe 40 characters in a file.)
Below shows how a user can handle this in the meantime. I am not supplying units, because read.netcdf()
handles them directly (as presently configured).
library(oce)
#> Loading required package: gsw
dictText <- "
lon,longitude,,
lat,latitude,,
amp,a,,
"
dict <- read.csv(text = dictText, header = FALSE)
f <- "~/Downloads/wh300.nc"
d <- read.netcdf(f) |> rename(dict)
time <- d[["time"]]
u <- t(d[["u"]]) # note the transpose; maybe we need to flip y also?
z <- d[["z"]][, 1]
zlim <- c(-1, 1) * quantile(abs(u), 0.99, na.rm=TRUE)
cm <- colormap(zlim = zlim, col = oceColorsTwo)
imagep(time, z, u, colormap = cm,
xlab = paste(d[["timeUnit"]]$unit, d[["timeUnit"]]$scale),
ylab = "Vertical Coordinate [m]")
#> Warning in imagep(time, z, u, colormap = cm, xlab = paste(d[["timeUnit"]]$unit,
#> : auto-decimating first index of large image by 9; use decimate=FALSE to
#> prevent this
mtext("x component of velocity")
summary(d)
#> * Data Overview
#>
#> Min. Mean Max. Dim. NAs OriginalName
#> longitude [°E] -89.089 -87.465 -86.86 3961 0 "lon"
#> latitude [°N] 29.395 29.797 30.351 3961 0 "lat"
#> depth [m] 9.08 78.08 147.08 "70x3961" 0 "depth"
#> u [m/s] -3.6754 -0.059641 3.738 "70x3961" 192949 "u"
#> v [m/s] -2.4752 -0.083724 2.4604 "70x3961" 192949 "v"
#> a 41 71.276 231 "70x3961" 0 "amp"
#> pg 0 30.811 100 "70x3961" 0 "pg"
#> pflag 0 3.7513 6 "70x3961" 0 "pflag"
#> heading [°] -179.89 0.79049 179.95 3961 0 "heading"
#> tr_temp [°C] 27.084 28.984 29.754 3961 0 "tr_temp"
#> num_pings 75 75.001 76 3961 0 "num_pings"
#> uship [m/s] -5.4196 0.01776 5.4258 3961 1 "uship"
#> vship [m/s] -5.0293 -0.025475 4.7256 3961 1 "vship"
#> index_config_start 0 1950 3900 14 0 "index_config_start"
#> ensemble_seconds [s] 120 120 120 14 0 "ensemble_seconds"
#> num_depth_bins 70 70 70 14 0 "num_depth_bins"
#> transducer_depth [m] 3 3 3 14 0 "transducer_depth"
#> depth_bin_length [m] 2 2 2 14 0 "depth_bin_length"
#> pulse_length [m] 1.99 1.9993 2 14 0 "pulse_length"
#> blank_length [m] 4 4 4 14 0 "blank_length"
#> ping_interval [s] 0.028284 0.13969 1.5797 14 0 "ping_interval"
#> transducer_orientation [°] -21.39 -21.39 -21.39 14 0 "transducer_orientation"
#> time [day, since 2024-01-01 00:00:00] 273 275.75 278.5 3961 0 "time"
#>
#> * Processing Log
#>
#> - 2024-11-15 12:03:24 UTC: `Create oce object`
#> - 2024-11-15 12:03:24 UTC: `read.netcdf("~/Downloads/wh300.nc")`
#> - 2024-11-15 12:03:24 UTC: `rename(..., [data frame])`
Created on 2024-11-15 with reprex v2.1.1
lon
should be renamedlongitude
lat
should be renamedlatitude