1
1
"""
2
- Function to download the IGPP Earth free-air anomaly dataset from the GMT data server,
3
- and load as :class:`xarray.DataArray`.
2
+ Function to download the IGPP Earth free-air anomaly and uncertainty datasets from
3
+ the GMT data server, and load as :class:`xarray.DataArray`.
4
4
5
5
The grids are available in various resolutions.
6
6
"""
@@ -20,36 +20,43 @@ def load_earth_free_air_anomaly(
20
20
] = "01d" ,
21
21
region : Sequence [float ] | str | None = None ,
22
22
registration : Literal ["gridline" , "pixel" , None ] = None ,
23
+ uncertainty : bool = False ,
23
24
) -> xr .DataArray :
24
25
r"""
25
- Load the IGPP Earth free-air anomaly dataset in various resolutions.
26
+ Load the IGPP Earth free-air anomaly and uncertainty datasets in various
27
+ resolutions.
26
28
27
- .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faa.jpg
28
- :width: 80 %
29
- :align: center
29
+ .. list-table::
30
+ :widths: 50 50
31
+ :header-rows: 1
30
32
31
- IGPP Earth free-air anomaly dataset.
33
+ * - IGPP Earth free-Air anomaly
34
+ - IGPP Earth free-Air anomaly uncertainty
35
+ * - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faa.jpg
36
+ - .. figure:: https://www.generic-mapping-tools.org/remote-datasets/_images/GMT_earth_faaerror.jpg
32
37
33
- The grids are downloaded to a user data directory
34
- (usually ``~/.gmt/server/earth/earth_faa/``) the first time you invoke
35
- this function. Afterwards, it will load the grid from the data directory.
36
- So you'll need an internet connection the first time around.
38
+ The grids are downloaded to a user data directory (usually
39
+ ``~/.gmt/server/earth/earth_faa/`` or ``~/.gmt/server/earth/earth_faaerror/``) the
40
+ first time you invoke this function. Afterwards, it will load the grid from data
41
+ directory. So you'll need an internet connection the first time around.
37
42
38
43
These grids can also be accessed by passing in the file name
39
- **@earth_faa**\_\ *res*\[_\ *reg*] to any grid processing function or
40
- plotting method. *res* is the grid resolution (see below), and *reg* is
41
- the grid registration type (**p** for pixel registration or **g** for
42
- gridline registration).
43
-
44
- The default color palette table (CPT) for this dataset is *@earth_faa.cpt*.
45
- It's implicitly used when passing in the file name of the dataset to any
46
- grid plotting method if no CPT is explicitly specified. When the dataset
47
- is loaded and plotted as an :class:`xarray.DataArray` object, the default
48
- CPT is ignored, and GMT's default CPT (*turbo*) is used. To use the
49
- dataset-specific CPT, you need to explicitly set ``cmap="@earth_faa.cpt"``.
50
-
51
- Refer to :gmt-datasets:`earth-faa.html` for more details about available
52
- datasets, including version information and references.
44
+ **@earth_faa_type**\_\ *res*\[_\ *reg*] to any grid processing function or
45
+ plotting method. *earth_faa_type* is the GMT name for the dataset. The available
46
+ options are **earth_faa** and **earth_faaerror**. *res* is the grid resolution (see
47
+ below), and *reg* is the grid registration type (**p** for pixel registration or
48
+ **g** for gridline registration).
49
+
50
+ The default color palette tables (CPTs) for these datasets are *@earth_faa.cpt* and
51
+ *@earth_faaerror.cpt*. The dataset-specific CPT is implicitly used when passing in
52
+ the file name of the dataset to any grid plotting method if no CPT is explicitly
53
+ specified. When the dataset is loaded and plotted as an :class:`xarray.DataArray`
54
+ object, the default CPT is ignored, and GMT's default CPT (*turbo*) is used. To use
55
+ the dataset-specific CPT, you need to explicitly set ``cmap="@earth_faa.cpt"`` or
56
+ ``cmap="@earth_faaerror.cpt"``.
57
+
58
+ Refer to :gmt-datasets:`earth-faa.html` and :gmt-datasets:`earth-faaerror.html` for
59
+ more details about available datasets, including version information and references.
53
60
54
61
Parameters
55
62
----------
@@ -62,45 +69,47 @@ def load_earth_free_air_anomaly(
62
69
higher than 5 arc-minutes (i.e., ``"05m"``).
63
70
registration
64
71
Grid registration type. Either ``"pixel"`` for pixel registration or
65
- ``"gridline"`` for gridline registration. Default is ``None``, means
66
- ``"gridline"`` for all resolutions except ``"01m"`` which is
67
- ``"pixel"`` only.
72
+ ``"gridline"`` for gridline registration. Default is ``None`` which means
73
+ ``"gridline"`` for all resolutions except ``"01m"`` which is ``"pixel"`` only.
74
+ uncertainty
75
+ By default, the Earth free-air anomaly values are returned. Set to ``True`` to
76
+ return the related uncertainties instead.
68
77
69
78
Returns
70
79
-------
71
80
grid
72
- The Earth free-air anomaly grid. Coordinates are latitude and
73
- longitude in degrees. Units are in mGal.
81
+ The Earth free-air anomaly (uncertainty) grid. Coordinates are latitude and
82
+ longitude in degrees. Values and uncertainties are in mGal.
74
83
75
84
Note
76
85
----
77
86
The registration and coordinate system type of the returned
78
- :class:`xarray.DataArray` grid can be accessed via the GMT accessors
79
- (i.e., ``grid.gmt.registration`` and ``grid.gmt.gtype`` respectively).
80
- However, these properties may be lost after specific grid operations (such
81
- as slicing) and will need to be manually set before passing the grid to any
82
- PyGMT data processing or plotting functions. Refer to
83
- :class:`pygmt.GMTDataArrayAccessor` for detailed explanations and
84
- workarounds.
87
+ :class:`xarray.DataArray` grid can be accessed via the GMT accessors (i.e.,
88
+ ``grid.gmt.registration`` and ``grid.gmt.gtype`` respectively). However, these
89
+ properties may be lost after specific grid operations (such as slicing) and will
90
+ need to be manually set before passing the grid to any PyGMT data processing or
91
+ plotting functions. Refer to :class:`pygmt.GMTDataArrayAccessor` for detailed
92
+ explanations and workarounds.
85
93
86
94
Examples
87
95
--------
88
96
89
97
>>> from pygmt.datasets import load_earth_free_air_anomaly
90
98
>>> # load the default grid (gridline-registered 1 arc-degree grid)
91
99
>>> grid = load_earth_free_air_anomaly()
100
+ >>> # load the uncertainties related to the default grid
101
+ >>> grid = load_earth_free_air_anomaly(uncertainty=True)
92
102
>>> # load the 30 arc-minutes grid with "gridline" registration
93
103
>>> grid = load_earth_free_air_anomaly(resolution="30m", registration="gridline")
94
104
>>> # load high-resolution (5 arc-minutes) grid for a specific region
95
105
>>> grid = load_earth_free_air_anomaly(
96
- ... resolution="05m",
97
- ... region=[120, 160, 30, 60],
98
- ... registration="gridline",
106
+ ... resolution="05m", region=[120, 160, 30, 60], registration="gridline"
99
107
... )
100
108
"""
109
+ prefix = "earth_faaerror" if uncertainty is True else "earth_faa"
101
110
grid = _load_remote_dataset (
102
- name = "earth_faa" ,
103
- prefix = "earth_faa" ,
111
+ name = prefix ,
112
+ prefix = prefix ,
104
113
resolution = resolution ,
105
114
region = region ,
106
115
registration = registration ,
0 commit comments