GithubHelp home page GithubHelp logo

bczernecki / climate Goto Github PK

View Code? Open in Web Editor NEW
64.0 6.0 19.0 11.77 MB

The R climate package: an interface for downloading in-situ meteorological (and hydrological) dataset

Home Page: https://bczernecki.github.io/climate/

License: Other

R 100.00%
climate climate-data meteorological-data meteorology ogimet imgw sounding r noaa-data r-package

climate's People

Contributors

aglogowski avatar bczernecki avatar kadyb avatar nowosad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

climate's Issues

nearest_stations_ogimet returns unexpected number of points

library(climate)

x <- nearest_stations_ogimet(country = "United+Kingdom", point = c(10, 50), add_map = FALSE, numbers_station = 10)
nrow(x)
#> [1] 140

Powyżej podałem, że chcę 10 stacji, a dostałem 140....

PS Nie wiem, czy argument numbers_station to najlepsza nazwa. Może no_of_stations?

A "no valid data found in the database" returns error

Hello,

I am trying to use SYNOP data over a whole region and would like to get the OGIMET SYNOP data. I always encounter an error and would like to get this solved (image below from Rstudio environment and the Ogimet station at the particular date).
I checked, this error comes when there is no valid data found in the database for the station at a specific date.
How to go about this. If there is no data at all, the response could show "NA" as not available for "ALL" the parameters.

Thanks for your help

image

image2

Nearest station IMGW

Add function for SYNOP, CLIMATE and PRECIP station as analogue to:
nearest_stations_nooa and nearest_stations_ogimet

area

d display Hi there,

Again thank for the climate package. My question is how to retrieve weather data for an area and display at the same time countries boundary within the area.
I am trying it on an area covering Senegal and Gambia, West Mali,South Mauritania and wonder if it is possible to add many countries rather than one by one?
Hope my explanation clear?

Thanks

CRAN policy issue

"Packages which use Internet resources should fail gracefully with an informative message if the resource is not available or has changed (and not give a check warning nor error). "

@bczernecki I checked your new implementation, but I am not sure if it fulfills CRAN policy requirements.
I turned off my internet access, and then did a package check - the result was an error (based on a policy it should be a message, not warning or error).

Error in another wyoming url

I changed Wyoming data url in sounding_wyoming.R.
url = paste0("http://weather.uwyo.edu/cgi-bin/bufrraob.py?datetime=", yy, "-", mm, "-", dd, "%20", hh, ":00:00&id=",wmo_id, "&type=TEXT:LIST") into url = paste0("http://weather.uwyo.edu/cgi-bin/bufrraob.py?datetime=", yy, "-", mm, "-", dd, "%20", hh, ":00:00&id=",wmo_id, "&type=TEXT:LIST").

I changed it because this link supports data in more China region. I think the content of these two pages in the main data section of <PRE></PRE> is the same. But is wrong when i test it.

profile <- sounding_wyoming(wmo_id = 45004, yy = 2021, mm = 07, dd = 16, hh = 00)
[1] "http://weather.uwyo.edu/cgi-bin/bufrraob.py?datetime=2021-07-16%2000:00:00&id=45004&type=TEXT:LIST"
Downloaded 164999 bytes...C:\Users\ADMINI~1\AppData\Local\Temp\2\Rtmp6F2IPE\file28d43e8110ae
Error in if (n == 0L) break : missing value where TRUE/FALSE needed.

Where should I improve? Thanks in advance.

Links1 (Which I want to use)
Links2 (Original)

Nierozumiały tekst

@bczernecki @aglogowski Chcę pobrać tylko dane z części z dwóch miesięcy. Dlaczego dostaję komunikat o "2019 05"? Może lepiej ten komunikat w ogóle usunąć?

library(climate)

x <- meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-07-08"),
                  station = 12330, coords = TRUE, precip_split = TRUE)
#> [1] 12330
#> 2019 07 
#> 2019 06 
#> 2019 05

Created on 2019-07-18 by the reprex package (v0.3.0)

meteo_shortening_imgw nie działa

library(climate)
monthly <- meteo_imgw("monthly", rank = "climate", year = 1969)
abbr <- meteo_shortening_imgw(data = monthly, col_names = "full", remove_duplicates = TRUE)

colnames(monthly)
colnames(abbr)

Function meteo_imgw() doesn't work properly

First of all thanks for your work - the package looks great :). Unfortunately, when I try to import data I get into troubles and my data frame doesn't look as should be. It looks like this issue is somehow related with merging files...

library(climate)
library(dplyr, warn.conflicts = FALSE)

df = meteo_imgw(interval = 'monthly', rank='synop', year = 2019, station = "ŁEBA") 
#> [1] "https://dane.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/miesieczne/synop/s_m_d_format.txt"
#> /tmp/RtmpzeUjGO/file16a51986d869
#> [1] "https://dane.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/miesieczne/synop/s_m_t_format.txt"
#> /tmp/RtmpzeUjGO/file16a51a2ed330
#> [1] "https://dane.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/miesieczne/synop/"
#> /tmp/RtmpzeUjGO/file16a53a5e74de
#> [1] "https://dane.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/miesieczne/synop/2019/2019_m_s.zip"
#> /tmp/RtmpzeUjGO/file16a5205f5fe3
#> Warning in merge.data.frame(data1, data2, by = c("Kod stacji", "Nazwa stacji", :
#> column names 'NA.x', 'NA.x', 'NA.x', 'NA.x', 'NA.x', 'NA.x', 'NA.x', 'NA.x' are
#> duplicated in the result
str(df)
#> 'data.frame':    12 obs. of  35 variables:
#>  $ rank                : chr  "SYNOPTYCZNA" "SYNOPTYCZNA" "SYNOPTYCZNA" "SYNOPTYCZNA" ...
#>  $ id                  : int  354170120 354170120 354170120 354170120 354170120 354170120 354170120 354170120 354170120 354170120 ...
#>  $ station             : chr  "ŁEBA" "ŁEBA" "ŁEBA" "ŁEBA" ...
#>  $ yy                  : int  2019 2019 2019 2019 2019 2019 2019 2019 2019 2019 ...
#>  $ mm                  : int  1 2 3 4 5 6 7 8 9 10 ...
#>  $ rr_monthly          : num  0 0.7 2.1 2.9 7.5 13.7 13.5 13.9 11.6 7.8 ...
#>  $ rr_max_daily        : num  0.6 3.1 5.1 7.9 10.9 19.4 17.1 18.8 14.7 10.7 ...
#>  $ first_day_max_rr    : num  0 -10.8 -10.2 -9.3 -4.1 0.8 4.1 5.4 3 -0.3 ...
#>  $ last_day_max_rr     : int  8 NA NA NA NA NA NA NA NA NA ...
#>  $ snowcover_max       : logi  NA NA NA NA NA NA ...
#>  $ snowcover_days      : logi  NA NA NA NA NA NA ...
#>  $ rain_days           : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ snow_days           : int  8 NA NA NA NA NA NA NA NA NA ...
#>  $ r_s_days            : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ hail_days           : logi  NA NA NA NA NA NA ...
#>  $ fogginess_days      : int  17 5 1 2 0 0 0 0 0 1 ...
#>  $ rime_days           : int  12 4 3 1 0 0 0 0 0 0 ...
#>  $ snowstorm_low_days  : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ snowstorm_high_days : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ hazyness_days       : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ ws_10ms_days        : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ ws_15ms_days        : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ thunder_days        : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ dew_days            : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ hoarfrost_days      : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ NA.x                : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ cloud_mean_mon      : num  6.3 5.7 5.8 2.9 5.4 3.7 5 4.5 5.8 6.1 ...
#>  $ ws_mean_mon         : num  5.3 5.7 6.8 4.6 5.3 4.2 5 3.5 5.6 4.8 ...
#>  $ vapor_press_mean_mon: int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ rh_mean_mon         : int  8 NA NA NA NA NA NA NA NA NA ...
#>  $ press_mean_mon      : int  8 NA NA NA NA NA NA NA NA NA ...
#>  $ slp_mean_mon        : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ rr_daytime          : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ rr_nightime         : int  NA NA NA NA NA NA NA NA NA NA ...
#>  $ NA.y                : int  NA NA NA NA NA NA NA NA NA NA ...

sessionInfo()
#> R version 4.0.1 (2020-06-06)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 18.04.4 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
#> LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
#> 
#> locale:
#>  [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
#>  [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
#>  [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
#> [10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices datasets  utils     methods   base     
#> 
#> other attached packages:
#> [1] dplyr_1.0.4   climate_0.9.9
#> 
#> loaded via a namespace (and not attached):
#>  [1] rstudioapi_0.13   knitr_1.31        magrittr_2.0.1    tidyselect_1.1.0 
#>  [5] R6_2.5.0          rlang_0.4.10      fansi_0.4.2       stringr_1.4.0    
#>  [9] highr_0.8         httr_1.4.2        tools_4.0.1       xfun_0.21        
#> [13] utf8_1.1.4        DBI_1.1.1         cli_2.3.1         ellipsis_0.3.1   
#> [17] htmltools_0.5.1.1 yaml_2.2.1        assertthat_0.2.1  digest_0.6.27    
#> [21] tibble_3.1.0      lifecycle_1.0.0   crayon_1.4.1      purrr_0.3.4      
#> [25] vctrs_0.3.6       fs_1.5.0          curl_4.3          glue_1.4.2       
#> [29] evaluate_0.14     rmarkdown_2.7     reprex_1.0.0      stringi_1.5.3    
#> [33] pillar_1.5.0      compiler_4.0.1    generics_0.1.0    XML_3.99-0.5     
#> [37] renv_0.13.0       pkgconfig_2.0.3

Problem z pobraniem danych hydrologicznych.

Błąd który zgłaszam dotyczy funckji "hydro_imgw". Gdy używam poniższego kodu:
df = hydro_imgw(interval = 'daily', year=1984, station = "CHARZYKOWY")
to otrzymuję dane tylko dla grudnia. Inne miesiące są pobierane ale są nadpisywane.

Error while using meteo_ogimet() for certain stations in Switzerland

Hi team,

I'm using the package to get data for all stations in Switzerland 🇨🇭. I retrieved all stations in the country using:

library(tidyverse)
library(climate)

nearest_stations_ogimet(country = "Switzerland",
                        date = Sys.Date(),
                        add_map = TRUE,
                        point = c(8.2318, 46.7985),
                        no_of_stations = 200
)

ch_stations_ogimet <- nearest_stations_ogimet(country = "Switzerland",
                                              date = Sys.Date(),
                                              point = c(8.2318, 46.7985),
                                              no_of_stations = 200) %>% 
  arrange(wmo_id)

I tried to loop through all of them and some seem to throw an error. Bern works fine:

# example of one station
bern <- meteo_ogimet(
  date = c(as.Date("2020-02-01"), Sys.Date() - 1),
  # date = c(Sys.Date() - 7, Sys.Date() - 1), 
  interval = "daily",
  coords = FALSE, 
  station = "06631")

Whereas here I fail:

# example of an error
error <- meteo_ogimet(
  date = c(as.Date("2020-02-01"), Sys.Date() - 1),
  # date = c(Sys.Date() - 7, Sys.Date() - 1), 
  interval = "daily",
  coords = FALSE, 
  station = "06683")

