コード例 #1
0
## Time series decomposition on Helheim velocity
## 6 May 2020  EHU
import numpy as np
import matplotlib.pyplot as plt
import iceutils as ice
import sys

## Set up combined hdf5 stack
#fpath='/Users/lizz/Documents/Research/Gld-timeseries/Stack/'
hel_stack = ice.MagStack(files=['vx.h5', 'vy.h5'])
data_key = 'igram'  # B. Riel convention for access to datasets in hdf5 stack

## Extract time series at selected points
xy_1 = (
    308103., -2577200.
)  #polar stereo coordinates of a point near Helheim 2009 terminus, in m
xy_2 = (302026., -2566770.)  # point up on North branch
xy_3 = (297341., -2571490.)  # point upstream on main branch
xy_4 = (294809., -2577580.)  # point on southern tributary
xys = (xy_1, xy_2, xy_3, xy_4)
labels = ('Near terminus', 'North branch', 'Main branch', 'South branch')

series = [hel_stack.timeseries(xy=xyi, key=data_key) for xyi in xys]


## Set up design matrix and perform lasso regression, according to Bryan's documentation
def build_collection(dates):
    """
    Function that creates a list of basis functions for a given datetime vector dates.
    """
    # Get date bounds
コード例 #2
0
## Extract and plot Helheim time series with IceUtils
## 19 Mar 2020  EHU
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import iceutils as ice
import sys

## Set up combined hdf5 stack
fpath = '/Users/lizz/Documents/Research/Gld-timeseries/Stack/'
hel_stack = ice.MagStack(files=[fpath + 'vx.h5', fpath + 'vy.h5'])
data_key = 'igram'  # B. Riel convention for access to datasets in hdf5 stack

## Extract time series at selected points
xy_1 = (
    308103., -2577200.
)  #polar stereo coordinates of a point near Helheim 2009 terminus, in m
xy_2 = (302026., -2566770.)  # point up on North branch
xy_3 = (297341., -2571490.)  # point upstream on main branch
xy_4 = (294809., -2577580.)  # point on southern tributary
xys = (xy_1, xy_3, xy_4, xy_2)
labels = ('Near terminus', 'Main branch', 'South branch', 'North branch')

series = [hel_stack.timeseries(xy=xyi, key=data_key) for xyi in xys]

s = hel_stack.slice(index=10, key=data_key)

## Make some plots to show at EGU
colors = cm.get_cmap('Dark2')(np.linspace(0, 1, num=len(labels)))
fig1, ax1 = plt.subplots()
for i, ser in enumerate(series):
コード例 #3
0
ncfile.close()


# In[ ]:


## Define points at which to extract
upstream_max = 500 # index of last xh,yh within given distance of terminus--pts roughly 50m apart
xys = [(xh[i], yh[i]) for i in range(0, upstream_max, 20)][2::]

# ## Import and invert velocity observations

# In[ ]:

## Set up combined hdf5 stack
hel_stack = ice.MagStack(files=[velocity_fpath+'vx.h5', velocity_fpath+'vy.h5'])
data_key = 'igram' # B. Riel convention for access to datasets in hdf5 stack


# In[ ]:


# Create an evenly spaced time array for time series predictions
t_grid = np.linspace(hel_stack.tdec[0], hel_stack.tdec[-1], 1000)

# First convert the time vectors to a list of datetime
dates = ice.tdec2datestr(hel_stack.tdec, returndate=True)
dates_grid = ice.tdec2datestr(t_grid, returndate=True)

# Build the collection
collection = nifl.build_collection(dates)