-
Notifications
You must be signed in to change notification settings - Fork 16
Getting started
We have created a dataset that can be used for testing both the gridpp library and the command-line tool. The set includes five files that can be downloaded here:
Type | Filename | Valid date | Timesteps | Size |
---|---|---|---|---|
Observations | obs.nc | 20190822T10Z | 1 | 9.3 KB |
Ensemble analysis | analysis.nc | 20190822T10Z | 1 | 110 MB |
Deterministic forecast | forecast.nc | 20190822T00Z | 67 | 200 MB |
Small output grid | output.nc | 700 KB | ||
Large output grid | output_large.nc | 58 MB |
The analysis and forecast files contains NWP output at 2.5 km resolution from the Metcoop Ensemble Prediction System (MEPS) model used operationally by the Norwegian Meteorological Institute, Swedish Meteorological and Hydrological Institute, and the Finnish Meteorological Institute. Temperature and precipitation is included. This will allow you to test most of the features of gridpp.
Only one of the two output files are needed. The small output file contains a small domain covering south eastern Norway and is suitable for quick testing. The large output grid covers the whole Scandinavian peninsula, but the examples will take longer to compute. Both output files are at 1.0 km resolution.
To get ready for the examples in the next sections, run the code below to set up necessary variables. This retrieves air temperature and precipitation from the observation, analysis, and forecast files as well as metadata about the grids.
import gridpp
import netCDF4
import numpy as np
# Input data
with netCDF4.Dataset('analysis.nc', 'r') as file:
ilats = file.variables['latitude'][:]
ilons = file.variables['longitude'][:]
igrid = gridpp.Grid(ilats, ilons)
temp_analysis = np.moveaxis(np.squeeze(file.variables['air_temperature_2m'][:]), 0, 2)
precip_analysis = np.moveaxis(np.squeeze(file.variables['air_temperature_2m'][:]), 0, 2)
with netCDF4.Dataset('forecast.nc', 'r') as file:
temp_forecast = np.squeeze(file.variables['air_temperature_2m'][:])
precip_forecast = np.squeeze(file.variables['air_temperature_2m'][:])
# Output grid
with netCDF4.Dataset('output.nc', 'r') as file:
olats = file.variables['latitude'][:]
olons = file.variables['longitude'][:]
ogrid = gridpp.Grid(olats, olons)
# Observations
with netCDF4.Dataset('obs.nc', 'r') as file:
plats = file.variables['latitude'][:]
plons = file.variables['longitude'][:]
points = gridpp.Points(plats, plons)
temp_obs = file.variables['air_temperature_2m'][:, 0]
precip_obs = file.variables['precipitation_amount'][:, 0]