AustralianAntarcticDivision / raadfiles

Data library management tools for files
https://australianantarcticdivision.github.io/raadfiles/
2 stars 1 forks source link

error in set_dt_utc() breaking oisst_daily_files #33

Closed Maschette closed 1 day ago

Maschette commented 1 day ago

Hey, There is an error with the set_dt_utc function where it is expecting something from bad in line 48 and not finding it.

https://github.com/AustralianAntarcticDivision/raadfiles/blob/24dc3ddaf0340d4b4f0cb47604ae4b4104405db7/R/utils.R#L48

tst$oisst <- raadtools::extract(readsst , tst %>% select(Start.Longitude, Start.Latitude, date))
Error in if (any(bad)) { : missing value where TRUE/FALSE needed

> traceback()
12: set_dt_utc(.)
11: dplyr::arrange(dplyr::distinct(files, date, .keep_all = TRUE), 
        date) %>% dplyr::select(.data$date, .data$fullname, .data$root) %>% 
        set_dt_utc()
10: (function () 
    {
        pattern <- c("avhrr", "^.*www.ncei.noaa.gov.*sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/.*\\.nc$")
        files <- .find_files_generic(pattern)
        if (nrow(files) < 1) {
            stop("no files found")
        }
        files <- dplyr::mutate(files, date = as.POSIXct(as.Date(stringr::str_extract(basename(.data$fullname), 
            "[0-9]{8}"), "%Y%m%d"), tz = "GMT"))
        dplyr::arrange(dplyr::distinct(files, date, .keep_all = TRUE), 
            date) %>% dplyr::select(.data$date, .data$fullname, .data$root) %>% 
            set_dt_utc()
    })()
9: eval(mc, parent.frame())
8: eval(mc, parent.frame())
7: withVisible(eval(mc, parent.frame()))
6: raadfiles::oisst_daily_files()
5: sstfiles(time.resolution = time.resolution)
4: readsst()
3: .is.positive.intlike(x)
2: .traceback(x, max.lines = max.lines)
1: traceback(readsst())

It seems to break both readsst and read_par in raadtools.

mdsumner commented 1 day ago

ouch, errors in HQ and not on nectar, I'll find out