diff --git a/g16_abi_20190117.ipynb b/g16_abi_20190117.ipynb deleted file mode 100644 index 4a0e86a50918ecdf85203ae50d57550a66e02505..0000000000000000000000000000000000000000 --- a/g16_abi_20190117.ipynb +++ /dev/null @@ -1,274 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "os.environ['HDF5_USE_FILE_LOCKING'] = \"FALSE\"\n", - "os.environ['PYTROLL_CHUNK_SIZE'] = \"2048\"\n", - "from glob import glob\n", - "from satpy import MultiScene\n", - "import dask\n", - "from multiprocessing.pool import ThreadPool\n", - "from dask.diagnostics import ProgressBar" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12\n" - ] - } - ], - "source": [ - "input_files = glob('/arcdata/goes/grb/goes16/2019/2019_01_17_017/abi/L1b/RadC/*C01*s201901712*.nc')\n", - "# input_files = glob('/arcdata/goes/grb/goes16/2019/2019_01_17_017/abi/L1b/RadC/*s2019017[12]*.nc')\n", - "#input_files = glob('/arcdata/goes/grb/goes16/2019/2019_01_18_018/abi/L1b/RadC/*s2019018[12]*.nc')\n", - "#input_files += glob('/arcdata/goes/grb/goes16/2019/2019_01_19_019/abi/L1b/RadC/*s20190190*.nc')\n", - "print(len(input_files))" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": {}, - "outputs": [], - "source": [ - "mscn = MultiScene.from_files(input_files, reader='abi_l1b')\n", - "mscn.load(['C01'])\n", - "# mscn.load(['true_color_night'])\n", - "# res_mscn = mscn.resample(resampler='native')" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/davidh/miniconda3/envs/pangeo/lib/python3.6/site-packages/distributed/bokeh/core.py:56: UserWarning: \n", - "Port 33121 is already in use. \n", - "Perhaps you already have a cluster running?\n", - "Hosting the diagnostics dashboard on a random port instead.\n", - " warnings.warn('\\n' + msg)\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "98fe775311a4451091c5efb79475d267", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "VBox(children=(HTML(value='<h2>SLURMCluster</h2>'), HBox(children=(HTML(value='\\n<div>\\n <style scoped>\\n …" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "import sys\n", - "from dask_jobqueue import SLURMCluster\n", - "cluster = SLURMCluster(partition='all',\n", - " walltime='02:00:00',\n", - " name='davidh_dask',\n", - " cores=4,\n", - " processes=2,\n", - " memory='20GB',\n", - " python=sys.executable, # '/home/davidh/miniconda3/envs/pangeo/bin/python',\n", - " local_directory='/scratch',\n", - " diagnostics_port=int(os.getenv('DASK_PORT', 8787)),\n", - " )\n", - "cluster.scale(5)\n", - "cluster" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "<table style=\"border: 2px solid white;\">\n", - "<tr>\n", - "<td style=\"vertical-align: top; border: 0px solid white\">\n", - "<h3>Client</h3>\n", - "<ul>\n", - " <li><b>Scheduler: </b>tcp://10.23.255.247:33990\n", - " <li><b>Dashboard: </b><a href='http://10.23.255.247:35285/status' target='_blank'>http://10.23.255.247:35285/status</a>\n", - "</ul>\n", - "</td>\n", - "<td style=\"vertical-align: top; border: 0px solid white\">\n", - "<h3>Cluster</h3>\n", - "<ul>\n", - " <li><b>Workers: </b>0</li>\n", - " <li><b>Cores: </b>0</li>\n", - " <li><b>Memory: </b>0 B</li>\n", - "</ul>\n", - "</td>\n", - "</tr>\n", - "</table>" - ], - "text/plain": [ - "<Client: scheduler='tcp://10.23.255.247:33990' processes=0 cores=0>" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from dask.distributed import Client\n", - "client = Client(cluster)\n", - "client" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "c01_avg = np.mean([scn['C01'] for scn in mscn], axis=0)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "c01_avg" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Scene 0\n", - "Scene 1\n", - "Scene 2\n", - "Scene 3\n", - "Scene 4\n", - "Scene 5\n", - "Scene 6\n", - "Scene 7\n", - "Scene 8\n", - "Scene 9\n", - "Scene 10\n", - "CPU times: user 39.1 s, sys: 6.36 s, total: 45.4 s\n", - "Wall time: 1min 7s\n" - ] - } - ], - "source": [ - "%%time\n", - "all_jobs = []\n", - "for idx, scn in enumerate(res_mscn):\n", - " print(\"Scene {:d}\".format(idx))\n", - " res = scn.save_datasets(writer='scmi', base_dir='/odyssey/isis/tmp/davidh', sector_id=\"GOES_EAST\", source_name=\"SSEC\", compute=False)\n", - " all_jobs.append(res)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "all_jobs = [x for y in all_jobs for x in y]\n", - "print(len(all_jobs))\n", - "all_jobs" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "dask.compute(all_jobs)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "%%time\n", - "mscn.save_animation('/odyssey/isis/tmp/davidh/g16_abi_{name}_{start_time:%Y%m%d_%H%M%S}/g16_abi_{name}_{start_time:%Y%m%d_%H%M%S}.mp4', fps=24, batch_size=16)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "!png2mp4.sh /odyssey/isis/tmp/davidh/g16_abi_true_color_night.mp4 /odyssey/isis/tmp/davidh/g16_abi_true_color_night_2*/*.png" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "del client\n", - "del cluster" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "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.6.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}