Code
Tools
Here I have listed some Python tools I have developed. I have limited capacity to update these so use at your own risk. You can also buy me a coffee if you found them useful :-)
Get weather station data (Global)
- Can run from your laptop etc
- GitHub repo
- Notebooks for working with monthly and daily averaged data
from get_station_data import ghcnd
from get_station_data.util import nearest_stn
### Read station metadata
stn_md = ghcnd.get_stn_metadata()
### Choose a location & number of nearest neighbours
lon_lat = -0.1278, 51.5074 # i.e., London
my_stns = nearest_stn(stn_md, lon_lat[0], lon_lat[1],
n_neighbours=5 )
### Download and extract data into a pandas DataFrame
df = ghcnd.get_data(my_stns)
Get climate model output (CMIP5/6)
- Needs to run on systems where data is stored (e.g. JASMIN)
- GitHub repo
import baspy as bp
### Retrieve a filtered catalogue as a Pandas DataFrame
df = bp.catalogue(dataset='cmip5', Model='HadGEM2-CC',
RunID='r1i1p1', Experiment='historical',
Var=['tas', 'pr'], Frequency='mon')
### Iterate over rows in catalogue
for index, row in df.iterrows():
ds = bp.open_dataset(row) ### In Xarray
cubes = bp.get_cube(row) ### Or... In Iris
Notebooks
Here are some Python notebooks I use for research and teaching. Please feel free to get in touch if you have any comments, or buy me a coffee
Getting started
- Using BASpy with Xarray to read in climate model data (CMIP5)
- Getting weather station data from around the globe (both monthly and daily averaged data)
Research
- Automatic detection of low pressure systems from pressure or geopotential height fields. Used here in this example to detect the Amundsen Sea Low
- Analysing simulated Antarctic preciptation from the RACMO regional climate model
- Working with model output from the the WRF regional climate model
Useful scripts
- Smoothing a timeseries using a low-pass filter
I have other notebooks here which I may or may not migrate over time to this site