{ "cells": [ { "cell_type": "markdown", "id": "a4641c58-14f3-4e58-af01-3ed5cd2b8867", "metadata": { "tags": [] }, "source": [ "# 读取风云卫星数据文件" ] }, { "cell_type": "code", "execution_count": 1, "id": "3b5bee50-0cae-47c6-9244-144ed1748708", "metadata": { "tags": [] }, "outputs": [], "source": [ "# set up things\n", "%matplotlib inline\n", "%load_ext autoreload\n", "%autoreload 2\n", "\n", "import warnings\n", "warnings.filterwarnings('ignore')" ] }, { "cell_type": "code", "execution_count": 2, "id": "1d813531-0813-4747-8066-c9cccad38773", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "\n", "from nmc_met_io.read_satellite import read_awx_cloud" ] }, { "cell_type": "code", "execution_count": 3, "id": "642923ce-9879-4599-83dc-de3b051aeac8", "metadata": {}, "outputs": [], "source": [ "data = read_awx_cloud(\"./samples/ANI_IR1_R04_20220331_2100_FY2G.AWX\")" ] }, { "cell_type": "code", "execution_count": 4, "id": "2e4b15c0-73fc-4df0-98fc-c974778c2334", "metadata": {}, "outputs": [ { "data": { "text/html": [ "<div><svg style=\"position: absolute; width: 0; height: 0; overflow: hidden\">\n", "<defs>\n", "<symbol id=\"icon-database\" viewBox=\"0 0 32 32\">\n", "<path d=\"M16 0c-8.837 0-16 2.239-16 5v4c0 2.761 7.163 5 16 5s16-2.239 16-5v-4c0-2.761-7.163-5-16-5z\"></path>\n", "<path d=\"M16 17c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "<path d=\"M16 26c-8.837 0-16-2.239-16-5v6c0 2.761 7.163 5 16 5s16-2.239 16-5v-6c0 2.761-7.163 5-16 5z\"></path>\n", "</symbol>\n", "<symbol id=\"icon-file-text2\" viewBox=\"0 0 32 32\">\n", "<path d=\"M28.681 7.159c-0.694-0.947-1.662-2.053-2.724-3.116s-2.169-2.030-3.116-2.724c-1.612-1.182-2.393-1.319-2.841-1.319h-15.5c-1.378 0-2.5 1.121-2.5 2.5v27c0 1.378 1.122 2.5 2.5 2.5h23c1.378 0 2.5-1.122 2.5-2.5v-19.5c0-0.448-0.137-1.23-1.319-2.841zM24.543 5.457c0.959 0.959 1.712 1.825 2.268 2.543h-4.811v-4.811c0.718 0.556 1.584 1.309 2.543 2.268zM28 29.5c0 0.271-0.229 0.5-0.5 0.5h-23c-0.271 0-0.5-0.229-0.5-0.5v-27c0-0.271 0.229-0.5 0.5-0.5 0 0 15.499-0 15.5 0v7c0 0.552 0.448 1 1 1h7v19.5z\"></path>\n", "<path d=\"M23 26h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 22h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "<path d=\"M23 18h-14c-0.552 0-1-0.448-1-1s0.448-1 1-1h14c0.552 0 1 0.448 1 1s-0.448 1-1 1z\"></path>\n", "</symbol>\n", "</defs>\n", "</svg>\n", "<style>/* CSS stylesheet for displaying xarray objects in jupyterlab.\n", " *\n", " */\n", "\n", ":root {\n", " --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));\n", " --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));\n", " --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));\n", " --xr-border-color: var(--jp-border-color2, #e0e0e0);\n", " --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);\n", " --xr-background-color: var(--jp-layout-color0, white);\n", " --xr-background-color-row-even: var(--jp-layout-color1, white);\n", " --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);\n", "}\n", "\n", "html[theme=dark],\n", "body.vscode-dark {\n", " --xr-font-color0: rgba(255, 255, 255, 1);\n", " --xr-font-color2: rgba(255, 255, 255, 0.54);\n", " --xr-font-color3: rgba(255, 255, 255, 0.38);\n", " --xr-border-color: #1F1F1F;\n", " --xr-disabled-color: #515151;\n", " --xr-background-color: #111111;\n", " --xr-background-color-row-even: #111111;\n", " --xr-background-color-row-odd: #313131;\n", "}\n", "\n", ".xr-wrap {\n", " display: block;\n", " min-width: 300px;\n", " max-width: 700px;\n", "}\n", "\n", ".xr-text-repr-fallback {\n", " /* fallback to plain text repr when CSS is not injected (untrusted notebook) */\n", " display: none;\n", "}\n", "\n", ".xr-header {\n", " padding-top: 6px;\n", " padding-bottom: 6px;\n", " margin-bottom: 4px;\n", " border-bottom: solid 1px var(--xr-border-color);\n", "}\n", "\n", ".xr-header > div,\n", ".xr-header > ul {\n", " display: inline;\n", " margin-top: 0;\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-obj-type,\n", ".xr-array-name {\n", " margin-left: 2px;\n", " margin-right: 10px;\n", "}\n", "\n", ".xr-obj-type {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-sections {\n", " padding-left: 0 !important;\n", " display: grid;\n", " grid-template-columns: 150px auto auto 1fr 20px 20px;\n", "}\n", "\n", ".xr-section-item {\n", " display: contents;\n", "}\n", "\n", ".xr-section-item input {\n", " display: none;\n", "}\n", "\n", ".xr-section-item input + label {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-item input:enabled + label {\n", " cursor: pointer;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-item input:enabled + label:hover {\n", " color: var(--xr-font-color0);\n", "}\n", "\n", ".xr-section-summary {\n", " grid-column: 1;\n", " color: var(--xr-font-color2);\n", " font-weight: 500;\n", "}\n", "\n", ".xr-section-summary > span {\n", " display: inline-block;\n", " padding-left: 0.5em;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label {\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-section-summary-in + label:before {\n", " display: inline-block;\n", " content: '►';\n", " font-size: 11px;\n", " width: 15px;\n", " text-align: center;\n", "}\n", "\n", ".xr-section-summary-in:disabled + label:before {\n", " color: var(--xr-disabled-color);\n", "}\n", "\n", ".xr-section-summary-in:checked + label:before {\n", " content: '▼';\n", "}\n", "\n", ".xr-section-summary-in:checked + label > span {\n", " display: none;\n", "}\n", "\n", ".xr-section-summary,\n", ".xr-section-inline-details {\n", " padding-top: 4px;\n", " padding-bottom: 4px;\n", "}\n", "\n", ".xr-section-inline-details {\n", " grid-column: 2 / -1;\n", "}\n", "\n", ".xr-section-details {\n", " display: none;\n", " grid-column: 1 / -1;\n", " margin-bottom: 5px;\n", "}\n", "\n", ".xr-section-summary-in:checked ~ .xr-section-details {\n", " display: contents;\n", "}\n", "\n", ".xr-array-wrap {\n", " grid-column: 1 / -1;\n", " display: grid;\n", " grid-template-columns: 20px auto;\n", "}\n", "\n", ".xr-array-wrap > label {\n", " grid-column: 1;\n", " vertical-align: top;\n", "}\n", "\n", ".xr-preview {\n", " color: var(--xr-font-color3);\n", "}\n", "\n", ".xr-array-preview,\n", ".xr-array-data {\n", " padding: 0 5px !important;\n", " grid-column: 2;\n", "}\n", "\n", ".xr-array-data,\n", ".xr-array-in:checked ~ .xr-array-preview {\n", " display: none;\n", "}\n", "\n", ".xr-array-in:checked ~ .xr-array-data,\n", ".xr-array-preview {\n", " display: inline-block;\n", "}\n", "\n", ".xr-dim-list {\n", " display: inline-block !important;\n", " list-style: none;\n", " padding: 0 !important;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list li {\n", " display: inline-block;\n", " padding: 0;\n", " margin: 0;\n", "}\n", "\n", ".xr-dim-list:before {\n", " content: '(';\n", "}\n", "\n", ".xr-dim-list:after {\n", " content: ')';\n", "}\n", "\n", ".xr-dim-list li:not(:last-child):after {\n", " content: ',';\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-has-index {\n", " font-weight: bold;\n", "}\n", "\n", ".xr-var-list,\n", ".xr-var-item {\n", " display: contents;\n", "}\n", "\n", ".xr-var-item > div,\n", ".xr-var-item label,\n", ".xr-var-item > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-even);\n", " margin-bottom: 0;\n", "}\n", "\n", ".xr-var-item > .xr-var-name:hover span {\n", " padding-right: 5px;\n", "}\n", "\n", ".xr-var-list > li:nth-child(odd) > div,\n", ".xr-var-list > li:nth-child(odd) > label,\n", ".xr-var-list > li:nth-child(odd) > .xr-var-name span {\n", " background-color: var(--xr-background-color-row-odd);\n", "}\n", "\n", ".xr-var-name {\n", " grid-column: 1;\n", "}\n", "\n", ".xr-var-dims {\n", " grid-column: 2;\n", "}\n", "\n", ".xr-var-dtype {\n", " grid-column: 3;\n", " text-align: right;\n", " color: var(--xr-font-color2);\n", "}\n", "\n", ".xr-var-preview {\n", " grid-column: 4;\n", "}\n", "\n", ".xr-var-name,\n", ".xr-var-dims,\n", ".xr-var-dtype,\n", ".xr-preview,\n", ".xr-attrs dt {\n", " white-space: nowrap;\n", " overflow: hidden;\n", " text-overflow: ellipsis;\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-var-name:hover,\n", ".xr-var-dims:hover,\n", ".xr-var-dtype:hover,\n", ".xr-attrs dt:hover {\n", " overflow: visible;\n", " width: auto;\n", " z-index: 1;\n", "}\n", "\n", ".xr-var-attrs,\n", ".xr-var-data {\n", " display: none;\n", " background-color: var(--xr-background-color) !important;\n", " padding-bottom: 5px !important;\n", "}\n", "\n", ".xr-var-attrs-in:checked ~ .xr-var-attrs,\n", ".xr-var-data-in:checked ~ .xr-var-data {\n", " display: block;\n", "}\n", "\n", ".xr-var-data > table {\n", " float: right;\n", "}\n", "\n", ".xr-var-name span,\n", ".xr-var-data,\n", ".xr-attrs {\n", " padding-left: 25px !important;\n", "}\n", "\n", ".xr-attrs,\n", ".xr-var-attrs,\n", ".xr-var-data {\n", " grid-column: 1 / -1;\n", "}\n", "\n", "dl.xr-attrs {\n", " padding: 0;\n", " margin: 0;\n", " display: grid;\n", " grid-template-columns: 125px auto;\n", "}\n", "\n", ".xr-attrs dt,\n", ".xr-attrs dd {\n", " padding: 0;\n", " margin: 0;\n", " float: left;\n", " padding-right: 10px;\n", " width: auto;\n", "}\n", "\n", ".xr-attrs dt {\n", " font-weight: normal;\n", " grid-column: 1;\n", "}\n", "\n", ".xr-attrs dt:hover span {\n", " display: inline-block;\n", " background: var(--xr-background-color);\n", " padding-right: 10px;\n", "}\n", "\n", ".xr-attrs dd {\n", " grid-column: 2;\n", " white-space: pre-wrap;\n", " word-break: break-all;\n", "}\n", "\n", ".xr-icon-database,\n", ".xr-icon-file-text2 {\n", " display: inline-block;\n", " vertical-align: middle;\n", " width: 1em;\n", " height: 1.5em !important;\n", " stroke-width: 0;\n", " stroke: currentColor;\n", " fill: currentColor;\n", "}\n", "</style><pre class='xr-text-repr-fallback'><xarray.Dataset>\n", "Dimensions: (channel: 1, lat: 1300, lon: 1900, time: 1)\n", "Coordinates:\n", " * time (time) datetime64[ns] 2022-03-31T13:00:00\n", " * channel (channel) int16 1\n", " * lat (lat) float64 -4.96 -4.91 -4.86 -4.81 ... 59.82 59.87 59.92 59.97\n", " * lon (lon) float64 50.02 50.07 50.12 50.17 ... 144.8 144.9 144.9 145.0\n", "Data variables:\n", " image (time, channel, lat, lon) float64 293.0 293.5 293.5 ... 332.8 332.8\n", "Attributes:\n", " Conventions: CF-1.6\n", " Origin: MICAPS Cassandra Server</pre><div class='xr-wrap' hidden><div class='xr-header'><div class='xr-obj-type'>xarray.Dataset</div></div><ul class='xr-sections'><li class='xr-section-item'><input id='section-7c78cd77-446f-4c9c-85e8-549781d44740' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-7c78cd77-446f-4c9c-85e8-549781d44740' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span class='xr-has-index'>channel</span>: 1</li><li><span class='xr-has-index'>lat</span>: 1300</li><li><span class='xr-has-index'>lon</span>: 1900</li><li><span class='xr-has-index'>time</span>: 1</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-19de5dbf-c978-42b6-a8b0-4ead4f0d4a05' class='xr-section-summary-in' type='checkbox' checked><label for='section-19de5dbf-c978-42b6-a8b0-4ead4f0d4a05' class='xr-section-summary' >Coordinates: <span>(4)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>datetime64[ns]</div><div class='xr-var-preview xr-preview'>2022-03-31T13:00:00</div><input id='attrs-1d612f7a-034a-463f-ba75-7bb0ca4435f0' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-1d612f7a-034a-463f-ba75-7bb0ca4435f0' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-d5fbba2a-ac4a-4a7e-95ac-4acd920a6b18' class='xr-var-data-in' type='checkbox'><label for='data-d5fbba2a-ac4a-4a7e-95ac-4acd920a6b18' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'></dl></div><div class='xr-var-data'><pre>array(['2022-03-31T13:00:00.000000000'], dtype='datetime64[ns]')</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>channel</span></div><div class='xr-var-dims'>(channel)</div><div class='xr-var-dtype'>int16</div><div class='xr-var-preview xr-preview'>1</div><input id='attrs-aee8ef0c-6244-400e-b204-5e0b3136a339' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-aee8ef0c-6244-400e-b204-5e0b3136a339' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-ac8fae10-00d0-4437-a36a-ef8a4993f2f3' class='xr-var-data-in' type='checkbox'><label for='data-ac8fae10-00d0-4437-a36a-ef8a4993f2f3' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>channel</dd><dt><span>units :</span></dt><dd></dd></dl></div><div class='xr-var-data'><pre>array([1], dtype=int16)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-4.96 -4.91 -4.86 ... 59.92 59.97</div><input id='attrs-6b1d3875-7133-469e-9b26-5081a68da714' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-6b1d3875-7133-469e-9b26-5081a68da714' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-6bbfb58f-cf3b-4d7a-abb3-c799ece61bb7' class='xr-var-data-in' type='checkbox'><label for='data-6bbfb58f-cf3b-4d7a-abb3-c799ece61bb7' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd><dt><span>_CoordinateAxisType :</span></dt><dd>Lat</dd><dt><span>axis :</span></dt><dd>Y</dd></dl></div><div class='xr-var-data'><pre>array([-4.96 , -4.910015, -4.860031, ..., 59.870031, 59.920015, 59.97 ])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span class='xr-has-index'>lon</span></div><div class='xr-var-dims'>(lon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>50.02 50.07 50.12 ... 144.9 145.0</div><input id='attrs-08a5cc27-2421-4631-818a-89164f728647' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-08a5cc27-2421-4631-818a-89164f728647' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-bc11e962-9101-45c0-810d-f26ea7fae009' class='xr-var-data-in' type='checkbox'><label for='data-bc11e962-9101-45c0-810d-f26ea7fae009' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>long_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd><dt><span>_CoordinateAxisType :</span></dt><dd>Lon</dd><dt><span>axis :</span></dt><dd>X</dd></dl></div><div class='xr-var-data'><pre>array([ 50.02, 50.07, 50.12, ..., 144.87, 144.92, 144.97])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-b06ebe4e-c639-44b6-8b0d-9a2137ff4f21' class='xr-section-summary-in' type='checkbox' checked><label for='section-b06ebe4e-c639-44b6-8b0d-9a2137ff4f21' class='xr-section-summary' >Data variables: <span>(1)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'><li class='xr-var-item'><div class='xr-var-name'><span>image</span></div><div class='xr-var-dims'>(time, channel, lat, lon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>293.0 293.5 293.5 ... 332.8 332.8</div><input id='attrs-d8f7246a-5066-4769-a8ce-0a7e8a746dc5' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d8f7246a-5066-4769-a8ce-0a7e8a746dc5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-37ea3fa9-57b8-4303-bb68-e74a6dd5f7c6' class='xr-var-data-in' type='checkbox'><label for='data-37ea3fa9-57b8-4303-bb68-e74a6dd5f7c6' title='Show/Hide data repr'><svg class='icon xr-icon-database'><use xlink:href='#icon-database'></use></svg></label><div class='xr-var-attrs'><dl class='xr-attrs'><dt><span>productCategory :</span></dt><dd>1</dd><dt><span>formatString :</span></dt><dd>b'SAT2004'</dd><dt><span>qualityFlag :</span></dt><dd>0</dd><dt><span>satelliteName :</span></dt><dd>b'FY2G'</dd><dt><span>flagOfProjection :</span></dt><dd>4</dd><dt><span>units :</span></dt><dd></dd></dl></div><div class='xr-var-data'><pre>array([[[[293.04, 293.48, 293.48, ..., 236.4 , 242.07, 245.12],\n", " [292.61, 293.04, 293.04, ..., 245.12, 248.74, 250.14],\n", " [292.17, 292.61, 292.61, ..., 252.88, 254.86, 254.86],\n", " ...,\n", " [258.68, 258.68, 259.31, ..., 255.51, 254.86, 254.86],\n", " [258.68, 259.31, 259.92, ..., 254.86, 254.86, 254.86],\n", " [316.71, 308.91, 304.24, ..., 332.77, 332.77, 332.77]]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c7322fa4-fd82-4418-952d-b226554a62d9' class='xr-section-summary-in' type='checkbox' checked><label for='section-c7322fa4-fd82-4418-952d-b226554a62d9' class='xr-section-summary' >Attributes: <span>(2)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'><dt><span>Conventions :</span></dt><dd>CF-1.6</dd><dt><span>Origin :</span></dt><dd>MICAPS Cassandra Server</dd></dl></div></li></ul></div></div>" ], "text/plain": [ "<xarray.Dataset>\n", "Dimensions: (channel: 1, lat: 1300, lon: 1900, time: 1)\n", "Coordinates:\n", " * time (time) datetime64[ns] 2022-03-31T13:00:00\n", " * channel (channel) int16 1\n", " * lat (lat) float64 -4.96 -4.91 -4.86 -4.81 ... 59.82 59.87 59.92 59.97\n", " * lon (lon) float64 50.02 50.07 50.12 50.17 ... 144.8 144.9 144.9 145.0\n", "Data variables:\n", " image (time, channel, lat, lon) float64 293.0 293.5 293.5 ... 332.8 332.8\n", "Attributes:\n", " Conventions: CF-1.6\n", " Origin: MICAPS Cassandra Server" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data" ] } ], "metadata": { "kernelspec": { "display_name": "Meteorology with Python", "language": "python", "name": "met" }, "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.9.12" }, "widgets": { "application/vnd.jupyter.widget-state+json": { "state": {}, "version_major": 2, "version_minor": 0 } } }, "nbformat": 4, "nbformat_minor": 5 }