{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# AVHRR GAC Reader Introduction" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Satpy uses __[pygac](https://pygac.readthedocs.io)__ to read and calibrate AVHRR GAC (Global Area Coverage) and LAC (Local Area Coverage) data.\n", "\n", "Further Reading: https://www.avl.class.noaa.gov/release/data_available/avhrr/index.htm" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Supported Files\n", "\n", "AVHRR data in NOAA GAC format. Example filename: `NSS.GHRR.NP.D15361.S0121.E0315.B3547172.SV`" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Quickstart with AVHRR GAC data from NOAA-14" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datetime import datetime\n", "from satpy.scene import Scene\n", "\n", "scn = Scene(sensor=\"avhrr-2\",\n", " start_time=datetime(1995, 2, 24, 9, 40),\n", " end_time=datetime(1995, 2, 24, 9, 42),\n", " base_dir='/home/a001673/usr/src/cci_geolocation/data',\n", " reader=\"avhrr_l1b_gaclac\",\n", " reader_kwargs={'tle_dir': '/path/to/tle/',\n", " 'tle_name': 'TLE_%(satname)s.txt'})" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "composite = 'overview'\n", "scn.load([composite])\n", "scn.show(composite)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that you have to specify location and format of the so called Two-Line-Elements (TLE) via `reader_kwargs`. Some NOAA-16 TLEs are available in [pygac's github repository](https://github.com/pytroll/pygac/tree/main/gapfilled_tles). Historical TLEs can be obtained from https://www.celestrak.com/ and have the following format:\n", "\n", "```\n", "1 23455U 94089A 01122.93455091 .00000622 00000-0 36103-3 0 7210\n", "2 23455 99.1771 113.3063 0008405 277.6106 82.4106 14.12671703326608\n", "1 23455U 94089A 01326.97611660 .00000739 00000-0 42245-3 0 9806\n", "2 23455 99.1886 322.4670 0009980 66.2863 293.9354 14.12871991355419\n", "etc\n", "```\n", "\n", "For more keyword arguments checkout out the [reader documentation](https://satpy.readthedocs.io/en/latest/api/satpy.readers.html#module-satpy.readers.avhrr_l1b_gaclac)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Reading Individual Datasets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Of course you can also readout the individual channels and ancillary datasets directly. Here is an example with NOAA-19 data:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import satpy\n", "\n", "# Channel set for KLM satellites. For POD satellites the channels are\n", "# ['1', '2', '3', '4', '5'].\n", "channels = ['1', '2', '3a', '3b', '4', '5']\n", "\n", "# Select some ancillary datasets (there are more datasets available, \n", "# see satpy/etc/readers/avhrr_l1b_gaclac.yaml)\n", "ancillary = ['solar_zenith_angle',\n", " 'sensor_zenith_angle',\n", " 'latitude',\n", " 'longitude'] \n", "\n", "scene = satpy.Scene(filenames=['NSS.GHRR.NP.D15361.S0121.E0315.B3547172.SV'], \n", " reader='avhrr_l1b_gaclac', \n", " reader_kwargs={'tle_dir': 'tle/',\n", " 'tle_name': 'TLE_%(satname)s.txt'})\n", "scene.load(channels + ancillary)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.DataArray 'array-d416e9b022847a2d5f370401d47356d7' (y: 13760, x: 409)>\n",
       "dask.array<array, shape=(13760, 409), dtype=float64, chunksize=(13760, 409)>\n",
       "Coordinates:\n",
       "    acq_time  (y) datetime64[ns] 2015-12-27T01:21:08.285000 ... 2015-12-27T03:15:47.785000\n",
       "Dimensions without coordinates: y, x\n",
       "Attributes:\n",
       "    orbital_parameters:   {'tle': ('1 33591U 09005A   15360.91031674  .000001...\n",
       "    platform_name:        noaa19\n",
       "    orbit_number:         35471\n",
       "    file_type:            gac_lac_l1b\n",
       "    calibration:          brightness_temperature\n",
       "    wavelength:           (10.3, 10.8, 11.3)\n",
       "    name:                 4\n",
       "    standard_name:        toa_brightness_temperature\n",
       "    coordinates:          ('longitude', 'latitude')\n",
       "    polarization:         None\n",
       "    modifiers:            ()\n",
       "    units:                K\n",
       "    level:                None\n",
       "    midnight_scanline:    None\n",
       "    resolution:           1050\n",
       "    sensor:               avhrr-3\n",
       "    missing_scanlines:    [    1     2     3     4     5     6     7     8   ...\n",
       "    start_time:           2015-12-27 01:21:08.285000\n",
       "    end_time:             2015-12-27 03:15:47.785000\n",
       "    area:                 Shape: (13760, 409)\\nLons: <xarray.DataArray 'array...\n",
       "    ancillary_variables:  []
" ], "text/plain": [ "\n", "dask.array\n", "Coordinates:\n", " acq_time (y) datetime64[ns] 2015-12-27T01:21:08.285000 ... 2015-12-27T03:15:47.785000\n", "Dimensions without coordinates: y, x\n", "Attributes:\n", " orbital_parameters: {'tle': ('1 33591U 09005A 15360.91031674 .000001...\n", " platform_name: noaa19\n", " orbit_number: 35471\n", " file_type: gac_lac_l1b\n", " calibration: brightness_temperature\n", " wavelength: (10.3, 10.8, 11.3)\n", " name: 4\n", " standard_name: toa_brightness_temperature\n", " coordinates: ('longitude', 'latitude')\n", " polarization: None\n", " modifiers: ()\n", " units: K\n", " level: None\n", " midnight_scanline: None\n", " resolution: 1050\n", " sensor: avhrr-3\n", " missing_scanlines: [ 1 2 3 4 5 6 7 8 ...\n", " start_time: 2015-12-27 01:21:08.285000\n", " end_time: 2015-12-27 03:15:47.785000\n", " area: Shape: (13760, 409)\\nLons: " ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "import matplotlib.pyplot as plt\n", "\n", "fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(3, 20))\n", "ax1.imshow(scene['4'])\n", "ax2.imshow(scene['solar_zenith_angle'])\n", "plt.show()" ] } ], "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.7.2" } }, "nbformat": 4, "nbformat_minor": 1 }