.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "sample_data/rio_magnetic.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_sample_data_rio_magnetic.py: [DEPRECATED] Magnetic data from Rio de Janeiro ============================================== .. warning:: All sample datasets in Verde are deprecated and will be **removed in Verde v2.0.0**. The tutorials/examples will transition to using `Ensaio `__ instead. We provide sample total-field magnetic anomaly data from an airborne survey of Rio de Janeiro, Brazil, from the 1970s. The data are made available by the Geological Survey of Brazil (CPRM) through their `GEOSGB portal `__. See the documentation for :func:`verde.datasets.fetch_rio_magnetic` for more details. .. GENERATED FROM PYTHON SOURCE LINES 24-58 .. image-sg:: /sample_data/images/sphx_glr_rio_magnetic_001.png :alt: Total-field Magnetic Anomaly of Rio de Janeiro :srcset: /sample_data/images/sphx_glr_rio_magnetic_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out Out: .. code-block:: none /usr/share/miniconda3/envs/test/lib/python3.9/site-packages/verde/datasets/sample_data.py:209: FutureWarning: The Rio magnetic anomaly dataset is deprecated and will be removed in Verde v2.0.0. Use a different dataset instead. warnings.warn( longitude latitude ... line_type line_number 0 -42.590424 -22.499878 ... LINE 2902 1 -42.590485 -22.498978 ... LINE 2902 2 -42.590530 -22.498077 ... LINE 2902 3 -42.590591 -22.497177 ... LINE 2902 4 -42.590652 -22.496277 ... LINE 2902 [5 rows x 6 columns] /usr/share/miniconda3/envs/test/lib/python3.9/site-packages/verde/datasets/sample_data.py:242: FutureWarning: The Rio magnetic anomaly dataset is deprecated and will be removed in Verde v2.0.0. Use a different dataset instead. warnings.warn( | .. code-block:: default import cartopy.crs as ccrs import matplotlib.pyplot as plt import verde as vd # The data are in a pandas.DataFrame data = vd.datasets.fetch_rio_magnetic() print(data.head()) # Make a Mercator map of the data using Cartopy crs = ccrs.PlateCarree() plt.figure(figsize=(7, 5)) ax = plt.axes(projection=ccrs.Mercator()) ax.set_title("Total-field Magnetic Anomaly of Rio de Janeiro") # Since the data is diverging (going from negative to positive) we need to # center our colorbar on 0. To do this, we calculate the maximum absolute value # of the data to set vmin and vmax. maxabs = vd.maxabs(data.total_field_anomaly_nt) # Cartopy requires setting the projection of the original data through the # transform argument. Use PlateCarree for geographic data. plt.scatter( data.longitude, data.latitude, c=data.total_field_anomaly_nt, s=1, cmap="seismic", vmin=-maxabs, vmax=maxabs, transform=crs, ) plt.colorbar(pad=0.01).set_label("nT") # Set the proper ticks for a Cartopy map vd.datasets.setup_rio_magnetic_map(ax) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.796 seconds) .. _sphx_glr_download_sample_data_rio_magnetic.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: rio_magnetic.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: rio_magnetic.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_