polartoolkit.fetch
==================

.. py:module:: polartoolkit.fetch


Attributes
----------

.. autoapisummary::

   polartoolkit.fetch.ENGINE
   polartoolkit.fetch.USE_ARROW


Classes
-------

.. autoapisummary::

   polartoolkit.fetch.EarthDataDownloader


Functions
---------

.. autoapisummary::

   polartoolkit.fetch.get_fetches
   polartoolkit.fetch.resample_grid
   polartoolkit.fetch.sample_shp
   polartoolkit.fetch.mass_change
   polartoolkit.fetch.basal_melt
   polartoolkit.fetch.buttressing
   polartoolkit.fetch.ice_vel
   polartoolkit.fetch.modis
   polartoolkit.fetch.modis_moa
   polartoolkit.fetch.modis_mog
   polartoolkit.fetch.imagery
   polartoolkit.fetch.geomap
   polartoolkit.fetch.groundingline
   polartoolkit.fetch.measures_boundaries
   polartoolkit.fetch.antarctic_boundaries
   polartoolkit.fetch.sediment_thickness
   polartoolkit.fetch.ibcso_coverage
   polartoolkit.fetch.ibcso
   polartoolkit.fetch.bedmachine
   polartoolkit.fetch.bedmap_points
   polartoolkit.fetch.bedmap3
   polartoolkit.fetch.bedmap2
   polartoolkit.fetch.rema
   polartoolkit.fetch.deepbedmap
   polartoolkit.fetch.gravity
   polartoolkit.fetch.etopo
   polartoolkit.fetch.geoid
   polartoolkit.fetch.magnetics
   polartoolkit.fetch.ghf
   polartoolkit.fetch.gia
   polartoolkit.fetch.crustal_thickness
   polartoolkit.fetch.moho


Module Contents
---------------

.. py:data:: ENGINE
   :value: 'pyogrio'


.. py:data:: USE_ARROW
   :value: True


.. py:function:: get_fetches()

   get all the fetch functions defined in this module.

   :returns: names of each fetch function
   :rtype: list[str, tuple[float, float, float, float] ]


.. py:function:: resample_grid(grid, initial_spacing = None, initial_region = None, initial_registration = None, spacing = None, region = None, registration = None, **kwargs)

   Resample a grid to a new spacing, region, and/or registration. Method of resampling
   depends on comparison with initial and supplied values for spacing, region, and
   registration. If initial values not supplied, will try and extract them from the
   grid.

   :param grid: grid to resample
   :type grid: str | xarray.DataArray
   :param initial_spacing: spacing of input grid, if known, by default None
   :type initial_spacing: float | None, optional
   :param initial_region: region of input grid, if known, in format [xmin, xmax, ymin, ymax] by default
                          None
   :type initial_region: tuple[float, float, float, float] | None, optional
   :param initial_registration: registration of input grid, if known, by default None
   :type initial_registration: str | None, optional
   :param spacing: new spacing for grid, by default None
   :type spacing: float | None, optional
   :param region: new region for grid in format [xmin, xmax, ymin, ymax], by default None
   :type region: tuple[float, float, float, float] | None, optional
   :param registration: new registration for grid, by default None
   :type registration: str | None, optional

   :returns: grid, either resampled or same as original depending on inputs. If no
             resampling, and supplied grid is a filepath, returns filepath.
   :rtype: str | xarray.DataArray


.. py:class:: EarthDataDownloader

   Either pulls login details from pre-set environment variables, or prompts user to
   input username and password. Will persist the entered details within the python
   session.


   .. py:method:: __call__(url, output_file, dataset)


.. py:function:: sample_shp(name)

   Load the file path of sample shapefiles

   :param name: chose which sample shapefile to load, either 'Disco_deep_transect' or
                'Roosevelt_Island'
   :type name: str

   :returns: file path as a string
   :rtype: str


