Skip to content

Commit

Permalink
Doc and code tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
rgieseke committed Feb 27, 2024
1 parent 6119f16 commit 82dee78
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
12 changes: 5 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,14 @@ Advanced example
.. code:: python
import pyhector
from pyhector import rcp26, rcp45, rcp60, rcp85
import matplotlib.pyplot as plt
from pyhector import ssp119, ssp126, ssp245, ssp370, ssp434, ssp460, ssp534_over, ssp585
for rcp in [rcp26, rcp45, rcp60, rcp85]:
output = pyhector.run(rcp, {"core": {"endDate": 2100}})
temp = output["temperature.Tgav"]
# Adjust to 1850 - 1900 reference period
for ssp in [ssp119, ssp126, ssp245, ssp370, ssp434, ssp460, ssp534_over, ssp585]:
output = pyhector.run(ssp, {"core": {"endDate": 2100}})
temp = output["temperature.global_tas"]
temp = temp.loc[1850:] - temp.loc[1850:1900].mean()
temp.plot(label=rcp.name.split("_")[0])
temp.plot(label=ssp.name)
plt.title("Global mean temperature")
plt.ylabel("°C over pre-industrial (1850-1900 mean)")
plt.legend(loc="best")
Expand Down
2 changes: 1 addition & 1 deletion docs/pyhector.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pyhector.default_config
-----------------------

A dictionary with Hector's default configuration parameters.
See also `the original config file on GitHub <https://github.com/openclimatedata/pyhector/blob/main/pyhector/rcp_default.ini>`_.
See also `the original config file on GitHub <https://github.com/JGCRI/hector/blob/main/inst/input/hector_ssp119.ini>`_.
In **pyhector** this INI-file is represented as a dictionary.


Expand Down
2 changes: 1 addition & 1 deletion docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:end-before: image-start

.. image:: example-plot.png
:alt: Temperature Plot of RCP scenarios
:alt: Temperature Plot of SSP scenarios

.. include:: ../README.rst
:start-after: image-end
Expand Down
6 changes: 3 additions & 3 deletions scripts/plot_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

path = os.path.join(os.path.dirname(__file__), "../docs/example-plot.png")

for rcp in [ssp119, ssp126, ssp245, ssp370, ssp434, ssp460, ssp534_over, ssp585]:
output = pyhector.run(rcp, {"core": {"endDate": 2100}})
for ssp in [ssp119, ssp126, ssp245, ssp370, ssp434, ssp460, ssp534_over, ssp585]:
output = pyhector.run(ssp, {"core": {"endDate": 2100}})
temp = output["temperature.global_tas"]
temp = temp.loc[1850:] - temp.loc[1850:1900].mean()
temp.plot(label=rcp.name.split("_")[0])
temp.plot(label=ssp.name)
plt.title("Global mean temperature")
plt.ylabel("°C over pre-industrial (1850-1900 mean)")
plt.legend(loc="best")
Expand Down

0 comments on commit 82dee78

Please sign in to comment.