Exercise: NetCDF and xarray#
External formats#
# import the xarray library
import xarray as xr
# Open the NetCdf file ../data/gfs_example.nc using the Xarray open_dataset method
ds = xr.open_dataset("../data/gfs_example.nc")
# Inspect the rich set of information about this dataset
# ds
# Which coordinates are in this dataset?
# Which convention is used for the latitude dimension, are the values sorted North-South or South-North?
# Why is this relevant when converting a file to Dfs2?
# Which data variables are in this dataset?
# What time period does it cover?
# What is the long name of the first data variable?
# Hint: ds.name_of_item.attrs
# To get the relative humidity at 40N, 10E @ '2021-08-24 02:00' we can use the .sel method like this:
# ds.rh2m.sel(lon=10, lat=40, time='2021-08-24 03:00')
# What is the surface temperature at 45N, 12E at 2021-08-24 00:00?