Closed catsch closed 2 years ago
The intention with argo_filter_data_mode()
is to filter based on the filename (i.e., files that start with BD for BGC). I should definitely document this and add a argo_filter_parameter_data_mode()
that properly uses the parameter_data_mode column in the index!
library(dplyr, warn.conflicts = FALSE)
library(argodata)
prof_DM_CHLA <- argo_global_bio_prof() %>%
argo_filter_parameter("chla") %>%
argo_filter_data_mode("delayed")
#> Loading argo_global_bio_prof()
#> Downloading 1 file from 'https://data-argo.ifremer.fr'
# all D-files
head(basename(prof_DM_CHLA$file))
#> [1] "BD1902303_001.nc" "BD1902303_002.nc" "BD1902303_003.nc" "BD1902303_004.nc"
#> [5] "BD1902303_005.nc" "BD1902303_006.nc"
Created on 2021-10-13 by the reprex package (v2.0.1)
This should now work!
library(dplyr, warn.conflicts = FALSE)
library(argodata)
# works!
argo_global_bio_prof() %>%
argo_filter_parameter_data_mode("chla", "delayed")
#> Loading argo_global_bio_prof()
#> Downloading 1 file from 'https://data-argo.ifremer.fr'
#> # A tibble: 4,010 × 10
#> file date latitude longitude ocean profiler_type institution
#> <chr> <dttm> <dbl> <dbl> <chr> <dbl> <chr>
#> 1 corio… 2005-10-27 08:58:12 -16.4 -75.4 P 846 IF
#> 2 corio… 2005-11-01 08:48:23 -16.7 -75.2 P 846 IF
#> 3 corio… 2005-11-06 08:52:55 -16.8 -74.9 P 846 IF
#> 4 corio… 2005-11-11 08:53:17 -16.9 -74.3 P 846 IF
#> 5 corio… 2005-11-16 08:54:50 -16.8 -73.9 P 846 IF
#> 6 corio… 2005-11-21 08:48:58 -16.9 -73.7 P 846 IF
#> 7 corio… 2005-11-26 08:57:57 -17.3 -73.5 P 846 IF
#> 8 corio… 2005-12-01 08:47:31 -17.6 -73.8 P 846 IF
#> 9 corio… 2005-12-06 08:56:22 -17.3 -73.9 P 846 IF
#> 10 corio… 2005-12-11 08:58:30 -17.3 -73.6 P 846 IF
#> # … with 4,000 more rows, and 3 more variables: parameters <chr>,
#> # parameter_data_mode <chr>, date_update <dttm>
Created on 2021-10-13 by the reprex package (v2.0.1)
very nice !
I tried
prof_DM_CHLA<-argo_global_bio_prof() %>% argo_filter_parameter("chla") %>% argo_filter_data_mode("delayed")
it returns 65,128 rows while there are 4010 chla profiles in "delayed" so I assume I did something wrong, any guidance to filter with parameter_data_mode ?