Error in if ((length(test[2, !is.na(test[2, ])]) == 6 & test[2, 5] ==  : 
  argument is of length zero

Is there any error in my code? Are the data not available for this station of formatted differently? Or is there a problem with the package?

My session:

R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.1252 
[2] LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
 [1] magrittr_2.0.1  forcats_0.5.1   stringr_1.4.0   dplyr_1.0.6    
 [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.2   
 [9] tidyverse_1.3.1 ggplot2_3.3.3   climate_1.0.1  

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.1  xfun_0.23         haven_2.4.1      
 [4] colorspace_2.0-1  vctrs_0.3.8       generics_0.1.0   
 [7] htmltools_0.5.1.1 yaml_2.2.1        utf8_1.2.1       
[10] XML_3.99-0.6      rlang_0.4.11      pillar_1.6.1     
[13] glue_1.4.2        withr_2.4.2       DBI_1.1.1        
[16] dbplyr_2.1.1      modelr_0.1.8      readxl_1.3.1     
[19] lifecycle_1.0.0   munsell_0.5.0     gtable_0.3.0     
[22] cellranger_1.1.0  rvest_1.0.0       evaluate_0.14    
[25] labeling_0.4.2    knitr_1.33        curl_4.3.1       
[28] fansi_0.5.0       broom_0.7.6       Rcpp_1.0.6       
[31] scales_1.1.1      backports_1.2.1   jsonlite_1.7.2   
[34] fs_1.5.0          farver_2.1.0      hms_1.1.0        
[37] digest_0.6.27     stringi_1.6.2     grid_4.0.4       
[40] cli_2.5.0         tools_4.0.4       maps_3.3.0       
[43] crayon_1.4.1      pkgconfig_2.0.3   ellipsis_0.3.2   
[46] xml2_1.3.2        data.table_1.14.0 reprex_2.0.0     
[49] lubridate_1.7.10  rstudioapi_0.13   assertthat_0.2.1 
[52] rmarkdown_2.8     httr_1.4.2        R6_2.5.0         
[55] compiler_4.0.4   

Thank you very much for help! 🙇

Renaming

Zbiory danych (i w efekcie ich odniesienie się w funkcjach) muszą być zaktualizowane. Np. meteo_stations teraz powinno nazywać się meteo_stations_imgw, etc:

  • meteo_stations
  • meteo_metadata
  • meteo_shortening
  • meteo_abbrev ??
  • hydro_stations
  • hydro_shortening
  • hydro_metadata
  • hydro_abbrev ??
  • clean_metadata_meteo
  • clean_metadata_hydro

Error mesage for stations_ogimet

W przypadku podania nieistniejącego kraju nie pojawia się error. Tutaj powinien być error, że ta nazwa nie istnieje i jak znaleźć prawidłową. Powinno być też sprawdzenie czy długość argumentu jest większa niż 1.

library(climate)

x <- stations_ogimet(country = "Unitd+Kingdom", date = Sys.Date(),
                     add_map = FALSE)

Better error message for nearest_stations_ogimet

nearest_stations_ogimet powinien dawać bardziej informacyjny error przy błędnie podanym kraju. Powinien też sprawdzać długość argumentów wejściowych.

library(climate)

x <- nearest_stations_ogimet(country = "Pland", point = c(10, 50), add_map = TRUE, numbers_station = 10)
#> Warning in min(x): no non-missing arguments to min; returning Inf
#> Warning in max(x): no non-missing arguments to max; returning -Inf
#> Warning in min(x): no non-missing arguments to min; returning Inf
#> Warning in max(x): no non-missing arguments to max; returning -Inf
#> Error in plot.window(...): need finite 'xlim' values

IMGW: incorrect results if `station` length > 1

If the argument station in meteo_imgw_daily() function consists of more than 1 element, a warning is returned. This probably affects the return of fewer observations.

library("climate")

names = c("CHRZĄSTOWO", "GORZYŃ")

meteo_data1 = meteo_imgw_daily(rank = "climate", year = 2021, station = names)
#> Warning message:
#>   In substr(all_data$`Nazwa stacji.x`, 1, nchar(station)) == station :
#>   longer object length is not a multiple of shorter object length
nrow(meteo_data1)
#> [1] 271

meteo_data2 = meteo_imgw_daily(rank = "climate", year = 2021, station = names[1])
nrow(meteo_data2)
#> [1] 273

meteo_data3 = meteo_imgw_daily(rank = "climate", year = 2021, station = names[2])
nrow(meteo_data3)
#> [1] 273

Website

Trzeba się określić w kwestii strony internetowej. Czy imgw.ml ma być tylko dla imgw, czy też dla climate? Jeżeli to drugie to lepiej tutaj przenieść winiety, etc.

Calculations in WGS 84 are inaccurate

I think you should consider saving the location of IMGW stations in EPSG 2180 coordinate system as default. Currently distance calculations based on WGS 84 are inaccurate (several km difference).

library("sf")
library("climate")

data(imgw_hydro_stations)
imgw_hydro_stations = imgw_hydro_stations[imgw_hydro_stations$id == 154170050, ]
coords = c(imgw_hydro_stations$X, imgw_hydro_stations$Y)
st = nearest_stations_imgw(type = "meteo", rank = "synop", point = coords,
                           no_of_stations = 1, add_map = FALSE)
st$`distance [km]`
#> 35.601

### EPSG 2180
P1 = st_sfc(st_point(coords), crs = 4326)
P1 = st_transform(P1, crs = 2180)
P2 = st_sfc(st_point(c(st$X, st$Y)), crs = 4326)
P2 = st_transform(P2, crs = 2180)

as.vector(st_distance(P1, P2)) / 1000
#> 21.01992

Kod użyty w artykule

Stabilna wersja tego kodu powinna być gdzieś w plikach pakietu. Np. w folderze data-raw: 01-example.R, etc.

Problem przy pobieraniu kilku stacji z nadaniem coordynatów

działa:
climate::meteo_imgw(interval = "monthly",rank = "synop",year = 2000:2006,coords = F,station = c(350200570,350200575))
Natomiast:
climate::meteo_imgw(interval = "monthly",rank = "synop",year = 2000:2006,coords = T,station = c(350200570,350200575))
daje błąd
BŁĄD: Selected station(s) is not available in the database.

No internet connection

Dear authors,
I can't run the example code because of "No internet connection" issues like that:
1641792476(1)
how should I solve it?

Bests

hydro_shortening_imgw nie działa

library(climate)

monthly <- hydro_imgw("monthly", year = 1969)
abbr <- hydro_shortening_imgw(data = monthly, col_names = "polish", remove_duplicates = TRUE)

colnames(monthly)
colnames(abbr)

Progress bar

PRogress bar kończy działanie na 67% (nie ma 100%).
Dodatkowo to issue jest otwarte, żeby dodać progress bar do innych funkcji.

library(climate)
y <-  2018
x <- meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-07-08"),
                  station = 12330, coords = FALSE)
#> [1] 12330
#> 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |======================                                           |  33%
  |                                                                       
  |===========================================                      |  67%

Created on 2019-07-26 by the reprex package (v0.3.0)

sounding_wyoming - better error message

Kolejne dwa przypadki podobne do #9.

W pierwszym podany jest błędny numer stacji. Error powinien to powiedzieć + podpowiedzieć skąd wziąć kod.

library(climate)

profile <- sounding_wyoming(wmo_id = 12220, yy = 2019, mm = 4, dd = 4, hh = 0)
#> Error in if (skip) readLines(file, n = skip): argument is not interpretable as logical

W drugim podałem dwa argumenty do wmo_id. Dla tej funkcji powinny być sprawdzenia (defensive programming), że wszystkie argumenty mają długość 1, a następnie informacyjny error, co ma użytkownik naprawić.

profile <- sounding_wyoming(wmo_id = c(12120, 12375), yy = 2019, mm = 4, dd = 4, hh = 0)
#> Error in download.file(url, temp): 'url' must be a length-one character vector

Better error message needed

library(climate)

x <- meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-07-08"),
                  station = 22222, coords = FALSE)
#> Daily raports was genereted starting form 6 am each day. Set hour to change it 
#> [1] 22222
#> 
  |                                                                       
  |                                                                 |   0%
#> Error in if ((length(test[2, !is.na(test[2, ])]) == 6 & test[2, 5] == : argument is of length zero

W tej sytuacji powinien pojawić się error (lub warning, patrz niżej), że takiej stacji nie ma + podpowiedź jak znaleźć stację.

Jeszcze jest druga sytuacja:

  x <- meteo_ogimet(interval = "daily", date = c("2019-06-01", "2019-07-08"),
                    station = c(12330, 22222), coords = FALSE)

W tym wypadku teraz dostajemy nieinformacyjny error. Zamiast tego powinny się dane dla 12330 pobrać, a następnie pojawić się warning, że takiej stacji nie ma + podpowiedź jak znaleźć stację.

nearest_stations_ogimet API

Poprawcie mnie jeżeli się mylę, ale w tej funkcji powinno być do wyboru country lub point (inaczej mówiąc (1) tylko country, (2) tylko point, (3) oba) . Co jeżeli podam "Poland", ale współrzędne punktu w Chinach? Albo chcę 50 najbliższych stacji do punktu, który jest na granicy dwóch krajów a podałem tylko jeden?

New error message when downloading OGIMET data

I have been downloading daily data for the past 40 years for all stations in the US over the last few days. Up until today the code has been working and downloading all of the available data. I have gotten a few error messages for some stations but realized through another "issue" on github that it might mean that some of the stations only capture certain data. Starting today, every station I try to run results in an error and I have even tried to run several stations that I already have the data for and am receiving an error for them too. I am not sure what could have changed, so any insights would be greatly appreciated!

Below is an example of the line that I am running, just with different stations.

station70200 <- meteo_ogimet(date=c(Sys.Date()-15237, Sys.Date()-272), interval="daily", coords=FALSE, station=
70200)

Here is the error message I am receiving.
Warning in ogimet_daily(date = date, coords = coords, station = station) :
Mandatory meteorological parameters (i.e. Temperature or precipitations) are not present.
Check content of the current URL:
https://www.ogimet.com/cgi-bin/gsynres?lang=en&ind=70200&ndays=32&ano=2004&mes=11&day=16&hora=6&ord=REV&Send=Send
Error in if ((length(test[2, !is.na(test[2, ])]) == 6 & test[2, 5] == :
argument is of length zero

plot error

Thank for this useful package, trying to replicate your example station from UK on my country but get error and wonder why?:
nearest_stations_ogimet(country = "Senegal",

  •                     date = Sys.Date(),
    
  •                     add_map = TRUE,
    
  •                     point = c(-16, 15),
    
  •                     no_of_stations = 100
    
  • )
    Error in plot.window(...) : need finite 'xlim' values

Another question, is it possible to add another country like Gambia which is within Senegal?

Suggestions to `nearest_stations_imgw()`

  1. nearest_stations_imgw() returns distance [km] column. To make a selection, we have to use grave accents. Maybe it would be better and easier to change the column name to distance and record the returned units in the documentation?
library("climate")

data(imgw_hydro_stations)
imgw_hydro_stations = imgw_hydro_stations[imgw_hydro_stations$id == 154170050, ]
coords = c(imgw_hydro_stations$X, imgw_hydro_stations$Y)
st = nearest_stations_imgw(type = "meteo", rank = "synop", point = coords,
                           no_of_stations = 1, add_map = FALSE)
st$`distance [km]` # column selection

make.names(colnames(st)[5])
#> "distance..km."
  1. Since the argument add_map = TRUE requires additional packages, maybe it would be better to change it to FALSE? This will avoid errors if packages are not installed.

Information about measurement height over ground.

Hi,

For the wind measurements in the Poland meteo_imgw data set, is there meta-data on the observation height over ground surface? I.e the height of the sensor? To clarify, I am not talking about the elevation above sea level of the measuring station, rather the height of the sensor relative to the ground.

Regards,
Magnus Tronstad

Brak dostępu do hosta dane.imgw.pl

Przy próbie uruchomienia przykładowego polecenia (wersja climate = 0.9.8):
library(climate)
dane=meteo_imgw(interval = "hourly", year = 2015, station="WROCŁAW")

pojawia się komunikat:

[1] "https://dane.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/terminowe/synop/s_t_format.txt"
Could not resolve host: dane.imgw.pl
Błąd w poleceniu 'file(con, "r")':nie można otworzyć połączenia

Obecnie dane meteo i hydro są chyba pod innym adresem.

Dla powyższego przykładu znalazłem dane pod adresem:
https://danepubliczne.imgw.pl/data/dane_pomiarowo_obserwacyjne/dane_meteorologiczne/terminowe/synop/s_t_format.txt

bug if station empty

this doesn't work:

polska <- stations_ogimet(country = "Poland", add_map = T)
pol <- meteo_ogimet(interval = "daily", date = c("2019-10-15", "2019-10-15"), 
          coords = TRUE, stations = polska$wmo_id)

this works:

pol <- meteo_ogimet(interval = "daily", date = c("2019-10-15", "2019-10-15"),
          coords = TRUE, station = c(nr_pol[c(2:19,21:58,60:71, 74:77)]))

IMGW hydrological data has different number of columns

Hydrological data for the current year doesn't have the Przepływ [m^3/s] column until the end of the verification.

library("climate")

test = hydro_imgw_daily(year = 2019:2020)

#> Error in names(x) <- value : 
#>   'names' attribute [10] must be the same length as the vector [9]

I think a good idea would be to check if the data consists of 9 columns, if so we can create a 10th column with NAs and then insert it in the 8th position. Something like this:

if (ncol(data) == 9) {
  flow_NA = rep_len(NA, nrow(data))
  data = cbind(data, flow_NA)
  data = data[, c(1:7, 10, 8:9)]
}

Time-zone

Hi,

I cannot seem to find information on the time-zone used for presenting the measurements in the polish climate data-set (using meteo_imgw_hourly). Is this information available somehow?

Cheers,
Magnus

Problem with meteo_imgw function

Something is wrong with meteo_imgw function for monthly climate data:

df <- meteo_imgw("monthly", year = 1961:2020, coords = TRUE, rank="climate")

throws an exception:
Błąd w poleceniu 'fix.by(by.x, x)':'by' must specify uniquely valid columns

R version: 4.0.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.