In [1]:
%pylab inline
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
from osgeo import gdal
In [46]:
from scipy.misc import imresize
etopoH = gdal.Open("../Mapping/Resources/ETOPO1_Ice_c_geotiff.tif")
etopoH_img = etopoH.ReadAsArray()[::4,::4]
del(etopoH)
ages = np.load("../Mapping/Resources/global_age_data.3.6.z.npz")["ageData"]
etopoH_1 = imresize(etopoH_img, ages.shape, interp='bilinear', mode="F")
etopoH_1[ np.isnan(ages) ] = np.nan
In [ ]:
## Code here
In [ ]:
## Code here
In [56]:
# Now try interpolating the bathymetry to a smoothed / downsampled version of the ages.
ages_reduced = ages[::8,::8] # Try different values
In [30]:
## Your code here
In [51]:
fig = plt.figure(1)
ax1 = fig.add_subplot(111)
ax1.scatter(ages2[::10], etopoH_resized[::10], linewidth=0.0)
ax1.set_xlim(0, 120)
Out[51]:
In [60]:
from scipy.optimize import curve_fit
def sqrtage(age, A, B):
return ( A + B * sqrt(age))
valid_ages = ages_reduced[ np.where(isnan(ages_reduced) == False) ]
# valid_depths =
etopoH_2 = imresize(etopoH_img, ages_reduced.shape, interp='bilinear', mode="F")
valid_depths = etopoH_2[ np.where(isnan(ages_reduced) == False) ]
popt, pcov = curve_fit(sqrtage, valid_ages, valid_depths)
In [62]:
fig = plt.figure(1)
ax1 = fig.add_subplot(111)
ax1.scatter(ages2[::10], etopoH_resized[::10], linewidth=0.0)
ax1.set_xlim(0, 120)
ax1.scatter(valid_ages, popt[0] + popt[1] * np.sqrt(valid_ages))
Out[62]:
Actually, the other reason this doesn't work very well is that it fails to account for sediment thickness on the ocean floor