#!/usr/bin/env python # coding: utf-8 # # Use HSDS (data chunks in S3 objects) to access Model Output # In[1]: get_ipython().run_line_magic('matplotlib', 'inline') import h5pyd import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np # In[2]: h5pyd.getServerInfo() # In[3]: # Open the wind data "file" # server endpoint, username, password is found via a config file #f = h5pyd.File("/home/rsignell/Sandy_ocean_his_nc4.nc", 'r') #f = h5pyd.File("/home/rsignell/sandy.nc", 'r') f = h5pyd.File("/home/rsignell/sandy2.nc", 'r') # In[4]: [print(k) for k in f.attrs.items()]; # In[5]: list(f) # list the datasets in the file # In[6]: dset = f['Hwave'] # In[7]: dset.id.id # if this is an int, then you are using h5py! # In[8]: dset.shape # In[9]: plt.plot(dset[:,30,40]) # In[10]: dset.chunks # In[11]: get_ipython().run_line_magic('time', 'data = dset[55,:,:]') # In[12]: data = np.ma.masked_equal(data, dset.fillvalue) # In[13]: plt.imshow(data, origin="lower") # In[14]: dset.fillvalue # In[15]: data = np.ma.masked_equal(data, 1.e37) # In[16]: plt.imshow(data, origin="lower")