{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using Full Output for Diagnostics \n", "\n", "Sometimes it helps to have a bigger picture of what the full output is doing. \n", "\n", "These steps will guide you through how to get out gain more intuition from your runs. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#picaso\n", "from picaso import justdoit as jdi \n", "from picaso import justplotit as jpi\n", "jpi.output_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will use a cloudy Jupiter again to guide us through the exercise." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "opa = jdi.opannection(wave_range=[0.3,1]) \n", "\n", "case1 = jdi.inputs()\n", "\n", "case1.phase_angle(0)\n", "\n", "case1.gravity(gravity=25, gravity_unit=jdi.u.Unit('m/(s**2)'))\n", "\n", "case1.star(opa, 6000,0.0122,4.437)\n", "\n", "case1.atmosphere(filename = jdi.jupiter_pt(), delim_whitespace=True)\n", "case1.clouds(filename = jdi.jupiter_cld(), delim_whitespace=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Return ``PICASO`` Full Ouput" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "df = case1.spectrum(opa, full_output=True) #note the new last key \n", "wno, alb, full_output = df['wavenumber'] , df['albedo'] , df['full_output'] " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Visualizing Full Output \n", "\n", "### Mixing Ratios" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.show(jpi.mixing_ratio(full_output))\n", "#can also input any key word argument acceptable for bokeh.figure: \n", "#show(jpi.mixing_ratio(full_output, plot_width=500, y_axis_type='linear',y_range=[10,1e-3])) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Cloud Profile\n", "\n", "Depending on your wavelength grid, you might exceed ``Jupyter Notebook's`` data rage limit. You can fix this by initiating jupyter notebook with a higher data rate limit. \n", "\n", "``jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000``" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.show(jpi.cloud(full_output))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Pressure-Tempertaure Profile" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.show(jpi.pt(full_output))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Heatmap of Molecular, Cloud, and Rayleigh Scattering Opacity \n", "\n", "This will show you where your molecular, cloud and rayleigh scattering opacity become optically thick ($\\tau$~1). Blue regions of the plot are optically thin, while red are optically thick. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.heatmap_taus(df)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sometimes, we just want to compare the $\\tau\\sim 1$ surface for each component. This is effectively the plot below, the \"photon attenuation\". " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Photon Attenuation Depth\n", "\n", "This is a useful plot to see the interplay between scattering and absorbing sources. It should explain why you are getting bright versus dark reflectivity. \n", "\n", "To make this plot, we take data that is in previous plots (taugas, taucld, tauray), integrate it starting at the top of the atmosphere, then determine where a certain opacity hits the `at_tau` value. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.show(jpi.photon_attenuation(full_output, at_tau=0.1, plot_width=500))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Compare it to the spectrum and you can see right away what is driving the overall shape of your spectrum" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "jpi.show(jpi.spectrum(wno,alb,plot_width=500))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Disecting Full Output " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "full_output.keys()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "full_output['layer'].keys()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "taugas = full_output['taugas'] #matrix that is nlevel x nwvno\n", "taucld = full_output['taucld'] #matrix that is nlevel x nwvno\n", "taugas = full_output['taugas'] #matrix that is nlevel x nwvno" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.8.12" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": true, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 2 }