Last active
October 16, 2022 06:23
-
-
Save answerquest/16aac80eab154fd276cabcf4eafbcb33 to your computer and use it in GitHub Desktop.
imdblib new function test notebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "1fbdd0c7", | |
"metadata": {}, | |
"source": [ | |
"## Test script to demonstrate new open_data_file_year() function in imdlib fork" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "325d98f3", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import imdlib_fork.imdlib.core as imdlib" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "b60c4f5a", | |
"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 !important;\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: (time: 365, lat: 31, lon: 31)\n", | |
"Coordinates:\n", | |
" * lat (lat) float64 7.5 8.5 9.5 10.5 11.5 ... 33.5 34.5 35.5 36.5 37.5\n", | |
" * lon (lon) float64 67.5 68.5 69.5 70.5 71.5 ... 93.5 94.5 95.5 96.5 97.5\n", | |
" * time (time) datetime64[ns] 1979-01-01 1979-01-02 ... 1979-12-31\n", | |
"Data variables:\n", | |
" tmax (time, lat, lon) float64 99.9 99.9 99.9 99.9 ... 99.9 99.9 99.9\n", | |
"Attributes:\n", | |
" Conventions: CF-1.7\n", | |
" title: IMD gridded data\n", | |
" source: https://imdpune.gov.in/\n", | |
" history: 2022-10-16 06:22:47.637207 Python\n", | |
" references: \n", | |
" comment: \n", | |
" crs: epsg:4326</pre><div class='xr-wrap' style='display:none'><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-b3a65985-f066-43e4-9880-0ebe3a8713d4' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-b3a65985-f066-43e4-9880-0ebe3a8713d4' 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'>time</span>: 365</li><li><span class='xr-has-index'>lat</span>: 31</li><li><span class='xr-has-index'>lon</span>: 31</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-bb89bf4c-4c35-40f7-bdd7-56747a3cd95c' class='xr-section-summary-in' type='checkbox' checked><label for='section-bb89bf4c-4c35-40f7-bdd7-56747a3cd95c' class='xr-section-summary' >Coordinates: <span>(3)</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'>lat</span></div><div class='xr-var-dims'>(lat)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>7.5 8.5 9.5 10.5 ... 35.5 36.5 37.5</div><input id='attrs-d0f74171-7522-4579-9abb-4f39e7895483' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-d0f74171-7522-4579-9abb-4f39e7895483' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-69582087-b482-4dfb-a1b6-a345e81442a5' class='xr-var-data-in' type='checkbox'><label for='data-69582087-b482-4dfb-a1b6-a345e81442a5' 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>axis :</span></dt><dd>Y</dd><dt><span>standard_name :</span></dt><dd>latitude</dd><dt><span>long_name :</span></dt><dd>latitude</dd><dt><span>units :</span></dt><dd>degrees_north</dd></dl></div><div class='xr-var-data'><pre>array([ 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5,\n", | |
" 19.5, 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5, 30.5,\n", | |
" 31.5, 32.5, 33.5, 34.5, 35.5, 36.5, 37.5])</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'>67.5 68.5 69.5 ... 95.5 96.5 97.5</div><input id='attrs-ecb2fb0e-e333-4926-bdb0-dfd17e99f1bd' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-ecb2fb0e-e333-4926-bdb0-dfd17e99f1bd' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-4bbd0d97-9c49-42d7-9723-5fc79fc7f57a' class='xr-var-data-in' type='checkbox'><label for='data-4bbd0d97-9c49-42d7-9723-5fc79fc7f57a' 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>axis :</span></dt><dd>X</dd><dt><span>long_name :</span></dt><dd>longitude</dd><dt><span>units :</span></dt><dd>degrees_east</dd></dl></div><div class='xr-var-data'><pre>array([67.5, 68.5, 69.5, 70.5, 71.5, 72.5, 73.5, 74.5, 75.5, 76.5, 77.5, 78.5,\n", | |
" 79.5, 80.5, 81.5, 82.5, 83.5, 84.5, 85.5, 86.5, 87.5, 88.5, 89.5, 90.5,\n", | |
" 91.5, 92.5, 93.5, 94.5, 95.5, 96.5, 97.5])</pre></div></li><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'>1979-01-01 ... 1979-12-31</div><input id='attrs-314920b0-82f3-46b7-aac8-30c37e49da52' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-314920b0-82f3-46b7-aac8-30c37e49da52' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b71215e6-8ca6-447e-9b09-ef4186962757' class='xr-var-data-in' type='checkbox'><label for='data-b71215e6-8ca6-447e-9b09-ef4186962757' 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>standard_name :</span></dt><dd>time</dd><dt><span>long_name :</span></dt><dd>time</dd></dl></div><div class='xr-var-data'><pre>array(['1979-01-01T00:00:00.000000000', '1979-01-02T00:00:00.000000000',\n", | |
" '1979-01-03T00:00:00.000000000', ..., '1979-12-29T00:00:00.000000000',\n", | |
" '1979-12-30T00:00:00.000000000', '1979-12-31T00:00:00.000000000'],\n", | |
" dtype='datetime64[ns]')</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1808dff5-fde8-4e8a-836b-7552001eaa3c' class='xr-section-summary-in' type='checkbox' checked><label for='section-1808dff5-fde8-4e8a-836b-7552001eaa3c' 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>tmax</span></div><div class='xr-var-dims'>(time, lat, lon)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>99.9 99.9 99.9 ... 99.9 99.9 99.9</div><input id='attrs-6437fa00-80ae-4afb-b3ec-3c173bfe126b' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-6437fa00-80ae-4afb-b3ec-3c173bfe126b' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-b2979e21-a326-40d5-bebb-8b39e878fdd0' class='xr-var-data-in' type='checkbox'><label for='data-b2979e21-a326-40d5-bebb-8b39e878fdd0' 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>units :</span></dt><dd>C</dd><dt><span>long_name :</span></dt><dd>Maximum Temperature</dd></dl></div><div class='xr-var-data'><pre>array([[[99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" ...,\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153]],\n", | |
"\n", | |
" [[99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
"...\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153]],\n", | |
"\n", | |
" [[99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" ...,\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153],\n", | |
" [99.90000153, 99.90000153, 99.90000153, ..., 99.90000153,\n", | |
" 99.90000153, 99.90000153]]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-c45650d3-49c4-45da-a461-9100e8ab9463' class='xr-section-summary-in' type='checkbox' checked><label for='section-c45650d3-49c4-45da-a461-9100e8ab9463' class='xr-section-summary' >Attributes: <span>(7)</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.7</dd><dt><span>title :</span></dt><dd>IMD gridded data</dd><dt><span>source :</span></dt><dd>https://imdpune.gov.in/</dd><dt><span>history :</span></dt><dd>2022-10-16 06:22:47.637207 Python</dd><dt><span>references :</span></dt><dd></dd><dt><span>comment :</span></dt><dd></dd><dt><span>crs :</span></dt><dd>epsg:4326</dd></dl></div></li></ul></div></div>" | |
], | |
"text/plain": [ | |
"<xarray.Dataset>\n", | |
"Dimensions: (time: 365, lat: 31, lon: 31)\n", | |
"Coordinates:\n", | |
" * lat (lat) float64 7.5 8.5 9.5 10.5 11.5 ... 33.5 34.5 35.5 36.5 37.5\n", | |
" * lon (lon) float64 67.5 68.5 69.5 70.5 71.5 ... 93.5 94.5 95.5 96.5 97.5\n", | |
" * time (time) datetime64[ns] 1979-01-01 1979-01-02 ... 1979-12-31\n", | |
"Data variables:\n", | |
" tmax (time, lat, lon) float64 99.9 99.9 99.9 99.9 ... 99.9 99.9 99.9\n", | |
"Attributes:\n", | |
" Conventions: CF-1.7\n", | |
" title: IMD gridded data\n", | |
" source: https://imdpune.gov.in/\n", | |
" history: 2022-10-16 06:22:47.637207 Python\n", | |
" references: \n", | |
" comment: \n", | |
" crs: epsg:4326" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"imdlib.open_data_file_year('tmax','Maxtemp_MaxT_1979.GRD',1979).get_xarray()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "0993fdec", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"<div>\n", | |
"<style scoped>\n", | |
" .dataframe tbody tr th:only-of-type {\n", | |
" vertical-align: middle;\n", | |
" }\n", | |
"\n", | |
" .dataframe tbody tr th {\n", | |
" vertical-align: top;\n", | |
" }\n", | |
"\n", | |
" .dataframe thead th {\n", | |
" text-align: right;\n", | |
" }\n", | |
"</style>\n", | |
"<table border=\"1\" class=\"dataframe\">\n", | |
" <thead>\n", | |
" <tr style=\"text-align: right;\">\n", | |
" <th></th>\n", | |
" <th>time</th>\n", | |
" <th>lat</th>\n", | |
" <th>lon</th>\n", | |
" <th>tmax</th>\n", | |
" </tr>\n", | |
" </thead>\n", | |
" <tbody>\n", | |
" <tr>\n", | |
" <th>0</th>\n", | |
" <td>1979-01-01</td>\n", | |
" <td>8.5</td>\n", | |
" <td>73.5</td>\n", | |
" <td>31.670000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>1</th>\n", | |
" <td>1979-01-01</td>\n", | |
" <td>8.5</td>\n", | |
" <td>76.5</td>\n", | |
" <td>30.030001</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>2</th>\n", | |
" <td>1979-01-01</td>\n", | |
" <td>8.5</td>\n", | |
" <td>77.5</td>\n", | |
" <td>30.990000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>3</th>\n", | |
" <td>1979-01-01</td>\n", | |
" <td>8.5</td>\n", | |
" <td>78.5</td>\n", | |
" <td>30.070000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>4</th>\n", | |
" <td>1979-01-01</td>\n", | |
" <td>9.5</td>\n", | |
" <td>76.5</td>\n", | |
" <td>30.260000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>...</th>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" <td>...</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>131747</th>\n", | |
" <td>1979-12-31</td>\n", | |
" <td>36.5</td>\n", | |
" <td>72.5</td>\n", | |
" <td>9.970000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>131748</th>\n", | |
" <td>1979-12-31</td>\n", | |
" <td>36.5</td>\n", | |
" <td>73.5</td>\n", | |
" <td>8.790000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>131749</th>\n", | |
" <td>1979-12-31</td>\n", | |
" <td>36.5</td>\n", | |
" <td>74.5</td>\n", | |
" <td>9.670000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>131750</th>\n", | |
" <td>1979-12-31</td>\n", | |
" <td>36.5</td>\n", | |
" <td>75.5</td>\n", | |
" <td>9.470000</td>\n", | |
" </tr>\n", | |
" <tr>\n", | |
" <th>131751</th>\n", | |
" <td>1979-12-31</td>\n", | |
" <td>36.5</td>\n", | |
" <td>78.5</td>\n", | |
" <td>5.760000</td>\n", | |
" </tr>\n", | |
" </tbody>\n", | |
"</table>\n", | |
"<p>131752 rows × 4 columns</p>\n", | |
"</div>" | |
], | |
"text/plain": [ | |
" time lat lon tmax\n", | |
"0 1979-01-01 8.5 73.5 31.670000\n", | |
"1 1979-01-01 8.5 76.5 30.030001\n", | |
"2 1979-01-01 8.5 77.5 30.990000\n", | |
"3 1979-01-01 8.5 78.5 30.070000\n", | |
"4 1979-01-01 9.5 76.5 30.260000\n", | |
"... ... ... ... ...\n", | |
"131747 1979-12-31 36.5 72.5 9.970000\n", | |
"131748 1979-12-31 36.5 73.5 8.790000\n", | |
"131749 1979-12-31 36.5 74.5 9.670000\n", | |
"131750 1979-12-31 36.5 75.5 9.470000\n", | |
"131751 1979-12-31 36.5 78.5 5.760000\n", | |
"\n", | |
"[131752 rows x 4 columns]" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"tmax1 = imdlib.open_data_file_year('tmax','Maxtemp_MaxT_1979.GRD',1979).get_xarray().to_dataframe().fillna('')\n", | |
"tmax2 = tmax1[tmax1['tmax'] < 99].reset_index()\n", | |
"tmax2" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "b8748141", | |
"metadata": {}, | |
"source": [ | |
"## Done !" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "51822c44", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"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.8.10" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment