Skip to content

Commit 85bb0d8

Browse files
author
Ben Mather
committed
compatibility with gplately >= 0.4
1 parent 0a8c137 commit 85bb0d8

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
if __name__ == "__main__":
1010
setup(
1111
name='slabdip',
12-
version='4.0',
12+
version='4.1',
1313
description='Setting up a python package',
1414
long_description=long_description,
1515
long_description_content_type='text/markdown',
@@ -18,7 +18,8 @@
1818
url='https://github.com/brmather/Slab-Dip',
1919
install_requires=[
2020
'pandas',
21-
'numpy'
21+
'numpy',
22+
'gplately >= 0.4'
2223
],
2324
extras_require={'plotting': ['matplotlib', 'jupyter', 'cartopy']},
2425
packages=['slabdip'],

slabdip/predictor.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,30 +116,30 @@ def model(self, value):
116116
def sample_age_grid(self, lons, lats, time):
117117
# age_grid = self.downloader.get_age_grid(reconstruction_time)
118118
if self.agegrid_filename:
119-
age_raster = gplately.Raster(filename=self.agegrid_filename.format(time))
119+
age_raster = gplately.Raster(data=self.agegrid_filename.format(time))
120120
elif self.downloader:
121121
grid = self.downloader.get_age_grid(time)
122-
age_raster = gplately.Raster(array=grid, extent=[-180,180,-90,90])
122+
age_raster = gplately.Raster(data=grid, extent=[-180,180,-90,90])
123123
else:
124124
raise ValueError("Cannot download age grid. \
125125
Set agegrid_filename or provide a supported reconstruction model")
126126

127-
age_raster.fill_NaNs(overwrite=True) # fill in NaN values
127+
age_raster.fill_NaNs(inplace=True) # fill in NaN values
128128
age_interp = age_raster.interpolate(lons, lats) # interpolate to trenches
129129
return age_interp
130130

131131
def sample_spreading_rate_grid(self, lons, lats, time):
132132
# spreadrate_grid = self.downloader.get_spreading_rate_grid(reconstruction_time)
133133
if self.spreadrate_filename:
134-
spreadrate_raster = gplately.Raster(filename=self.spreadrate_filename.format(time))
134+
spreadrate_raster = gplately.Raster(data=self.spreadrate_filename.format(time))
135135
elif self.downloader:
136136
grid = self.downloader.get_spreading_rate_grid(time)
137-
spreadrate_raster = gplately.Raster(array=grid, extent=[-180,180,-90,90])
137+
spreadrate_raster = gplately.Raster(data=grid, extent=[-180,180,-90,90])
138138
else:
139139
raise ValueError("Cannot download spreading rate grid. \
140140
Set spreadrate_filename or provide a supported reconstruction model")
141141

142-
spreadrate_raster.fill_NaNs(overwrite=True)
142+
spreadrate_raster.fill_NaNs(inplace=True)
143143
spreadrate_interp = spreadrate_raster.interpolate(lons, lats)
144144
return spreadrate_interp*1e-3
145145

@@ -262,7 +262,7 @@ def tessellate_slab_dip(self, time, tessellation_threshold_radians=DEFAULT_TESSE
262262
output_subducting_absolute_velocity_components=True)
263263

264264
# mask "negative" subduction rates
265-
subduction_convergence = subduction_data[:,2]*1e-2 * np.cos(np.deg2rad(subduction_data[:,3]))
265+
subduction_convergence = np.fabs(subduction_data[:,2])*1e-2 * np.cos(np.deg2rad(subduction_data[:,3]))
266266
subduction_data = subduction_data[subduction_convergence >= 0]
267267

268268
subduction_lon = subduction_data[:,0]
@@ -273,6 +273,8 @@ def tessellate_slab_dip(self, time, tessellation_threshold_radians=DEFAULT_TESSE
273273
subduction_pid_sub = subduction_data[:,8]
274274
subduction_pid_over = subduction_data[:,9]
275275
subduction_length = np.deg2rad(subduction_data[:,6]) * gplately.EARTH_RADIUS * 1e3 # in metres
276+
subduction_convergence = np.fabs(subduction_data[:,2])*1e-2 * np.cos(np.deg2rad(subduction_data[:,3]))
277+
subduction_migration = np.fabs(subduction_data[:,4])*1e-2 * np.cos(np.deg2rad(subduction_data[:,5]))
276278
subduction_convergence = subduction_data[:,2]*1e-2 * np.cos(np.deg2rad(subduction_data[:,3]))
277279
subduction_migration = subduction_data[:,4]*1e-2 * np.cos(np.deg2rad(subduction_data[:,5]))
278280
subduction_plate_vel = subduction_data[:,10]*1e-2

0 commit comments

Comments
 (0)