Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Added initial version of Severn test script
Browse files Browse the repository at this point in the history
  • Loading branch information
kandread committed Aug 30, 2019
1 parent 07a5177 commit f4b0a92
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions confluence/severn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env python

import glob
import netCDF4 as netcdf
import numpy as np


def read_data(filenames):
"""Read data from NetCDF files."""
S = []
W = []
H = []
Q = []
for ncfile in filenames:
with netcdf.Dataset(ncfile) as f:
S.append(f['Reach_Timeseries']['S_90m'][:, 0].data)
W.append(np.mean(f['XS_Timseries']['W'][:].data, axis=1))
H.append(np.mean(f['XS_Timseries']['H_90m'][:].data, axis=1))
Q.append(f['Reach_Timseries']['Q'][:, 0].data)
Q, H, W, S = np.array(Q).T, np.array(H).T, np.array(W).T, np.array(S).T
return Q, H, W, S


def main():
"""Main driver routine."""
ncfiles = glob.glob("../Severn/*.nc")
Q, H, W, S = read_data(ncfiles)

0 comments on commit f4b0a92

Please sign in to comment.