Skip to content

Always include z in is_temp check#130

Open
j-fannon wants to merge 1 commit intoharphub:developfrom
j-fannon:feature/missing_z
Open

Always include z in is_temp check#130
j-fannon wants to merge 1 commit intoharphub:developfrom
j-fannon:feature/missing_z

Conversation

@j-fannon
Copy link
Copy Markdown
Contributor

@j-fannon j-fannon commented Jan 7, 2026

At the moment Z is not read from an OBSTABLE even though it exists. Seems to be due to the new is_temp check from 2b6d631 since harp_params$z does not have a v component. Example below:

library(harp)
library(RSQLite)
library(dplyr)
library(here)

harpIO::read_obs(
  dttm               = harpCore::seq_dttm("2025030100","2025030200"),
  file_path          = here("TMP_Z_ISSUE/vobs"),
  output_format_opts = harpIO::obstable_opts(path = here("TMP_Z_ISSUE"))
)
db <- dbConnect(SQLite(),here("TMP_Z_ISSUE/OBSTABLE_2025.sqlite"))
df <- tbl(db,"TEMP") %>% as_tibble()
dbDisconnect(db)
obs <- read_point_obs(
  seq_dttm("2025030100","2025030200"),
  parameter = "Z",
  file_path = here("TMP_Z_ISSUE"),
  vertical_coordinate = "pressure"
)

gives

Warning: 'Z' not found

and

> head(df)
# A tibble: 6 × 13
  valid_dttm   SID   lat   lon  elev     p     Z     T    RH     D     S         Q    Td
       <int> <int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>     <dbl> <dbl>
1 1740787200  1415  58.9  5.67    37  1000   229  277.  87.1   204     3  0.00449   276.
2 1740787200  1415  58.9  5.67    37   925   859  273.  75.8   254     6  0.00310   269.
3 1740787200  1415  58.9  5.67    37   850  1531  270.  49.6   269     6  0.00172   261.
4 1740787200  1415  58.9  5.67    37   700  3049  265.  17.4   274     7  0.000507  244.
5 1740787200 10618  49.7  7.33   377  1000   222   NA   NA      NA    NA NA          NA 
6 1740787200 10618  49.7  7.33   377   925   849  272.  96.3    59     8  0.00371   272.

I'm sure there is a better way than this hardcoding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant