Grids

Grids is a class that contains data for working with grids. In the PlateTorques module, the Grids class is used to store the seafloor age grids and, if available, marine sediment thickness and/or erosion grids.

class plato.grids.Grids(settings=None, reconstruction=None, rotation_file=None, topology_file=None, polygon_file=None, reconstruction_name=None, ages=None, cases_file=None, cases_sheet='Sheet1', files_dir=None, seafloor_age_grids=None, sediment_grids=None, continental_grids=None, velocity_grids=None, DEBUG_MODE=False, PARALLEL_MODE=False)[source]

Bases: object

Class to hold gridded data.

Seafloor grids contain lithospheric age and, optionally, sediment thickness. Continental grids contain lithospheric thickness and, optionally, crustal thickness. Velocity grids contain plate velocity data.

Parameters:
  • settings (plato.settings.Settings) – Settings object (default: None)

  • reconstruction (gplately.PlateReconstruction) – Reconstruction object (default: None)

  • rotation_file (str) – filepath to .rot file with rotation poles (default: None)

  • topology_file (str) – filepath to .gpml file with topologies (default: None)

  • polygon_file (str) – filepath to .gpml file with polygons (default: None)

  • reconstruction_name (str) – model name string identifiers for the GPlately DataServer (default: None)

  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases_file (str) – filepath to excel file with cases (default: None)

  • cases_sheet (str) – name of the sheet in the excel file with cases (default: “Sheet1”)

  • files_dir (str) – directory to store files (default: None)

  • seafloor_age_grids (dict, xarray.Dataset) – seafloor age grids (default: None)

  • sediment_grids (dict, xarray.Dataset) – sediment thickness grids (default: None)

  • continental_grids (dict, xarray.Dataset) – continental crust thickness grids (default: None)

  • velocity_grids (dict, xarray.Dataset) – velocity grids (default: None)

  • DEBUG_MODE (bool) – flag to enable debug mode (default: False)

  • PARALLEL_MODE (bool) – flag to enable parallel mode (default: False)

add_grid(input_grids, variable_name='new_grid', grid_type='seafloor_age', target_variable='z', mask_continents=False, interpolate=True, prefactor=1.0)[source]

Function to add another grid of a variable to the seafloor grid. The grids should be organised in a dictionary with each item being an xarray.Dataset with each key being the corresponding reconstruction age, or a single xarray.Dataset, in which case it will be stored without an age. ‘mask_continents’ is a boolean that determines whether or not to cut the grids to the seafloor. It should only be used for grids that only describe the seafloor, e.g. marine sediment distributions, and not e.g. continental erosion rate grids.

Parameters:
  • input_grids (dict, xarray.Dataset) – input grids to add

  • variable_name (str) – name of the variable to add

  • grid_type (str) – type of grid to add to

  • target_variable (str) – variable to add

  • mask_continents (bool) – flag to mask continents (default: False)

  • interpolate (bool) – flag to interpolate (default: True)

  • prefactor (float) – prefactor to apply to the grid (default: 1.)

generate_velocity_grid(ages, cases, point_data, components=None, PROGRESS_BAR=True)[source]

Function to generate a velocity grid.

Parameters:
  • ages (int, float) – ages of interest

  • cases (str) – cases of interest

  • point_data (dict) – point data to interpolate

  • components (str, list) – components to interpolate

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

interpolate_data_to_grid(age, lat, lon, data, case=None, grid_type='velocity')[source]

Function to interpolate data to the resolution of the seafloor age grid.

Parameters:
  • age (int, float) – age of the grid

  • lat (float, list, numpy.ndarray) – latitude of the grid

  • lon (float, list, numpy.ndarray) – longitude of the grid

  • data (float, list, numpy.ndarray) – data to interpolate

  • case (str) – case of the grid (default: None)

  • grid_type (str) – type of grid to interpolate to (default: “velocity”)

save_all(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save all the grids

Parameters:
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases (str, list) – cases of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

save_seafloor_age(ages=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the seafloor age grid.

Parameters:
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

save_sediment(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the sediment grid.

Parameters:
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases (str, list) – cases of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

save_continent(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the continental grid.

Parameters:
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases (str, list) – cases of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

save_velocity(ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save the the velocity grid.

Parameters:
  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases (str, list) – cases of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)

save_grid(data, type, ages=None, cases=None, file_dir=None, PROGRESS_BAR=True)[source]

Function to save a grid.

Parameters:
  • data (dict, xarray.Dataset) – data to save

  • type (str) – type of grid

  • ages (float, int, list, numpy.ndarray) – ages of interest (default: None)

  • cases (str, list) – cases of interest (default: None)

  • file_dir (str) – directory to store files (default: None)

  • (default (PROGRESS_BAR:flag to show progress bar) – True)