gplately.reconstruct_grid
- gplately.reconstruct_grid(grid, partitioning_features, rotation_model, to_time, from_time=0.0, extent: tuple | str = 'global', origin=None, fill_value=None, threads=1, anchor_plate_id=None, x_dimension_name: str = '', y_dimension_name: str = '', data_variable_name: str = '')[source]
Reconstruct a gridded dataset to a given reconstruction time.
Note
Use
Raster.reconstruct()whenever is possible. Thisreconstruct_grid()is better to be private.- Parameters:
grid (array_like, or str) – The grid to be reconstructed. If
gridis a filename, it will be loaded usingread_netcdf_grid().partitioning_features (valid argument to pygplates.FeaturesFunctionArgument) – Features used to partition the
gridby plate ID, usually a static polygons file. Thepartitioning_featuresmay be a singlepygplates.Featureobject, apygplates.FeatureCollection, a filename (str), or a (potentially nested) sequence of any combination of the above types.rotation_model (valid argument to pygplates.RotationModel) – The rotation model used to reconstruct the
grid. Therotation_modelmay be apygplates.RotationModelobject, a rotationpygplates.FeatureCollection, a rotation filename (str), a rotationpygplates.Feature, a sequence of rotation features, or a (potentially nested) sequence of any combination of the above types.to_time (float) – Time to which
gridwill be reconstructed.from_time (float, default=0.0) – Time from which to reconstruct the
grid.extent (tuple or str, default="global") – Extent of the
grid. Valid arguments are a tuple of the form (xmin, xmax, ymin, ymax), or the string “global”, equivalent to (-180.0, 180.0, -90.0, 90.0).origin ({"upper", "lower"}, optional) – Origin of the
grid- either lower-left or upper-left. By default, determined from extent.fill_value (float, int, or tuple, optional, default=None) – The value to be used for regions outside of
partitioning_featuresatto_time. If not provided, this value will be determined based on the input.threads (int, default=1) – Number of threads to use for certain computationally heavy routines.
anchor_plate_id (int, optional, default=None) – ID of the anchored plate. By default, use the default anchor plate ID of
rotation_modelif it’s apygplates.RotationModel(otherwise zero).x_dimension_name (str, optional, default="") – If the grid file uses comman names, such as “x”, “lon”, “lons” or “longitude”, you need not set this parameter. Otherwise, you need to tell us what the x dimension name is.
y_dimension_name (str, optional, default="") – If the grid file uses comman names, such as “y”, “lat”, “lats” or “latitude”, you need not set this parameter. Otherwise, you need to tell us what the y dimension name is.
data_variable_name (str, optional, default="") – The program will try its best to determine the data variable name. However, it would be better if you could tell us what the data variable name is. Otherwise, the program will guess. The result may/may not be correct.
- Returns:
The reconstructed grid. Areas for which no plate ID could be determined from
partitioning_featureswill be filled withfill_value.- Return type:
numpy.ndarray
Note
For two-dimensional grids,
fill_valueshould be a single number. The default value will benp.nanfor float or complex types, the minimum value for integer types, and the maximum value for unsigned types. For RGB image grids,fill_valueshould be a 3-tuple RGB colour code or a matplotlib colour name. The default value will be black (0.0, 0.0, 0.0). For RGBA image grids,fill_valueshould be a 4-tuple RGBA colour code or a matplotlib colour name. The default fill value will be transparent black (0.0, 0.0, 0.0, 0.0).