.. py:function:: mass_change(version = None, hemisphere = None, region = None, spacing = None, registration = None, **kwargs)

   Ice-sheet height and thickness changes from ICESat to ICESat-2 for both Antarctica
   and Greenland from :footcite:t:`smithpervasive2020`.

   Choose a version of the data to download with the format: "ICESHEET_VERSION_TYPE"
   where ICESHEET is "ais" or "gris", for Antarctica or Greenland, VERSION is "dhdt"
   for total thickness change or "dmdt" for corrected for firn-air content. For
   Antarctic data, TYPE is "floating" or "grounded".

   add "_filt" to retrieve a filtered version of the data for some versions.

   accessed from https://digital.lib.washington.edu/researchworks/handle/1773/45388

   Units are in m/yr

   :param version: choose which version to retrieve, by default is "ais_dhdt_grounded" for
                   Antarctica and "gris_dhdt" for Greenland.
   :type version: str, optional,
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default is 5km
   :type spacing: float, optional,
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is "p".
   :type registration: str, optional
   :param kwargs: additional keyword arguments to pass to resample_grid
   :type kwargs: typing.Any

   :returns: Returns a grid of Antarctic or Greenland ice mass change in meters/year.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: basal_melt(version = 'w_b', variable = None, region = None, spacing = None, registration = None, **kwargs)

   Antarctic ice shelf basal melt rates for 1994-2018 from satellite radar altimetry.
   from :footcite:t:`adusumilliinterannual2020`.

   accessed from http://library.ucsd.edu/dc/object/bb0448974g

   reading files and preprocessing from supplied jupyternotebooks:
   https://github.com/sioglaciology/ice_shelf_change/blob/master/read_melt_rate_file.ipynb

   Units are in m/yr

   :param version: choose which version to load, either 'w_b' for basal melt rate, 'w_b_interp',
                   for basal melt rate with interpolated values, and 'w_b_uncert' for uncertainty
   :type version: str

   :returns: Returns a dataarray of basal melt rate values
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: buttressing(version, variable = None, region = None, spacing = None, registration = None, **kwargs)

   Antarctic ice shelf buttressing.
   from :footcite:t:`furstsafety2016`.

   accessed from https://nsidc.org/data/nsidc-0664/versions/1

   Units are in m/yr

   :param version: choose which version to load, either 'max' for maximum buttressing, 'min' for
                   minimum buttressing, 'flow' for along-flow buttressing, or 'viscosity' for
                   estimated ice viscosity values
   :type version: str

   :returns: Returns a dataarray of buttressing or viscosity values
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: ice_vel(region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   MEaSUREs Phase-Based Ice Velocity Maps for Antarctica and Greenland.

   Antarctica: version 1 from :footcite:t:`mouginotcontinent2019` and
   :footcite:t:`mouginotmeasures2019`.

   accessed from https://nsidc.org/data/nsidc-0754/versions/1#anchor-1
   Data part of https://doi.org/10.1029/2019GL083826

   Greenland: version 1 from :footcite:t:`measures2020`

   accessed from https://nsidc.org/data/nsidc-0670/versions/1

   Units are in m/yr

   Requires an EarthData login, see Tutorials/Download Polar datasets for how to
   configure this.

   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default is 5km for Antarctica
                   (original data is 450m), and 250m for Greenland
   :type spacing: float, optional,
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param kwargs: additional keyword arguments to pass to resample_grid
   :type kwargs: typing.Any

   :returns: Returns a calculated grid of ice velocity in meters/year.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: modis(version = None, hemisphere = None)

   Load the MODIS Mosaic of Antarctica (MoA) or Greenland (MoG) imagery.

   Antarctica:
   from :footcite:t:`haranmodis2021` and :footcite:t:`scambosmodisbased2007`.

   accessed from https://nsidc.org/data/nsidc-0593/versions/2

   Greenland:
   from :footcite:t:`haranmeasures2018`
   accessed from https://nsidc.org/data/nsidc-0547/versions/2

   Requires an EarthData login, see Tutorials/Download Polar datasets for how to
   configure this.

   :param version: for Antarctica, choose between "750m" or "125m" resolutions, by default "750m",
                   for Greenland, choose between "500m" or "100m" resolutions, by default "500m"
   :type version: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional

   :returns: filepath for MODIS Imagery
   :rtype: str

   .. rubric:: References

   .. footbibliography::


.. py:function:: modis_moa(version = '750m')

   deprecated function, use modis(hemisphere="south") instead


.. py:function:: modis_mog(version = '500m')

   deprecated function, use modis(hemisphere="north") instead


.. py:function:: imagery()

   Load the file path of Antarctic imagery geotiff from LIMA from
   :footcite:t:`bindschadlerlandsat2008`. accessed from https://lima.usgs.gov/

   will replace with below once figured out login issue with pooch
   MODIS Mosaic of Antarctica: https://doi.org/10.5067/68TBT0CGJSOJ
   Assessed from https://daacdata.apps.nsidc.org/pub/DATASETS/nsidc0730_MEASURES_MOA2014_v01/geotiff/

   :returns: file path
   :rtype: str

   .. rubric:: References

   .. footbibliography::


.. py:function:: geomap(version = 'faults', region = None)

   Data from GeoMAP accessed from
   https://doi.pangaea.de/10.1594/PANGAEA.951482?format=html#download

   from :footcite:t:`coxcontinentwide2023` and :footcite:t:`coxgeomap2023`.

   :param version: choose which version to retrieve, "faults", "units", "sources", or "quality",
                   by default "faults"
   :type version: str, optional
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional

   :returns: Returns a geodataframe
   :rtype: geopandas.GeoDataFrame

   .. rubric:: References

   .. footbibliography::


.. py:function:: groundingline(version = 'measures-v2')

   Load the file path of two versions of groundingline shapefiles

   version = "depoorter-2013"
   from :footcite:t:`depoorterantarctic2013`.
   Supplement to :footcite:t:`depoortercalving2013`.

   version = "measures-v2"
   from :footcite:t:`mouginotmeasures2017`.
   accessed at https://nsidc.org/data/nsidc-0709/versions/2

   version = "BAS"
   from :footcite:t:`gerrishcoastline2020`.
   accessed at https://ramadda.data.bas.ac.uk/repository/entry/show?entryid=8cecde06-8474-4b58-a9cb-b820fa4c9429

   version = "measures-greenland"
   from :footcite:t:`haranmeasures2018`.

   Some versions require an EarthData login, see Tutorials/Download Polar datasets for
   how to configure this.

   :param version: choose which version to retrieve, by default "measures-v2"
   :type version: str, optional

   :returns: file path
   :rtype: str

   .. rubric:: References

   .. footbibliography::


.. py:function:: measures_boundaries(version = None)

   Deprecated, see the new function antarctic_boundaries instead


.. py:function:: antarctic_boundaries(version)

   Load various files from the MEaSUREs Antarctic Boundaries for IPY 2007-2009

   from :footcite:t:`mouginotmeasures2017`.
   accessed at https://nsidc.org/data/nsidc-0709/versions/2

   Requires an EarthData login, see Tutorials/Download Polar datasets for how to
   configure this.

   :param version: choose which file to retrieve from the following list:
                   "Coastline", "Basins_Antarctica", "Basins_IMBIE", "IceBoundaries", "IceShelf",
                   "Mask"
   :type version: str,

   :returns: file path
   :rtype: str

   .. rubric:: References

   .. footbibliography::


.. py:function:: sediment_thickness(version, region = None, spacing = None, registration = None, **kwargs)

   Load 1 of 4 'versions' of sediment thickness data.

   version='ANTASed'
   From :footcite:t:`baranovantased2021`.
   Accessed from https://www.itpz-ran.ru/en/activity/current-projects/antased-a-new-sediment-model-for-antarctica/

   version='tankersley-2022'
   From :footcite:t:`tankersleybasement2022`, :footcite:t:`tankersleybasement2022a`.

   version='lindeque-2016'
   From :footcite:t:`lindequepreglacial2016a` and :footcite:t:`lindequepreglacial2016`.

   version='GlobSed'
   From  :footcite:t:`straumeglobsed2019`.
   Accessed from https://ngdc.noaa.gov/mgg/sedthick/

   :param version: choose which version of data to fetch.
   :type version: str,
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of sediment thickness.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: ibcso_coverage(region = None)

   Load IBCSO v2 data, from :footcite:t:`dorschelinternational2022` and
   :footcite:t:`dorschelinternational2022a`.

   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float] or None

   :returns: Returns two geodataframes; points and polygons for a subset of IBCSO v2 point
             measurement locations. Column 'dataset_tid' is the type identifier from IBCSO.
             The points geodataframe contains all individual point measurements, including
             single-beam (TID 10), seismic points (TID 12), isolated soundings (TID 13),
             ENC sounding (TID 14), grounded iceberg draft (TID 46), and gravity-inverted
             bathymetry (TID 45). The polygon geodataframe contains all polygon measurements,
             including multi-beam (swath) (TID 11), contours from charts (TID 42), or
             other unknown sources (TID 71).
   :rtype: tuple[geopandas.GeoDataFrame, geopandas.GeoDataFrame]

   .. rubric:: References

   .. footbibliography::


.. py:function:: ibcso(layer, reference = 'geoid', region = None, spacing = 500, registration = None, **kwargs)

   Load IBCSO v2 data, from :footcite:t:`dorschelinternational2022` and
   :footcite:t:`dorschelinternational2022a`.

   By default the elevations are relative to Mean Sea Level (the geoid). To convert
   them to be relative to the WGS84 ellipsoid, set `reference="ellipsoid` which will
   add the EIGEN-6C4 geoid anomaly.

   :param layer: choose which layer to fetch:
                 'surface', 'bed'
   :type layer: str
   :param reference: choose which vertical reference to use, 'geoid' or 'ellipsoid', by default
                     'geoid'
   :type reference: str, optional
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 500 m
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of IBCSO data.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: bedmachine(layer, reference = 'eigen-6c4', region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   Load BedMachine topography data from either Greenland (v5) or Antarctica (v3),  from
   :footcite:t:`morlighemmeasures2022` or  :footcite:t:`icebridge2020a`.

   Antarctica:
   Accessed from NSIDC via https://nsidc.org/data/nsidc-0756/versions/3.
   Also available from
   https://github.com/ldeo-glaciology/pangeo-bedmachine/blob/master/load_plot_bedmachine.ipynb

   Greenland:
   Accessed from NSIDC via https://nsidc.org/data/idbmg4/versions/5

   Referenced to the EIGEN-6C4 geoid. To convert to be ellipsoid-referenced, we add
   the geoid grid. use `reference='ellipsoid'` to include this conversion in the
   fetch call.

   For Antarctica: Surface and ice thickness are in ice equivalents. Actual snow
   surface is from REMA :footcite:p:`howatreference2019`, and has had firn thickness
   added(?) to it to get Bedmachine Surface.

   To get snow surface: surface+firn
   To get firn and ice thickness: thickness+firn

   Here, icebase will return a grid of surface-thickness
   This should be the same as snow-surface - (firn and ice thickness)

   Requires an EarthData login, see Tutorials/Download Polar datasets for how to
   configure this.

   :param layer: choose which layer to fetch:
                 'bed', 'dataid', 'errbed', 'firn', 'geoid', 'mask', 'source',
                 'surface', 'thickness'; 'icebase' will give results of surface-thickness
   :type layer: str
   :param reference: choose whether heights are referenced to 'eigen-6c4' geoid or the
                     'ellipsoid' (WGS84), by default is eigen-6c4'
   :type reference: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 500m
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of Bedmachine.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: bedmap_points(version, region = None)

   Load bedmap point data, choose from Bedmap 1, 2 or 3 or all combined.

   All elevations are in meters above the WGS84 ellipsoid.

   version == 'bedmap1'
   from :footcite:t:`lythebedmap2001`.
   accessed from https://data.bas.ac.uk/full-record.php?id=GB/NERC/BAS/PDC/01619

   version == 'bedmap2'
   from :footcite:t:`fretwellbedmap22013`.
   accessed from https://data.bas.ac.uk/full-record.php?id=GB/NERC/BAS/PDC/01616

   version == 'bedmap3'
   from :footcite:t:`fremandbedmap32022`.
   accessed from  https://data.bas.ac.uk/full-record.php?id=GB/NERC/BAS/PDC/01614#access-data
   download link was found from https://ramadda.data.bas.ac.uk/repository/entry/show?entryid=61100714-1e32-44af-a237-0a517529bc49
   under DOI/BEDMAP3 datapoints, right click on the download link and copy link address

   :param version: choose between 'bedmap1', 'bedmap2', 'bedmap3', or 'all', point data
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional

   :returns: Return a dataframe, optionally subset by a region
   :rtype: pandas.DataFrame

   .. rubric:: References

   .. footbibliography::


.. py:function:: bedmap3(layer, reference = 'eigen-gl04c', region = None, spacing = None, registration = None, fill_nans = False, **kwargs)

   Load Bedmap3 data as an xarray.DataArray
   from :footcite:t:`pritchardbedmap32024`.
   accessed from https://ramadda.data.bas.ac.uk/repository/entry/show?entryid=2d0e4791-8e20-46a3-80e4-f5f6716025d2.

   All grids are by default referenced to the EIGEN-GL04C geoid. Use the
   reference='ellipsoid' to convert to the WGS-84 ellipsoid or reference='eigen-6c4' to
   convert to the EIGEN-6c4 geoid.

   Unlike Bedmachine data, Bedmap2 surface and icethickness contain NaN's over the
   ocean, instead of 0's. To fill these NaN's with 0's, set `fill_nans=True`.
   Note, this only makes since if the reference is the geoid, therefore, if
   `reference='ellipsoid` and `fill_nans=True`, the nan's will be filled before
   converting the results to the geoid (just for surface, since thickness isn't
   relative to anything).

   :param layer: choose which layer to fetch:
                 "surface", "icebase", "bed", "ice_thickness", "water_thickness",
                 "bed_uncertainty", "ice_thickness_uncertainty", and  "mask".
   :type layer: str
   :param reference: choose whether heights are referenced to the 'eigen-6c4' geoid, the WGS84
                     ellipsoid, 'ellipsoid', or by default the 'eigen-gl04c' geoid.
   :type reference: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: choose between 'g' (gridline) or 'p' (pixel) registration types, by default is
                        the original type of the grid
   :type registration: str, optional,
   :param fill_nans: choose whether to fill nans in 'surface' and 'thickness' with 0. If converting
                     to reference to the geoid, will fill nan's before conversion, by default is
                     False
   :type fill_nans: bool, optional,
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: optional

   :returns: Returns a loaded, and optional clip/resampled grid of Bedmap2.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: bedmap2(layer, reference = 'eigen-gl04c', region = None, spacing = None, registration = None, fill_nans = False, **kwargs)

   Load bedmap2 data as xarray.DataArrays
   from :footcite:t:`fretwellbedmap22013`.
   accessed from https://ramadda.data.bas.ac.uk/repository/entry/show?entryid=fa5d606c-dc95-47ee-9016-7a82e446f2f2.

   All grids are by default referenced to the EIGEN-GL04C geoid. Use the
   reference='ellipsoid' to convert to the WGS-84 ellipsoid or reference='eigen-6c4' to
   convert to the EIGEN-6c4 geoid.

   Unlike Bedmachine data, Bedmap2 surface and icethickness contain NaN's over the
   ocean, instead of 0's. To fill these NaN's with 0's, set `fill_nans=True`.
   Note, this only makes since if the reference is the geoid, therefore, if
   `reference='ellipsoid` and `fill_nans=True`, the nan's will be filled before
   converting the results to the geoid (just for surface, since thickness isn't
   relative to anything).

   :param layer: choose which layer to fetch:
                 "bed", "coverage", "grounded_bed_uncertainty", "icemask_grounded_and_shelves",
                 "lakemask_vostok", "rockmask", "surface", "thickness",
                 "thickness_uncertainty_5km", "gl04c_geiod_to_WGS84", "icebase",
                 "water_thickness"
   :type layer: str
   :param reference: choose whether heights are referenced to the 'eigen-6c4' geoid, the WGS84
                     ellipsoid, 'ellipsoid', or by default the 'eigen-gl04c' geoid.
   :type reference: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: choose between 'g' (gridline) or 'p' (pixel) registration types, by default is
                        the original type of the grid
   :type registration: str, optional,
   :param fill_nans: choose whether to fill nans in 'surface' and 'thickness' with 0. If converting
                     to reference to the geoid, will fill nan's before conversion, by default is
                     False
   :type fill_nans: bool, optional,
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: optional

   :returns: Returns a loaded, and optional clip/resampled grid of Bedmap2.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: rema(version = '1km', region = None, spacing = None, registration = None, **kwargs)

   Load the REMA surface elevation data from :footcite:t:`howatreference2019`. The data
   are in EPSG3031 and reference to the WGS84 ellipsoid. To convert the data to be
   geoid-referenced, subtract a geoid model, which you can get from fetch.geoid().

   Choose between "1km" or "500m" resolutions with parameter `version`.

   accessed from https://www.pgc.umn.edu/data/rema/

   :param version: choose which resolution to fetch, either "1km" or "500m", by default is "1km"
   :type version: str, optional,
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: choose between 'g' (gridline) or 'p' (pixel) registration types, by default is
                        the original type of the grid
   :type registration: str, optional,
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: optional

   :returns: Returns a loaded, and optional clip/resampled grid of the REMA DEM.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: deepbedmap(region = None, spacing = None, registration = None, **kwargs)

   Load DeepBedMap data,  from :footcite:t:`leongdeepbedmap2020` and
   :footcite:t:`leongdeepbedmap2020a`.

   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: optional

   :returns: Returns the filepath of DeepBedMap.
   :rtype: str

   .. rubric:: References

   .. footbibliography::


.. py:function:: gravity(version, region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   Loads gravity anomaly data for the Arctic and Antarctic.

   version='antgg'
   Antarctic-wide gravity data compilation of ground-based, airborne, and shipborne
   data, from :footcite:t:`scheinertnew2016`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.848168
   Anomalies are at the ice surface, or bedrock surface in areas of no ice. These
   surfaces are defined by Bedmap2 and are relative to the ellipsoid.

   version='antgg-2021'
   Updates on 2016 AntGG compilation.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.971238?format=html#download
   Anomalies are at the ice surface, or bedrock surface in areas of no ice. These
   surfaces are defined by Bedmap2 and are relative to the ellipsoid.

   version='eigen'
   Earth gravity grid (eigen-6c4) at 10 arc-min resolution at 10km geometric
   (ellipsoidal) height from :footcite:t:`forsteeigen6c42014`.
   originally from https://dataservices.gfz-potsdam.de/icgem/showshort.php?id=escidoc:1119897
   Accessed via the Fatiando data repository https://github.com/fatiando-data/earth-gravity-10arcmin

   :param version: choose which version of gravity data to fetch.
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param kwargs: additional kwargs to pass to resample_grid and set the anomaly_type.
   :type kwargs: typing.Any

   :keyword anomaly_type: either 'FA' or 'BA', for free-air and bouguer anomalies, respectively. For
                          antgg-update can also be 'DG' for gravity disturbance, or 'Err' for error
                          estimates.
   :kwtype anomaly_type: str

   :returns: Returns a loaded, and optional clip/resampled grid of either observed, free-air
             or Bouguer gravity anomalies.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: etopo(region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   Loads a grid of Antarctic topography from ETOPO1 from :footcite:t:`etopo12009`.
   Originally at 10 arc-min resolution, reference to mean sea-level (geoid).

   originally from https://www.ncei.noaa.gov/access/metadata/landing-page/bin/iso?id=gov.noaa.ngdc.mgg.dem:316
   Accessed via the Fatiando data repository https://github.com/fatiando-data/earth-topography-10arcmin

   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: optional

   :returns: Returns a loaded, and optional clip/resampled grid of topography.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: geoid(region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   Loads a grid of Antarctic geoid heights derived from the EIGEN-6C4 from
   :footcite:t:`forsteeigen6c42014` spherical harmonic model of Earth's gravity field.
   Originally at 10 arc-min resolution.
   Negative values indicate the geoid is below the ellipsoid surface and vice-versa.
   To convert a topographic grid which is referenced to the ellipsoid to be referenced
   to the geoid, add this grid.
   To convert a topographic grid which is referenced to the geoid to be referencde to
   the ellipsoid, add this grid.

   originally from https://dataservices.gfz-potsdam.de/icgem/showshort.php?id=escidoc:1119897
   Accessed via the Fatiando data repository https://github.com/fatiando-data/earth-geoid-10arcmin
   DOI: 10.5281/zenodo.5882205

   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param kwargs: additional kwargs to pass to resample_grid.
   :type kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of geoid height.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: magnetics(version, region = None, spacing = None, registration = None, hemisphere = None, **kwargs)

   Load magnetic anomaly data for the Arctic and Antarctic.
   from :footcite:t:`golynskynew2018` and :footcite:t:`golynskyadmap2006`.

   version='admap1'
   ADMAP-2001 magnetic anomaly compilation of Antarctica.
   Accessed from http://admap.kopri.re.kr/databases.html

   version='admap2'
   ADMAP2 magnetic anomaly compilation of Antarctica from
   :footcite:t:`golynskyadmap22018a`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.892723?format=html#download

   version='admap2_gdb'
   Geosoft-specific .gdb abridged files :footcite:t:`golynskyadmap22018`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.892722?format=html#download

   version='LCS-1'
   Satellite-only derived magnetic anomaly at Earth's surface (WGS84 ellipsoid) for
   spherical harmonic degrees n=14-185
   Accessed from https://www.spacecenter.dk/files/magnetic-models/LCS-1/

   :param version: Either 'admap1', 'admap2', 'admap2_gdb' or 'LCS-1'.
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default 10e3
   :type spacing: str or int, optional
   :param registration: choose between 'g' (gridline) or 'p' (pixel) registration types, by default is
                        the original type of the grid
   :type registration: str, optional,
   :param hemisphere: choose which hemisphere to retrieve data for, "north" or "south", by default
                      None
   :type hemisphere: str, optional
   :param kwargs: key word arguments to pass to resample_grid.
   :type kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of magnetic anomalies.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: ghf(version, region = None, spacing = None, registration = None, **kwargs)

   Load 1 of 6 'versions' of Antarctic geothermal heat flux data.

   version='an-2015'
   From :footcite:t:`antemperature2015`.
   Accessed from http://www.seismolab.org/model/antarctica/lithosphere/index.html

   version='martos-2017'
   From :footcite:t:`martosheat2017` and :footcite:t:`martosantarctic2017`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.882503

   version='shen-2020':
   From :footcite:t:`shengeothermal2020`.
   Accessed from https://sites.google.com/view/weisen/research-products?authuser=0
   Used https://paperform.co/templates/apps/direct-download-link-google-drive/ to
   generate a direct download link from google drive page.
   https://drive.google.com/uc?export=download&id=1Fz7dAHTzPnlytuyRNctk6tAugCAjiqzR

   version='burton-johnson-2020'
   From :footcite:t:`burton-johnsongeothermal2020`.
   Accessed from supplementary material
   Choose for either of grid, or the point measurements

   version='losing-ebbing-2021'
   From :footcite:t:`losingpredicting2021` and :footcite:t:`losingpredicted2021`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.930237

   version='aq1'
   From :footcite:t:`stalantarctic2021` and :footcite:t:`stalantarctic2020a`.
   Accessed from https://doi.pangaea.de/10.1594/PANGAEA.924857

   :param version: Either 'burton-johnson-2020', 'losing-ebbing-2021', 'aq1',
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default spacing is read from
                   downloaded files
   :type spacing: int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param kwargs: if version='burton-johnson-2020', then kwargs are passed to return point
                  measurements instead of the grid.
   :type kwargs: typing.Any
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of GHF data.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: gia(version, region = None, spacing = None, registration = None, **kwargs)

   Load 1 of 1 'versions' of Antarctic glacial isostatic adjustment grids.

   version='stal-2020'
   From :footcite:t:`stalantarctic2020` and :footcite:t:`stalantarctic2020b`.

   :param version: For now the only option is 'stal-2020',
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default spacing is read from
                   downloaded files
   :type spacing: int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of GIA data.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: crustal_thickness(version, region = None, spacing = None, registration = None, **kwargs)

   Load 1 of x 'versions' of Antarctic crustal thickness grids.

   version='shen-2018'
   Crustal thickness (excluding ice layer) from :footcite:t:`shencrust2018`.
   Accessed from https://sites.google.com/view/weisen/research-products?authuser=0

   version='an-2015'
   Crustal thickness (distance from solid (ice and rock) top to Moho discontinuity)
   from :footcite:t:`ansvelocity2015`.
   Accessed from http://www.seismolab.org/model/antarctica/lithosphere/index.html#an1s
   File is the AN1-CRUST model, paper states "Moho depths and crustal thicknesses
   referred to below are the distance from the solid surface to the Moho. We note that
   this definition of Moho depth is different from that in the compilation of AN-MOHO".
   Unclear, but seems moho depth is just negative of crustal thickness. Not sure if its
   to the ice surface or ice base.

   :param version: Either 'shen-2018',
                   will add later: 'lamb-2020',  'an-2015', 'baranov', 'chaput', 'crust1',
                   'szwillus', 'llubes', 'pappa', 'stal'
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default spacing is read from
                   downloaded files
   :type spacing: int, optional
   :param registration: change registration with either 'p' for pixel or 'g' for gridline registration,
                        by default is None.
   :type registration: str, optional
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of crustal thickness.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


.. py:function:: moho(version, region = None, spacing = None, registration = None, **kwargs)

   Load 1 of x 'versions' of Antarctic Moho depth grids.

   version='shen-2018'
   Depth to the Moho relative to the surface of solid earth (bottom of ice/ocean)
   from :footcite:t:`shencrust2018`.
   Accessed from https://sites.google.com/view/weisen/research-products?authuser=0
   Appears to be almost identical to crustal thickness from Shen et al. 2018

   version='an-2015'
   This is fetch.crustal_thickness(version='an-2015)* -1
   Documentation is unclear whether the An crust model from
   :footcite:t:`ansvelocity2015` is crustal thickness or moho depths, or whether it
   makes a big enough difference to matter.

   version='pappa-2019'
   from :footcite:t:`pappamoho2019`.
   Accessed from supplement material

   :param version: Either 'shen-2018', 'an-2015', 'pappa-2019',
                   will add later: 'lamb-2020', 'baranov', 'chaput', 'crust1',
                   'szwillus', 'llubes',
   :type version: str
   :param region: region to clip the loaded grid to, in format [xmin, xmax, ymin, ymax], by
                  default doesn't clip
   :type region: tuple[float, float, float, float], optional
   :param spacing: grid spacing to resample the loaded grid to, by default spacing is read from
                   downloaded files
   :type spacing: int, optional
   :param registration: choose between 'g' (gridline) or 'p' (pixel) registration types, by default is
                        the original type of the grid
   :type registration: str, optional,
   :param \*\*kwargs: additional keyword arguments to pass to the resample_grid function
   :type \*\*kwargs: typing.Any

   :returns: Returns a loaded, and optional clip/resampled grid of crustal thickness.
   :rtype: xarray.DataArray

   .. rubric:: References

   .. footbibliography::


