NEONScience / NEON-utilities

Utilities and scripts for working with NEON data. Currently: an R package with functions to join (stack) the month-by-site files in downloaded NEON data, to convert data to geoCSV format, and to download data from the API.
GNU Affero General Public License v3.0
57 stars 36 forks source link

Replace as.POSIXct with fasttime::fastPOSIXct in eddyStampCheck #128

Closed rfiorella closed 1 year ago

rfiorella commented 1 year ago

Replaces as.POSIXct with fasttime::fastPOSIXct to speed up POSIXct conversions in stackEddy. as.POSIXct seems to slow dramatically when vector to convert is very large - this change cuts runtime for stackEddy on L1/9 minute stack by roughly half.

rfiorella commented 1 year ago

A few issues I noticed after opening the PR:

1) There may be an issue with with second/millisecond parsing here that needs to be checked: https://stackoverflow.com/questions/71505467/r-fastposixct-milliseconds-not-parsed-correctly-and-time-zone-inconsistency - may not be an issue if slightly lower precision is permissible (e.g., to 1/10th second).

2) format argument is not used by fasttime::fastPOSIXct, because the format is assumed and fixed: https://cran.r-project.org/web/packages/fasttime/fasttime.pdf - I'll correct if this route seems viable

cklunch commented 1 year ago

Incorporated with slight modifications.