Skip to content

Commit

Permalink
update plot_scatter_map.py to remove hard code
Browse files Browse the repository at this point in the history
  • Loading branch information
ruiying-ocean committed Sep 19, 2024
1 parent 1ed031f commit 6462fbb
Show file tree
Hide file tree
Showing 11 changed files with 49 additions and 29 deletions.
Binary file modified docs/source/auto_examples/auto_examples_jupyter.zip
Binary file not shown.
Binary file modified docs/source/auto_examples/auto_examples_python.zip
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions docs/source/auto_examples/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,52 +83,52 @@ Below is a gallery of examples

.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to plot the 2D ScatterData object. I use a LGM d13C data from Peterson et al. 2014 (https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2013PA002552) as an example.">
<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to read in and plot cGENIE time series data.">

.. only:: html

.. image:: /auto_examples/images/thumb/sphx_glr_plot_scatter_map_thumb.png
.. image:: /auto_examples/images/thumb/sphx_glr_plot_timeseries_thumb.png
:alt:

:ref:`sphx_glr_auto_examples_plot_scatter_map.py`
:ref:`sphx_glr_auto_examples_plot_timeseries.py`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Plot the 2D ScatterData</div>
<div class="sphx-glr-thumbnail-title">Extract and Plot cGENIE Time Series data</div>
</div>


.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to read in and plot cGENIE time series data.">
<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to customise the 2D map including the projection, the color map, which is used as the logo of this package.">

.. only:: html

.. image:: /auto_examples/images/thumb/sphx_glr_plot_timeseries_thumb.png
.. image:: /auto_examples/images/thumb/sphx_glr_plot_logo_thumb.png
:alt:

:ref:`sphx_glr_auto_examples_plot_timeseries.py`
:ref:`sphx_glr_auto_examples_plot_logo.py`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Extract and Plot cGENIE Time Series data</div>
<div class="sphx-glr-thumbnail-title">Customise the 2D map projection</div>
</div>


.. raw:: html

<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to customise the 2D map including the projection, the color map, which is used as the logo of this package.">
<div class="sphx-glr-thumbcontainer" tooltip="This example shows how to plot the 2D ScatterData object. I use a LGM d13C data from Peterson et al. 2014 (https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2013PA002552) as an example.">

.. only:: html

.. image:: /auto_examples/images/thumb/sphx_glr_plot_logo_thumb.png
.. image:: /auto_examples/images/thumb/sphx_glr_plot_scatter_map_thumb.png
:alt:

:ref:`sphx_glr_auto_examples_plot_logo.py`
:ref:`sphx_glr_auto_examples_plot_scatter_map.py`

.. raw:: html

<div class="sphx-glr-thumbnail-title">Customise the 2D map projection</div>
<div class="sphx-glr-thumbnail-title">Plot the 2D ScatterData</div>
</div>


Expand Down Expand Up @@ -282,9 +282,9 @@ Below is a gallery of examples
/auto_examples/plot_pac_sst
/auto_examples/plot_coastal_data
/auto_examples/plot_sst_map
/auto_examples/plot_scatter_map
/auto_examples/plot_timeseries
/auto_examples/plot_logo
/auto_examples/plot_scatter_map
/auto_examples/plot_scatterdata
/auto_examples/plot_PO4_distribution
/auto_examples/plot_multiple_vars
Expand Down
4 changes: 2 additions & 2 deletions docs/source/auto_examples/plot_scatter_map.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"outputs": [],
"source": [
"from cgeniepy.table import ScatterData\nfrom cgeniepy.plot import CommunityPalette\nimport matplotlib.pyplot as plt\n\nproxy_d13C = ScatterData(\"~/Science/lgm_bcp/data/LGM_d13c_CLEAN.txt\", delimiter=\"\\t\", header=None)\nproxy_d13C.data.columns = [\"Longitude\", \"Latitude\", \"Depth\", \"d13C\",\"Event\"]\nproxy_d13C.set_index([\"Latitude\", \"Longitude\"])\ncmap = CommunityPalette(\"BuDaRd18\").colormap\nproxy_d13C.plot(var='d13C', edgecolor='k', cmap=cmap)\n\nplt.show()"
"from cgeniepy.table import ScatterData\nfrom cgeniepy.plot import CommunityPalette\nimport matplotlib.pyplot as plt\nimport subprocess\n\n## Download necessary files, you need to install zenodo_get first\n## by `pip install zenodo_get`, or, just download it from the link above\nsubprocess.call([\"zenodo_get\", \"10.5281/zenodo.13786013\", \"-o\", \"~/Downloads/\"])\n\nproxy_d13C = ScatterData(\"~/Downloads/LGM_d13c_CLEAN.txt\", delimiter=\"\\t\", header=None)\nproxy_d13C.data.columns = [\"Longitude\", \"Latitude\", \"Depth\", \"d13C\",\"Event\"]\nproxy_d13C.set_index([\"Latitude\", \"Longitude\"])\ncmap = CommunityPalette(\"BuDaRd18\").colormap\nproxy_d13C.plot(var='d13C', edgecolor='k', cmap=cmap)\n\nplt.show()"
]
}
],
Expand All @@ -35,7 +35,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.5"
}
},
"nbformat": 4,
Expand Down
7 changes: 6 additions & 1 deletion docs/source/auto_examples/plot_scatter_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
from cgeniepy.table import ScatterData
from cgeniepy.plot import CommunityPalette
import matplotlib.pyplot as plt
import subprocess

proxy_d13C = ScatterData("~/Science/lgm_bcp/data/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
## Download necessary files, you need to install zenodo_get first
## by `pip install zenodo_get`, or, just download it from the link above
subprocess.call(["zenodo_get", "10.5281/zenodo.13786013", "-o", "~/Downloads/"])

proxy_d13C = ScatterData("~/Downloads/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
proxy_d13C.data.columns = ["Longitude", "Latitude", "Depth", "d13C","Event"]
proxy_d13C.set_index(["Latitude", "Longitude"])
cmap = CommunityPalette("BuDaRd18").colormap
Expand Down
2 changes: 1 addition & 1 deletion docs/source/auto_examples/plot_scatter_map.py.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4830feeeeddeab8562142d678ab56395
7e76dc0c9181af3cf74820f08833ae37
20 changes: 15 additions & 5 deletions docs/source/auto_examples/plot_scatter_map.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:class: sphx-glr-download-link-note

:ref:`Go to the end <sphx_glr_download_auto_examples_plot_scatter_map.py>`
to download the full example code
to download the full example code.

.. rst-class:: sphx-glr-example-title

Expand All @@ -24,7 +24,7 @@ Plot the 2D ScatterData

This example shows how to plot the 2D ScatterData object. I use a LGM d13C data from Peterson et al. 2014 (https://agupubs.onlinelibrary.wiley.com/doi/full/10.1002/2013PA002552) as an example.

.. GENERATED FROM PYTHON SOURCE LINES 8-20
.. GENERATED FROM PYTHON SOURCE LINES 8-25
Expand All @@ -38,7 +38,8 @@ This example shows how to plot the 2D ScatterData object. I use a LGM d13C data

.. code-block:: none
<frozen importlib._bootstrap>:241: RuntimeWarning: scipy._lib.messagestream.MessageStream size changed, may indicate binary incompatibility. Expected 56 from C header, got 64 from PyObject
/Users/yingrui/cgeniepy/src/cgeniepy/plot.py:543: UserWarning: kind is not used for map plotting
warnings.warn("kind is not used for map plotting")
Expand All @@ -53,8 +54,13 @@ This example shows how to plot the 2D ScatterData object. I use a LGM d13C data
from cgeniepy.table import ScatterData
from cgeniepy.plot import CommunityPalette
import matplotlib.pyplot as plt
import subprocess
proxy_d13C = ScatterData("~/Science/lgm_bcp/data/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
## Download necessary files, you need to install zenodo_get first
## by `pip install zenodo_get`, or, just download it from the link above
subprocess.call(["zenodo_get", "10.5281/zenodo.13786013", "-o", "~/Downloads/"])
proxy_d13C = ScatterData("~/Downloads/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
proxy_d13C.data.columns = ["Longitude", "Latitude", "Depth", "d13C","Event"]
proxy_d13C.set_index(["Latitude", "Longitude"])
cmap = CommunityPalette("BuDaRd18").colormap
Expand All @@ -65,7 +71,7 @@ This example shows how to plot the 2D ScatterData object. I use a LGM d13C data
.. rst-class:: sphx-glr-timing

**Total running time of the script:** (0 minutes 1.369 seconds)
**Total running time of the script:** (0 minutes 4.752 seconds)


.. _sphx_glr_download_auto_examples_plot_scatter_map.py:
Expand All @@ -82,6 +88,10 @@ This example shows how to plot the 2D ScatterData object. I use a LGM d13C data

:download:`Download Python source code: plot_scatter_map.py <plot_scatter_map.py>`

.. container:: sphx-glr-download sphx-glr-download-zip

:download:`Download zipped: plot_scatter_map.zip <plot_scatter_map.zip>`


.. only:: html

Expand Down
12 changes: 6 additions & 6 deletions docs/source/auto_examples/sg_execution_times.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Computation times
=================
**00:31.225** total execution time for 15 files **from auto_examples**:
**00:04.752** total execution time for 15 files **from auto_examples**:

.. container::

Expand All @@ -32,8 +32,8 @@ Computation times
* - Example
- Time
- Mem (MB)
* - :ref:`sphx_glr_auto_examples_plot_d13C_comp.py` (``plot_d13C_comp.py``)
- 00:31.225
* - :ref:`sphx_glr_auto_examples_plot_scatter_map.py` (``plot_scatter_map.py``)
- 00:04.752
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_PO4_distribution.py` (``plot_PO4_distribution.py``)
- 00:00.000
Expand All @@ -47,6 +47,9 @@ Computation times
* - :ref:`sphx_glr_auto_examples_plot_coastal_data.py` (``plot_coastal_data.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_d13C_comp.py` (``plot_d13C_comp.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_logo.py` (``plot_logo.py``)
- 00:00.000
- 0.0
Expand All @@ -62,9 +65,6 @@ Computation times
* - :ref:`sphx_glr_auto_examples_plot_regridded_data.py` (``plot_regridded_data.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_scatter_map.py` (``plot_scatter_map.py``)
- 00:00.000
- 0.0
* - :ref:`sphx_glr_auto_examples_plot_scatterdata.py` (``plot_scatterdata.py``)
- 00:00.000
- 0.0
Expand Down
7 changes: 6 additions & 1 deletion examples/plot_scatter_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@
from cgeniepy.table import ScatterData
from cgeniepy.plot import CommunityPalette
import matplotlib.pyplot as plt
import subprocess

proxy_d13C = ScatterData("~/Science/lgm_bcp/data/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
## Download necessary files, you need to install zenodo_get first
## by `pip install zenodo_get`, or, just download it from the link above
subprocess.call(["zenodo_get", "10.5281/zenodo.13786013", "-o", "~/Downloads/"])

proxy_d13C = ScatterData("~/Downloads/LGM_d13c_CLEAN.txt", delimiter="\t", header=None)
proxy_d13C.data.columns = ["Longitude", "Latitude", "Depth", "d13C","Event"]
proxy_d13C.set_index(["Latitude", "Longitude"])
cmap = CommunityPalette("BuDaRd18").colormap
Expand Down

0 comments on commit 6462fbb

Please sign in to comment.