Skip to content

Instantly share code, notes, and snippets.

@angus-g
Created September 4, 2015 02:33
Show Gist options
  • Save angus-g/12a57caf8623e8e9f27b to your computer and use it in GitHub Desktop.
Save angus-g/12a57caf8623e8e9f27b to your computer and use it in GitHub Desktop.
from netCDF4 import Dataset
import numpy as np
NK = 40
depth = 4000
with Dataset('vgrid.nc', 'w') as d:
d.createDimension('level', NK)
zt = d.createVariable('zt', 'f8', ('level',))
zt.units = b'm'
zt[:] = np.linspace(0, -depth, NK)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment