{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import glob\n", "import virga.justdoit as jdi\n", "import virga.justplotit as jpi\n", "import virga.ior_factory as ior\n", "jpi.output_notebook()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## How to see what optical properties are being used" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ior_configs = ior.configure_ior_choices()\n", "ior_configs['Na2S']" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This allows you to read the raw data file (before it was pre-processed into Virga format like this)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "na2s = pd.read_csv(ior_configs['Na2S']['url'], **ior_configs['Na2S']['pandas_kwargs'])\n", "na2s.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "You may see a molecule that does not have a URL that is attached to a data file. In those cases it was likely taken from HITRAN 2020. In those cases you can access it by first downloading and untarring HITRAN 2020 Aersol data at the specified URL:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "ior_configs['ZnS']['url'] #file to download" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#point to untarred file\n", "hitran_directory = '/data/virga/hitran_ri/'\n", "zns = pd.read_csv(os.path.join(hitran_directory,ior_configs['ZnS']['hitran2020'])\n", " , **ior_configs['ZnS']['pandas_kwargs'])\n", "zns.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Creating aggregated Index of Refraction (IOR) Files" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Thought you can download the optical properties from zenodo, sometimes users may wish to create their own on specified grids. Before you do so you will need to download HITRAN 2020, which is quite small (177 Mb untarred). \n", "\n", "Required DOWNLOAD: https://hitran.org/data/Aerosols/Aerosols-2020/\n", "\n", "Optional Download: https://github.com/exoclime/LX-MIE " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hitran_directory = '/data/virga/hitran_ri/'\n", "#virga_dir = '/Users/nbatalh1/Documents/data/virga/' #only if you want to compare to old data\n", "#lxmie_dir = '/Users/nbatalh1/Documents/codes/LX-MIE/compilation/' #optional: only if you want to compare to all lxmie data\n", "output_dir = '/data/virga_new'#optional to save all new data\n", "\n", "fig = ior.create_ior_db(hitran_directory, \n", " output_dir = output_dir)#, \n", " #lxmie_dir=lxmie_dir)\n", "jpi.show(fig)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Now follow through with new Mie parameters" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "#below 'output_dir' specifies where the new IOR files are, and where you want the new MIE files to go\n", "#in this case I am using the same place\n", "newmie = jdi.calc_mie_db('H2O', output_dir, output_dir, rmin = 1e-8, nradii = 60)" ] } ], "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.11.5" }, "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 } }, "nbformat": 4, "nbformat_minor": 4 }