hydrosolutions / riversCentralAsia

Package with helper functions to load, manage and analyze hydrometeorological data from Central Asia
GNU General Public License v3.0
1 stars 1 forks source link

computeDiurnalTemperatureCycle Function #122

Closed mengqi-z closed 1 year ago

mengqi-z commented 1 year ago

Hi @mabesa,

There is no example for this computeDiurnalTemperatureCycle function. Without example, it could be hard to correctly use this function based on the function documentation below.

#' @param era5_data ERA5 csv-file (RS MINERVE Database input) with details on
#'   stations and hourly P,T and Q data.
#' @param param Parameter list with year_min and year_max fields that denote the
#'   period of interest for which the mean diurnal per-sttion cycles should be
#'   computed.

For example, the list for param argument should include 5 elements, but the documentation only mentioned 2 element (year_min and year_max). I tried an example using the demo data atbashy_glacier_demo_data/RSMINERVE/hist_obs_rsm.csv, assuming this is the correct one to use for era5_data.

data <- read.csv('../atbashy_glacier_demo_data/RSMINERVE/hist_obs_rsm.csv')
param_list <- list(year_min = 1990, year_max = 2000,
                   year_min_Baseline = 1979, year_max_Baseline = 2011,
                   station = 'Atbaschy_Midstream_Subbasin_5')
test <- computeDiurnalTemperatureCycle(era5_data = data,
                                       param = param_list)

Then got this error:

Error in `build_longer_spec()`:
! `cols` must select at least one column.
Run `rlang::last_error()` to see where the error occurred.
Warning message:
`type_convert()` only converts columns of type 'character'.
- `df` has no columns of type 'character' 

It might be because I am using the wrong era5_data or param. It would be helpful to include an example in the instruction for this function. If that is difficult, please improve the documentation details for this function.

https://github.com/openjournals/joss-reviews/issues/4805

mabesa commented 1 year ago

Dear @mengqi-z, I am grateful for you vigilance (and sorry to cause a lot of work). I talked to the co-author and we decided to move the function computeDiurnalTemperatureCycle (and the two you mention in issue #123) out of the package because, as you saw, they are currently not used in the CAHAM book.