dankelley / oceglider

R package for processing ocean glider data
https://dankelley.github.io/oceglider/
3 stars 1 forks source link

subset() fails on netcdf slocum file #97

Closed dankelley closed 1 year ago

dankelley commented 1 year ago

(File not included here since it's huge.)

library(oceGlider)
f <- "~/data/gass/sbloom2023/batray-2023-03-17-delayed_trajectory_file.nc"
g <- read.glider.slocum.netcdf(f)
i <- seq_along(g[["salinity"]])
gg<-subset(g, i<1000)

yields

Error: In subset,glider-method() : cannot subset seaexplorer objects that lack a 'payload1' item in the data slot
dankelley commented 1 year ago

Fixed in "develop" commit 4bb3ac046c871885100780562e58ef6801ce913a

**Test code (private file)** ```R library(oceGlider) f <- "~/data/gass/sbloom2023/batray-2023-03-17-delayed_trajectory_file.nc" g <- read.glider.slocum.netcdf(f) i <- seq_along(g[["salinity"]]) gg <- subset(g, i<1000) summary(gg) ``` **Result** ```R Glider Summary -------------- * Input file: ~/data/gass/sbloom2023/batray-2023-03-17-delayed_trajectory_file.nc * Type: slocum * Time ranges from 2023-03-17 16:10:55.232 to 2023-03-17 16:24:44.234 with 999 samples and mean increment 0.9999835 s * Data Overview: Min. Mean Max. Dim. OriginalName conductivity 26.555 26.783 27.221 999 glider_record/sci_rbrctd_conductivity_00 CT 0.72208 0.91822 1.2814 999 conservative_temperature density [kg/m³] 1024.8 1025.1 1025.4 999 density id 2 2.1886 3 999 profile_id latitude 44.387 44.387 44.387 999 glider_record/m_gps_lat longitude -63.361 -63.36 -63.36 999 glider_record/m_gps_lon O2 343.24 345.38 346.77 999 oxygen_concentration pressure -0.0031 42.079 75.098 999 glider_record/sci_rbrctd_seapressure_00 profileLat [°N] 44.387 44.387 44.387 999 profile_lat profileLon [°E] -63.361 -63.361 -63.361 999 profile_lon SA 31.069 31.219 31.397 999 absolute_salinity salinity 30.922 31.072 31.249 999 glider_record/sci_rbrctd_salinity_00 temperature 0.7038 0.9002 1.2641 999 glider_record/sci_rbrctd_temperature_00 u [m/s] -0.18787 -0.18787 -0.18787 999 u v [m/s] 0.028753 0.028753 0.028753 999 v vx -0.18787 -0.18787 -0.18787 999 glider_record/m_water_vx vxi -0.24317 -0.24317 -0.24317 999 glider_record/m_initial_water_vx vy 0.028753 0.028753 0.028753 999 glider_record/m_water_vy vyi 0.011914 0.011914 0.011914 999 glider_record/m_initial_water_vy * Processing Log - 2023-07-18 16:00:45.229 UTC: `create 'glider' object` - 2023-07-18 16:00:46.848 UTC: `subset(x = g, subset = i < 1000)` ```