I am new to python and trying to read in nc
file and get the variables but I get the error:
NameError: name 'fh' is not defined
Here is my code:
from netCDF4 import Dataset
import numpy as np
my_example_nc_file = r'''\D:\UoR\Practice data\cru10min30_tmp.nc'
fh = (my_example_nc_file, mode='r')'''
lons = fh.variables['lon'][:]
lats = fh.variables['lat'][:]
tmax = fh.variables['Tmax'][:]
tmax_units = fh.variables['Tmax'].units