Skip to content

Commit

Permalink
cleans readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nowosad committed Oct 31, 2024
1 parent 0620a7a commit b5d7005
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and hydrological data from publicly available repositories:

## Installation

The stable release of the **climate** package from the [CRAN](https://CRAN.R-project.org) reposity can be installed with:
The stable release of the **climate** package from the [CRAN](https://CRAN.R-project.org) repository can be installed with:

``` r
install.packages("climate")
Expand Down Expand Up @@ -73,8 +73,6 @@ country in the Ogimet repository
- **imgw_meteo_abbrev** - Dictionary explaining variables available for meteorological stations (from the IMGW-PIB repository)
- **imgw_hydro_abbrev** - Dictionary explaining variables available for hydrological stations (from the IMGW-PIB repository)



## Example 1
#### Download hourly dataset from NOAA ISH meteorological repository:

Expand All @@ -90,8 +88,6 @@ head(noaa)
# 2019 1 1 3 16.85 52.417 84 5.2 4.6 5 240 1021.2 1900
```



## Example 2
#### Finding a nearest meteorological stations in a given country using NOAA ISH data source:

Expand All @@ -118,9 +114,9 @@ nearest_stations_ogimet(country = "United+Kingdom",

![100 nearest stations to given coordinates in UK](http://iqdata.eu/kolokwium/uk.png)


## Example 3
#### Downloading daily (or hourly) data from a global (OGIMET) repository knowing its ID (see also `nearest_stations_ogimet()`):

``` r
library(climate)
o = meteo_ogimet(date = c(Sys.Date() - 5, Sys.Date() - 1),
Expand Down Expand Up @@ -178,12 +174,11 @@ head(h)
## Example 5
#### Create Walter & Lieth climatic diagram based on downloaded data


``` r4
library(climate)
library(dplyr)
df = meteo_imgw(interval = 'monthly', rank='synop', year = 1991:2019, station = "POZNAŃ")
df = meteo_imgw(interval = "monthly", rank = "synop", year = 1991:2019, station = "POZNAŃ")
df2 = select(df, station:t2m_mean_mon, rr_monthly)
monthly_summary = df2 %>%
Expand Down Expand Up @@ -239,7 +234,6 @@ ggplot(co2, aes(date, co2_avg)) +

![CO2 monthly concentration, Mauna Loa observatory](http://iqdata.eu/kolokwium/co2_chart.svg)


## Example 7
#### Use "climate" inside python environment via rpy2

Expand All @@ -251,14 +245,14 @@ import pandas as pd
import datetime as dt

# load climate package (make sure that it was installed in R before)
importr('climate')
importr("climate")
# test functionality e.g. with meteo_ogimet function for New York - La Guardia:
df = robjects.r['meteo_ogimet'](interval = "daily", station = 72503,
date = robjects.StrVector(['2022-05-01', '2022-06-15']))
df = robjects.r["meteo_ogimet"](interval = "daily", station = 72503,
date = robjects.StrVector(["2022-05-01", "2022-06-15"]))
# optionally - transform object to pandas data frame and rename columns + fix datetime:
res = pd.DataFrame(df).transpose()
res.columns = df.colnames
res['Date'] = pd.TimedeltaIndex(res['Date'], unit='d') + dt.datetime(1970,1,1)
res["Date"] = pd.TimedeltaIndex(res["Date"], unit="d") + dt.datetime(1970,1,1)
res.head

>>> res[res.columns[0:7]].head()
Expand Down Expand Up @@ -293,4 +287,3 @@ LaTeX/BibTeX version can be obtained with:
library(climate)
citation("climate")
```

0 comments on commit b5d7005

Please sign in to comment.