A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

get-station-data

A set of Python tools to make it easier to extract weather station data (e.g., temperature, precipitation) from the Global Historical Climatology Network Daily.
https://github.com/scotthosking/get-station-data

Category: Climate Change
Sub Category: Climate Data Access and Visualization

Keywords

python

Keywords from Contributors

cmip6 climate-science

Last synced: about 11 hours ago
JSON representation

Repository metadata

Easily grab weather station data from around the globe (e.g. GHCN)

README.md

Get daily weather station data (Global)

A set of Python tools to make it easier to extract weather station data (e.g., temperature, precipitation) from the Global Historical Climatology Network - Daily (GHCND)

"The Global Historical Climatology Network daily (GHCNd) is an integrated database of daily climate summaries from land surface stations across the globe. GHCNd is made up of daily climate records from numerous sources that have been integrated and subjected to a common suite of quality assurance reviews. GHCNd contains records from more than 100,000 stations in 180 countries and territories. NCEI provides numerous daily variables, including maximum and minimum temperature, total daily precipitation, snowfall, and snow depth. About half the stations only report precipitation. Both record length and period of record vary by station and cover intervals ranging from less than a year to more than 175 years." source

More information on the data can be found here

Installation

  1. Install from the source code:
  • Clone the repository source code:
git clone https://github.com/scotthosking/get-station-data.git 
  • Install along with its dependencies:
cd /path/to/my/get-station-data
pip install -v -e .

Worked through example

from get_station_data import ghcnd
from get_station_data.util import nearest_stn

%matplotlib inline 

Read station metadata

stn_md = ghcnd.get_stn_metadata()

Choose a location (lon/lat) and number of nearest neighbours

london_lon_lat = -0.1278, 51.5074
my_stns = nearest_stn(stn_md, 
                        london_lon_lat[0], london_lon_lat[1], 
                        n_neighbours=5 )
my_stns

Download and extract data into a pandas DataFrame

df = ghcnd.get_data(my_stns)

df.head()

Filter data for, e.g., a single variable

var = 'PRCP'   # precipitation
df = df[ df['element'] == var ]

### Tidy up columns
df = df.rename(index=str, columns={"value": var})
df = df.drop(['element'], axis=1)

df.head()
df.drop(columns=['mflag','qflag','sflag']).tail(n=10)

Save to file

df.to_csv('London_5stns_GHCN-D.csv', index=False)

Plot histogram of all data

df['PRCP'].plot.hist(bins=40)
<matplotlib.axes._subplots.AxesSubplot at 0x11ae36898>

png

Plot time series for one station

heathrow = df[ df['name'] == 'HEATHROW' ]
heathrow['PRCP'].plot()
<matplotlib.axes._subplots.AxesSubplot at 0x81f0d7240>

png


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 7 days ago

Total Commits: 97
Total Committers: 7
Avg Commits per committer: 13.857
Development Distribution Score (DDS): 0.33

Commits in past year: 25
Committers in past year: 4
Avg Commits per committer in past year: 6.25
Development Distribution Score (DDS) in past year: 0.44

Name Email Commits
Scott Hosking j****g@g****m 65
Magnus m****s@g****m 14
Tom Andersson t****d@b****k 6
Scott Hosking s****t@S****e 5
Tom Andersson t****3@g****m 4
Scott Hosking s****t@S****l 2
Alejandro © a****c@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 4
Total pull requests: 6
Average time to close issues: 4 months
Average time to close pull requests: 6 days
Total issue authors: 3
Total pull request authors: 4
Average comments per issue: 3.0
Average comments per pull request: 1.0
Merged pull request: 5
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 0
Past year average time to close issues: N/A
Past year average time to close pull requests: N/A
Past year issue authors: 1
Past year pull request authors: 0
Past year average comments per issue: 0.0
Past year average comments per pull request: 0
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/scotthosking/get-station-data

Top Issue Authors

  • manmeet3591 (2)
  • scotthosking (1)
  • magnusross (1)

Top Pull Request Authors

  • magnusross (3)
  • tom-andersson (1)
  • scotthosking (1)
  • acocac (1)

Top Issue Labels

Top Pull Request Labels

Score: 5.278114659230517