Created
April 1, 2019 21:40
-
-
Save prl900/235139e6f2cc1d2e943f9819ba0f006c to your computer and use it in GitHub Desktop.
NetCDF to Numpy array conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xarray as xr | |
import numpy as np | |
tp = xr.open_dataset("EU_TP_ERAI.nc").tp[:].data.astype(np.float32) | |
print(tp.shape) | |
np.savez("/g/data/fj4/scratch/tp", tp[:, :, :]) | |
z = xr.open_dataset("EU_Z_ERAI.nc").z[:].data.astype(np.float32) | |
print(z.shape) | |
np.savez("/g/data/fj4/scratch/z", z[:, :, :, :]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment