-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add example notebook to documentation
- Loading branch information
Showing
2 changed files
with
148 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/SatCloP/pyrtlib/blob/main/docs/source/notebook/first_run.ipynb)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# My first test with PyRTlib" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Installing PyRTlib via pip" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"!pip install pyrtlib" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Import necessary packages" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# This requires jupyter-matplotlib a.k.a. ipympl.\n", | ||
"# ipympl can be install via pip or conda.\n", | ||
"%matplotlib inline\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"plt.rcParams.update({'font.size': 15})\n", | ||
"import matplotlib.ticker as ticker\n", | ||
"from matplotlib.ticker import ScalarFormatter\n", | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"np.seterr('raise')" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pyrtlib import __version__\n", | ||
"from pyrtlib.absorption_model import H2OAbsModel, O2AbsModel\n", | ||
"from pyrtlib.climatology import AtmosphericProfiles as atmp\n", | ||
"from pyrtlib.tb_spectrum import TbCloudRTE\n", | ||
"from pyrtlib.utils import ppmv2gkg, mr2rh, get_frequencies_sat\n", | ||
"import time" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"z, p, _, t, md = atmp.gl_atm(atmp.TROPICAL)\n", | ||
"\n", | ||
"gkg = ppmv2gkg(md[:, atmp.H2O], atmp.H2O)\n", | ||
"rh = mr2rh(p, t, gkg)[0] / 100\n", | ||
"\n", | ||
"frq = np.arange(20, 1001, 1)\n", | ||
"\n", | ||
"rte = TbCloudRTE(z, p, t, rh, frq)\n", | ||
"rte.init_absmdl('R22SD')\n", | ||
"O2AbsModel.model = 'R22'\n", | ||
"O2AbsModel.set_ll()\n", | ||
"df = rte.execute()\n", | ||
"df = df.set_index(frq)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df.plot(figsize=(25, 8), linewidth=3, xlabel=\"Frequency [GHz]\", ylabel=\"Brightness Temperature [K]\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.10" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |