pybacktrack.InterpolateDynamicTopography
- class pybacktrack.InterpolateDynamicTopography(grid_list_filename)
Class that just samples and interpolates time-dependent dynamic topography mantle frame grid files.
This class accepts locations that have already been reconstructed whereas
pybacktrack.DynamicTopographyaccepts present day locations and reconstructs them prior to sampling the dynamic topography grids.Notes
Added in version 1.4.
- __init__(grid_list_filename)
Load dynamic topography grid filenames and associated ages from grid list file ‘grid_list_filename’.
- Parameters:
grid_list_filename (str) – The filename of the grid list file.
- Raises:
ValueError – If
grid_list_filenamedoes not contain a grid at present day, orgrid_list_filenamecontains fewer than two grids, or not all rows ingrid_list_filenamecontain a grid filename followed by an age, or there are two ages ingrid_list_filenamewith same age.
Notes
Each dynamic topography grid should be in the mantle reference frame (not plate reference frame) and should have global coverage (such that no sample location will return NaN).
Each row in the grid list file should contain two columns. First column containing filename (relative to directory of list file) of a dynamic topography grid at a particular time. Second column containing associated time (in Ma).
Added in version 1.4.
Methods
__init__(grid_list_filename)Load dynamic topography grid filenames and associated ages from grid list file 'grid_list_filename'.
convert_from_dynamic_topography_model_or_bundled_model_name(...)Convert an argument that would normally be supplied to
pybacktrack.DynamicTopography.create_from_model_or_bundled_model_name()to an argument suitable forpybacktrack.InterpolateDynamicTopography.create_from_model_or_bundled_model_name().Create a InterpolateDynamicTopography instance from a bundled dynamic topography model name.
Create a InterpolateDynamicTopography instance from a user-provided model or from a bundled model.
sample(time, locations[, fallback_to_oldest])Samples and interpolates the two time-dependent dynamic topography grids surrounding
timeat the specified point location(s), but optionally falls back to sampling oldest grid (iftimeis too old).- static convert_from_dynamic_topography_model_or_bundled_model_name(dynamic_topography_model_or_bundled_model_name)
Convert an argument that would normally be supplied to
pybacktrack.DynamicTopography.create_from_model_or_bundled_model_name()to an argument suitable forpybacktrack.InterpolateDynamicTopography.create_from_model_or_bundled_model_name().- Parameters:
dynamic_topography_model_or_bundled_model_name (str) – An argument that would normally be supplied to
pybacktrack.DynamicTopography.create_from_model_or_bundled_model_name().- Return type:
An argument suitable for
pybacktrack.InterpolateDynamicTopography.create_from_model_or_bundled_model_name().- Raises:
ValueError – If
dynamic_topography_model_or_bundled_model_nameis not a str (name of a bundled dynamic topography model) or not a 3-tuple with first entry being the name of a (grid list) file that exists in the file system.
Notes
Added in version 1.5.
- static create_from_bundled_model(dynamic_topography_model_name)
Create a InterpolateDynamicTopography instance from a bundled dynamic topography model name.
- Parameters:
dynamic_topography_model_name (str) – Name of a bundled dynamic topography model. Choices include
terra,M1,M2,M3,M4,M5,M6,M7,ngrand,s20rts,smean,AY18,KM16,D10_gmcm9andgld428.- Returns:
The bundled dynamic topography model.
- Return type:
- Raises:
ValueError – If
dynamic_topography_model_nameis not the name of a bundled dynamic topography model.
Notes
Added in version 1.4.
- static create_from_model_or_bundled_model_name(dynamic_topography_model_or_bundled_model_name)
Create a InterpolateDynamicTopography instance from a user-provided model or from a bundled model.
- Parameters:
dynamic_topography_model_or_bundled_model_name (str) – Either the name of a bundled dynamic topography model (see
pybacktrack.InterpolateDynamicTopography.create_from_bundled_model()), or a user-provided model specified as the filename of the grid list file (see parameter ofpybacktrack.InterpolateDynamicTopography.__init__()).- Returns:
The dynamic topography model loaded from a user-provided model or from a bundled model.
- Return type:
- Raises:
ValueError – If
dynamic_topography_model_or_bundled_model_nameis not the name of a bundled dynamic topography model or the filename of an existing grid list file.
Notes
Added in version 1.4.
- sample(time, locations, fallback_to_oldest=True)
Samples and interpolates the two time-dependent dynamic topography grids surrounding
timeat the specified point location(s), but optionally falls back to sampling oldest grid (iftimeis too old).- Parameters:
time (float) – Time to sample dynamic topography.
locations (sequence of 2-tuple (float, float)) – A sequence of (longitude, latitude) point locations.
fallback_to_oldest (bool) – Whether to fall back to sampling oldest grid (if
timeis too old) rather than interpolating the two grids surroundingtime. Defaults toTrue.
- Returns:
The sampled dynamic topography values (one per location).
When
timeis older than the oldest dynamic topography grid:if
fallback_to_oldestisTruethen the oldest dynamic topography grid is sampled, orif
fallback_to_oldestisFalsethenNoneis returned.
- Return type:
list of float, or None
Notes
The point location(s) sample the two grids with ages bounding
timeand then interpolate between them.However if
timeis older than the oldest grid then the oldest grid is sampled (iffallback_to_oldestisTrue).All returned sample values are non-NaN.
Added in version 1.4.