Skip to content

Instantly share code, notes, and snippets.

@prl900
Created August 7, 2019 21:46
Show Gist options
  • Save prl900/530528422ae869aa5f2d0ed0ae2fac4c to your computer and use it in GitHub Desktop.
Save prl900/530528422ae869aa5f2d0ed0ae2fac4c to your computer and use it in GitHub Desktop.
Adding ERA5 topography
import numpy as np
import netCDF4
x = netCDF4.Dataset("/datasets/work/D61_CPSR_A_INPUT/ERA5_global/press_levels_201501.nc")["z"][:]
x = np.moveaxes(x,1,-1)
topo = netCDF4.Dataset("/datasets/work/D61_CPSR_A_INPUT/ERA5_global/ERA5_orography.nc")['z'][:]
topo = np.tile(topo, (x.shape[0],1,1,1))
x = np.concatenate((x,topo), axis=3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment