Skip to content

Commit

Permalink
hydro2023 fix (#100)
Browse files Browse the repository at this point in the history
* fix: hydro imgw daily

* fix: hydro-imgw

* fix: unit tests for ogimet datasets

* fix: hydro imgw

* fix: remove hydro semiannual and annual

* fix: hydro test

* fix: meteo_imgw

* fix: simplify read and fix IMGW tests

* Update README.md

* climate ver. 1.2.1

* feat: covr ignore

* adding .covrignore

* adding .covrignore

* feat: add calendar Date for hydro data

* climate 1.2.2

* fix: remove duplicates

* cleans readme

* fix: datastore as data.frame

* fix: ogimet_hourly logic

---------

Co-authored-by: Jakub Nowosad <[email protected]>
  • Loading branch information
bczernecki and Nowosad authored Dec 20, 2024
1 parent 68af360 commit 9f7e5b9
Show file tree
Hide file tree
Showing 39 changed files with 293 additions and 447 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ vignettes/articles/usecase.Rmd
^pkgdown$
^.codecov.yml$
^tests$
^.covrignore$
4 changes: 4 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
coverage:
ignore:
- "R/sounding_wyoming.R"
- "R/imgw_read.R"
- "R/onAttach.R"
status:
patch:
default:
Expand Down
3 changes: 3 additions & 0 deletions .covrignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
R/sounding_wyoming.R
R/imgw_read.R
R/onAttach.R
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ covr_report.html
lib
docs
pkgdown
.Renviron
.Renviron
test-out.txt
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: climate
Title: Interface to Download Meteorological (and Hydrological) Datasets
Version: 1.2.1
Version: 1.2.2
Authors@R: c(person(given = "Bartosz",
family = "Czernecki",
role = c("aut", "cre"),
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

export(.onAttach)
export(hydro_imgw)
export(hydro_imgw_annual)
export(hydro_imgw_daily)
export(hydro_imgw_monthly)
export(hydro_shortening_imgw)
Expand Down
11 changes: 8 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# climate 1.2.2

* Major fixes for adjusting code to stay in line with CRAN policies
* Fixes for `hydro_imgw()` set of functions due to changes in encoding and metadata structure

* Fixes and modifications for `hydro_imgw()` set of functions due to changes in the IMGW-PIB hydrological datasets
* adjusting code to recognize different encoding and directory structure
* adjusting changes in metadata
* removed option to download data for "semiannual and annual" time resolutions due to inconsistencies in the data
* Fix unit tests for ogimet- and IMGW-related datasets
* Resolving date formatting for hydrological data - the Date column represents calendar date
* Corrected logic in downloading hourly OGIMET dataset

# climate 1.2.1

* Major fixes for adjusting code to stay in line with CRAN policies
* Corrected duplicated column names for IMGW-PIB stations
* Adjusted encoding changes and documentation updates in `meteo_imgw_telemetry_stations()`

Expand Down
17 changes: 0 additions & 17 deletions R/clean_metadata_hydro.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,5 @@ clean_metadata_hydro = function(address, interval) {
if (interval == "daily") {
b = data.frame(parameters = a[1:10])
}
if (interval == "semiannual_and_annual") {
godzina = paste0(a[13], ":", a[14])
data = c(a[10:12], godzina)
data_od = paste0("wystapienie_od_", data)
data_do = paste0("wystapienie_do_", data)
SPT = unlist(strsplit(a[8], "]/")) # stan/przeplyw/temperatura
SPT[1] = paste0(SPT[1], "]")
SPT[2] = paste0(SPT[2], "]")
b = NULL
for (i in seq_along(SPT)) {
tmp = c(a[1:7], SPT[i], data_od, data_do)
b = cbind(b, tmp)
}
b = list("H" = data.frame(parameters = b[, 1]),
"Q" = data.frame(parameters = b[, 2]),
"T" = data.frame(parameters = b[, 3]))
}
return(b)
}
14 changes: 3 additions & 11 deletions R/hydro_imgw.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
#' Downloading daily, and monthly hydrological data from the measurement stations
#' available in the danepubliczne.imgw.pl collection
#'
#' @param interval temporal resolution of the data ("daily" , "monthly",
#' or "semiannual_and_annual")
#' @param interval temporal resolution of the data ("daily" or "monthly")
#' @param year vector of years (e.g., 1966:2000)
#' @param coords add coordinates of the stations (logical value TRUE or FALSE)
#' @param value type of data (can be: state - "H" (default), flow - "Q", or
Expand Down Expand Up @@ -38,20 +37,13 @@ hydro_imgw = function(interval,
# dobowe
calosc = hydro_imgw_daily(year = year, coords = coords, station = station, col_names = col_names, ...)
} else if (interval == "monthly") {
#miesieczne
# miesieczne
calosc = hydro_imgw_monthly(year = year,
coords = coords,
station = station,
col_names = col_names, ...)
} else if (interval == "semiannual_and_annual") {
# polroczne_i_roczne
calosc = hydro_imgw_annual(year = year,
coords = coords,
value = value,
station = station,
col_names = col_names, ...)
} else{
stop("Wrong `interval` value. It should be either 'daily', 'monthly', or 'semiannual_and_annual'.", call. = FALSE)
stop("Wrong `interval` value. It should be either 'daily' or 'monthly'", call. = FALSE)
}
return(calosc)
}
135 changes: 0 additions & 135 deletions R/hydro_imgw_annual.R

This file was deleted.

Loading

0 comments on commit 9f7e5b9

Please sign in to comment.