{ "cells": [ { "cell_type": "markdown", "id": "331e5089", "metadata": {}, "source": [ "## pmcpy quickstart" ] }, { "cell_type": "code", "execution_count": 1, "id": "194d2b4d", "metadata": {}, "outputs": [], "source": [ "# import necessary package\n", "import pmcpy\n", "import xarray as xr\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "markdown", "id": "7a7c76e8", "metadata": {}, "source": [ "### load the raw output file from PartMC" ] }, { "cell_type": "code", "execution_count": 2, "id": "ad5a1212", "metadata": {}, "outputs": [], "source": [ "# define the path to data\n", "p = \"../data/urban_plume_0001_00000002.nc\"\n", "pmc = pmcpy.load_pmc(p)" ] }, { "cell_type": "markdown", "id": "af91c7e5", "metadata": {}, "source": [ "### number concentration" ] }, { "cell_type": "code", "execution_count": 3, "id": "cc663120", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "overall number conc.: 8854807162.459946 # m^{-3}\n", "diameter<=2.5um: 8854806282.274422 # m^{-3}\n", "diameter>=2.5um: 880.1855249722205 # m^{-3}\n" ] } ], "source": [ "print(\"overall number conc.:\", pmc.get_num_conc(), \"# m^{-3}\")\n", "print(\"diameter<=2.5um:\", pmc.get_num_conc(pmc.get_aero_particle_diameter()<=2.5e-6), \"# m^{-3}\")\n", "print(\"diameter>=2.5um:\", pmc.get_num_conc(pmc.get_aero_particle_diameter()>=2.5e-6), \"# m^{-3}\")" ] }, { "cell_type": "markdown", "id": "e7df9ace", "metadata": {}, "source": [ "### aerosol mass concentration of selected species" ] }, { "cell_type": "code", "execution_count": 4, "id": "5cac3855", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "BC and OC mass conc,: [6.53030409e-10 5.73984931e-09] kg m^{-3}\n", "overall mass conc.: 2.2186891469474523e-08 kg m^{-3}\n", "overall dry mass conc.: 1.316284475347949e-08 kg m^{-3}\n", "PM2.5 mass conc. (with water): 2.2164289553077785e-08 kg m^{-3}\n" ] } ], "source": [ "# consider BC and OC only\n", "aero_species_ls = [\"BC\",\"OC\"]\n", "print(\"BC and OC mass conc,:\",\n", " pmc.get_aero_mass_conc(aero_species_ls),\n", " \"kg m^{-3}\")\n", "\n", "# consider all species and dry species\n", "all_aero_species = pmc.aero_species.copy()\n", "dry_aero_species = all_aero_species.copy()\n", "dry_aero_species.remove(\"H2O\")\n", "\n", "print(\"overall mass conc.:\",\n", " pmc.get_aero_mass_conc(all_aero_species).sum(), \n", " \"kg m^{-3}\")\n", "print(\"overall dry mass conc.:\", \n", " pmc.get_aero_mass_conc(dry_aero_species).sum(),\n", " \"kg m^{-3}\")\n", "print(\"PM2.5 mass conc. (with water):\",\n", " pmc.get_aero_mass_conc(all_aero_species,\n", " part_cond=(pmc.get_aero_particle_diameter()<=2.5e-6)).sum(), \n", " \"kg m^{-3}\")" ] }, { "cell_type": "markdown", "id": "bd53af6b", "metadata": {}, "source": [ "### overall mass concentration" ] }, { "cell_type": "code", "execution_count": 5, "id": "ef4398c8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "overall mass conc.: 2.2186891469474523e-08 kg m^{-3}\n", "overall dry mass conc.: 1.316284475347949e-08 kg m^{-3}\n", "PM2.5 mass conc. (with water): 2.2164289553077805e-08 kg m^{-3}\n" ] } ], "source": [ "print(\"overall mass conc.:\", \n", " pmc.get_mass_conc(dry=False), \"kg m^{-3}\")\n", "print(\"overall dry mass conc.:\", \n", " pmc.get_mass_conc(dry=True), \"kg m^{-3}\")\n", "print(\"PM2.5 mass conc. (with water):\",\n", " pmc.get_mass_conc(dry=False, part_cond=pmc.get_aero_particle_diameter()<=2.5e-6), \"kg m^{-3}\")" ] }, { "cell_type": "markdown", "id": "6c8a0d4f", "metadata": {}, "source": [ "### aerosol density" ] }, { "cell_type": "code", "execution_count": 6, "id": "2ba67685", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "overall density.: 1179.020687087021 kg m^{-3}\n", "overall dry density: 2265.3505453667535 kg m^{-3}\n", "PM2.5 density (with water): 1178.3768174927013 kg m^{-3}\n" ] } ], "source": [ "print(\"overall density.:\", \n", " pmc.get_aero_density(dry=False), \"kg m^{-3}\")\n", "print(\"overall dry density:\", \n", " pmc.get_aero_density(dry=True), \"kg m^{-3}\")\n", "print(\"PM2.5 density (with water):\",\n", " pmc.get_aero_density(dry=False, part_cond=pmc.get_aero_particle_diameter()<=2.5e-6), \"kg m^{-3}\")" ] }, { "cell_type": "markdown", "id": "e9b94920", "metadata": {}, "source": [ "### gas mixing ratio" ] }, { "cell_type": "code", "execution_count": 7, "id": "dbd0be18", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.DataArray 'gas_mixing_ratio' (gas_species: 2)>\n",
"array([354.311384, 43.069374])\n",
"Coordinates:\n",
" * gas_species (gas_species) int32 17 11\n",
"Attributes:\n",
" unit: ppb\n",
" long_name: mixing ratios of gas species