Created
April 18, 2022 17:53
-
-
Save jreadey/5df328f589433f2dd95a48dd1cfe0e51 to your computer and use it in GitHub Desktop.
This file contains 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 sys | |
import h5pyd | |
import random | |
import logging | |
loglevel = logging.ERROR | |
logging.basicConfig(format='%(asctime)s %(message)s', level=loglevel) | |
if len(sys.argv) > 1 and sys.argv[1] in ("-h", "--help"): | |
print("usage: python bigandfancy.py <numcol>") | |
sys.exit() | |
if len(sys.argv) > 1: | |
num_cols = int(sys.argv[1]) | |
else: | |
num_cols = 4 | |
if num_cols < 1: | |
sys.exit("no numcols") | |
filepath = "/nrel/nsrdb/v3/nsrdb_2000.h5" | |
f = h5pyd.File(filepath, bucket="nrel-pds-hsds", retries=1) | |
dset = f['wind_speed'] | |
cols = [] | |
while len(cols) < num_cols: | |
n = random.randint(0, dset.shape[1]) | |
if n not in cols: | |
cols.append(n) | |
cols.sort() | |
arr = dset[0:50, cols] | |
print(arr.shape) | |
print(f"{arr.min()} {arr.max()} {arr.mean():6.2f}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment