{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "

Read VIIRS SDR data, resample, and make a true color RGB image

\n", "\n", "Created with:\n", "\n", "Package | Version\n", "--- | ---\n", "SatPy | 0.9.0\n", "PyResample | 1.10.1\n", "Trollimage | 1.5.3\n", "PyKdtree | 1.3.1\n" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from satpy.scene import Scene\n", "from glob import glob" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/a000680/.local/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", " from ._conv import register_converters as _register_converters\n" ] } ], "source": [ "scn = Scene(\n", " filenames=glob(\"/home/a000680/data/polar_in/direct_readout/npp/lvl1/npp_20150420_1202_18019/*\"),\n", " reader='viirs_sdr')" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "from satpy.resample import get_area_def" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "areaid = 'eurol'" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "areadef = get_area_def(areaid)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "composite = 'true_color_lowres'" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "scn.load([composite])" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "newscn = scn.resample(areadef)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "newscn.show(composite)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "prfx = newscn.start_time.strftime('%Y%m%d%H%M')" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/a000680/.local/lib/python2.7/site-packages/dask/local.py:271: RuntimeWarning: invalid value encountered in less\n", " return func(*args2)\n", "/home/a000680/.local/lib/python2.7/site-packages/dask/local.py:271: RuntimeWarning: invalid value encountered in log10\n", " return func(*args2)\n" ] } ], "source": [ "newscn.save_dataset(\n", " composite, './true_color_rayleigh_only_{0}_{1}.png'.format(prfx, areaid))" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.5" } }, "nbformat": 4, "nbformat_minor": 2 }