Comments (3)
@iskandari could you look into this and the suggestion by @peterdesmet of transfering to suntools?
from biorad.
Not familiar with this issue, but if bioRad provides a more sensible output than suntools, than it might be good to update suntools. @adokter or @pieterh, could you look into this and potentially transfer this issue to https://github.com/adokter/suntools/issues?
from biorad.
@grapemanJac thanks for highlighting this nuance with tibbles, which I just found out are actually just lists:
typeof(dat)
[1] "list"
You are not able to extract a timezone using lubridate::tz()
because you are passing a tibble object instead of a POSIXct
object, so you have to go one level deeper:
dat <- tibble(Date = seq(as.POSIXct("2023-08-01 00:00:00",
format = "%Y-%m-%d 00:00:00",
tz = "Australia/Perth",
force_tz = TRUE),
as.POSIXct("2023-08-05 00:00:00",
format = "%Y-%m-%d 00:00:00",
tz = "Australia/Perth",
force_tz = TRUE),
by = '1 day'))
tz(dat[1,1])
[1] "UTC"
Warning message:
tz(): Don't know how to compute timezone for object of class tbl_df/tbl/data.frame; returning "UTC"
For example, any of these work:
tz(dat$Date)
[1] "Australia/Perth"
dat[1,1]$Date
[1] "2023-08-01 AWST"
tz(dat[1,1]$Date)
[1] "Australia/Perth"
tz(dat$Date[1])
[1] "Australia/Perth"
So this can be easily remedied in dplyr::mutate()
by extracting the tz directly from the Date vector:
#Roebuck, AU
dat <- dat %>% mutate(Sunrise = bioRad::sunrise(Date, lon = 122.48, lat = -17.846, tz=tz(Date), force_tz = TRUE),
Sunset = bioRad::sunset(Date, lon = 122.48, lat = -17.846, tz=tz(Date), force_tz = TRUE))
dat
# A tibble: 5 × 3
Date Sunrise Sunset
<dttm> <dttm> <dttm>
1 2023-08-01 00:00:00 2023-08-01 06:19:31 2023-08-01 17:33:35
2 2023-08-02 00:00:00 2023-08-02 06:19:06 2023-08-02 17:33:52
3 2023-08-03 00:00:00 2023-08-03 06:18:40 2023-08-03 17:34:10
4 2023-08-04 00:00:00 2023-08-04 06:18:13 2023-08-04 17:34:27
5 2023-08-05 00:00:00 2023-08-05 06:17:45 2023-08-05 17:34:44
from biorad.
Related Issues (20)
- document vpts csv format in calculate_vp()
- altitude shift in flight altitude quantiles calculated by in integrate_profile() HOT 1
- s3 bucket no longer exists HOT 2
- Address testthat 3rd edition updates HOT 1
- release bioRad 0.7.2
- VPTS object has duplicate columns `dbz_all` and `DBZH`, with incorrect repeating values HOT 2
- VP and VPTS object use `0/1` rather than `false/true` for `gap` HOT 5
- download_pvolfiles aborts instead of skips days without data
- CRAN check failures HOT 2
- fix default refractive index of water in eta_to_dbz() and dbz_to_eta() HOT 4
- download_basemap from Stamen no longer working HOT 2
- single_pol flag in calculate_vp() not working HOT 1
- `list_vpst_aloft` fails on `hdf5` HOT 1
- `download_vpfiles()` currently broken HOT 1
- incorrect range gate start attribute HOT 1
- VPTS files with multiple sd_vvp_thresholds fail to load
- Combining hdf5 and csv VP files HOT 1
- `read_vpts()` cannot read bioRad created CSV HOT 5
- Error when plotting clutter maps HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from biorad.