Skip to content

Instantly share code, notes, and snippets.

@navidcy
Created February 3, 2021 21:36
Show Gist options
  • Save navidcy/176efc80b55a8d672dfa9eaed74d0c90 to your computer and use it in GitHub Desktop.
Save navidcy/176efc80b55a8d672dfa9eaed74d0c90 to your computer and use it in GitHub Desktop.
xesfm regrid attempt
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%config InlineBackend.figure_format='retina'"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cosima_cookbook v0.5.4\n",
"xarray v0.16.2\n",
"xrft v0.2.3+11.ga42f6b2\n",
"scipy v1.5.3\n",
"dask v2021.01.1\n",
"numpy v1.19.5\n",
"cartopy v0.18.0\n",
"xesmf v0.5.1\n"
]
}
],
"source": [
"import cosima_cookbook as cc\n",
"import xarray as xr\n",
"import xrft\n",
"import cftime\n",
"import matplotlib\n",
"from netCDF4 import Dataset\n",
"\n",
"import matplotlib.gridspec as gridspec\n",
"\n",
"from matplotlib import rc\n",
"\n",
"rc('font',**{'family':'sans-serif'})\n",
"rc('text', usetex=False)\n",
"rc('xtick', labelsize=12)\n",
"rc('ytick', labelsize=12) \n",
"rc('axes', labelsize=14) # fontsize of the x and y labels\n",
"\n",
"import cmocean\n",
"\n",
"import dask\n",
"from dask.distributed import Client\n",
"from dask_jobqueue import PBSCluster\n",
"\n",
"import cartopy\n",
"from cartopy.mpl.gridliner import LATITUDE_FORMATTER, LONGITUDE_FORMATTER\n",
"import shapely.geometry as sgeom\n",
"import cartopy.crs as ccrs\n",
"import cartopy.feature as cft\n",
"import cartopy.feature as cfeature\n",
"\n",
"import matplotlib.cm as cm\n",
"\n",
"import math\n",
"import string\n",
"import scipy\n",
"\n",
"\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"import xesmf as xe\n",
"\n",
"print(\"cosima_cookbook v\" + cc.__version__)\n",
"print(\"xarray v\" + xr.__version__)\n",
"print(\"xrft v\" + xrft.__version__)\n",
"print(\"scipy v\" + scipy.__version__)\n",
"print(\"dask v\" + dask.__version__)\n",
"print(\"numpy v\" + np.__version__)\n",
"print(\"cartopy v\" + cartopy.__version__)\n",
"print(\"xesmf v\" + xe.__version__)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"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 style=\"text-align: left;\">Client</h3>\n",
"<ul style=\"text-align: left; list-style: none; margin: 0; padding: 0;\">\n",
" <li><b>Scheduler: </b>tcp://127.0.0.1:36123</li>\n",
" <li><b>Dashboard: </b><a href='/proxy/33451/status' target='_blank'>/proxy/33451/status</a></li>\n",
"</ul>\n",
"</td>\n",
"<td style=\"vertical-align: top; border: 0px solid white\">\n",
"<h3 style=\"text-align: left;\">Cluster</h3>\n",
"<ul style=\"text-align: left; list-style:none; margin: 0; padding: 0;\">\n",
" <li><b>Workers: </b>8</li>\n",
" <li><b>Cores: </b>48</li>\n",
" <li><b>Memory: </b>202.48 GB</li>\n",
"</ul>\n",
"</td>\n",
"</tr>\n",
"</table>"
],
"text/plain": [
"<Client: 'tcp://127.0.0.1:36123' processes=8 threads=48, memory=202.48 GB>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from dask.distributed import Client\n",
"client = Client()\n",
"\n",
"# from dask.distributed import Client, LocalCluster\n",
"# client = Client(scheduler_file='/home/552/nc3020/pangeo/tutorial/scheduler.json')\n",
"client"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/g/data/v45/nc3020/ML-Kaushik\n"
]
}
],
"source": [
"!pwd"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"db = '/g/data/v45/nc3020/ML-Kaushik/local_cc_lowfreqvariability_feb2021_cycle3.db'\n",
"session = cc.database.create_session(db)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Get the variables out of the experiments. Here we get out the *(i)* surface temperature and *(ii)* the integrated temperature over the top 50m of the ocean."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"expt = '1deg_jra55_ryf9091_gadi'\n",
"grid1 = xr.open_mfdataset('/g/data3/ik11/outputs/access-om2/'+expt+'/output000/ocean/ocean_grid.nc', combine='by_coords')\n",
" \n",
"expt = '025deg_jra55_ryf9091_gadi'\n",
"grid025 = xr.open_mfdataset('/g/data3/ik11/outputs/access-om2-025/'+expt+'/output000/ocean/ocean_grid.nc', combine='by_coords')\n",
"\n",
"expt = '01deg_jra55v13_ryf9091'\n",
"grid010 = xr.open_mfdataset('/g/data/ik11/outputs/access-om2-01/'+expt+'/output000/ocean/ocean_grid.nc', combine='by_coords')"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"ssh = cc.querying.getvar('01deg_jra55v140_iaf_cycle3', variable='sea_level', session=session, ncfile='ocean-2d-sea_level-1-daily-mean-ym_%.nc', start_time='2016-01-1 00:00:00', end_time='2018-12-31 00:00:00')"
]
},
{
"cell_type": "code",
"execution_count": 21,
"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'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (time: 1096, x: 3600, y: 2700)\n",
"Coordinates:\n",
" * time (time) object 2016-01-01 12:00:00 ... 2018-12-31 12:00:00\n",
" lon (y, x) float32 dask.array&lt;chunksize=(2700, 3600), meta=np.ndarray&gt;\n",
" lat (y, x) float32 dask.array&lt;chunksize=(2700, 3600), meta=np.ndarray&gt;\n",
"Dimensions without coordinates: x, y\n",
"Data variables:\n",
" sea_level (time, y, x) float32 dask.array&lt;chunksize=(1, 540, 720), meta=np.ndarray&gt;</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-bc04267f-6026-4a41-8b4a-194a1100e64a' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-bc04267f-6026-4a41-8b4a-194a1100e64a' 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>: 1096</li><li><span>x</span>: 3600</li><li><span>y</span>: 2700</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-bc71f992-870a-4ead-8eff-214dd475acf5' class='xr-section-summary-in' type='checkbox' checked><label for='section-bc71f992-870a-4ead-8eff-214dd475acf5' 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'>time</span></div><div class='xr-var-dims'>(time)</div><div class='xr-var-dtype'>object</div><div class='xr-var-preview xr-preview'>2016-01-01 12:00:00 ... 2018-12-...</div><input id='attrs-2523ac6a-0062-426e-91ee-011127e677d1' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-2523ac6a-0062-426e-91ee-011127e677d1' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2bf70900-7e25-42a5-977f-9e76902af637' class='xr-var-data-in' type='checkbox'><label for='data-2bf70900-7e25-42a5-977f-9e76902af637' 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>time</dd><dt><span>cartesian_axis :</span></dt><dd>T</dd><dt><span>calendar_type :</span></dt><dd>GREGORIAN</dd><dt><span>bounds :</span></dt><dd>time_bounds</dd></dl></div><div class='xr-var-data'><pre>array([cftime.DatetimeGregorian(2016, 1, 1, 12, 0, 0, 0),\n",
" cftime.DatetimeGregorian(2016, 1, 2, 12, 0, 0, 0),\n",
" cftime.DatetimeGregorian(2016, 1, 3, 12, 0, 0, 0), ...,\n",
" cftime.DatetimeGregorian(2018, 12, 29, 12, 0, 0, 0),\n",
" cftime.DatetimeGregorian(2018, 12, 30, 12, 0, 0, 0),\n",
" cftime.DatetimeGregorian(2018, 12, 31, 12, 0, 0, 0)], dtype=object)</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon</span></div><div class='xr-var-dims'>(y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(2700, 3600), meta=np.ndarray&gt;</div><input id='attrs-0d69ae56-a65a-4612-b85f-0cd921675f7e' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-0d69ae56-a65a-4612-b85f-0cd921675f7e' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-030d3b76-f535-40b4-899d-cdc5fd441596' class='xr-var-data-in' type='checkbox'><label for='data-030d3b76-f535-40b4-899d-cdc5fd441596' 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>tracer longitude</dd><dt><span>units :</span></dt><dd>degrees_E</dd><dt><span>valid_range :</span></dt><dd>[-281. 361.]</dd><dt><span>cell_methods :</span></dt><dd>time: point</dd></dl></div><div class='xr-var-data'><table>\n",
"<tr>\n",
"<td>\n",
"<table>\n",
" <thead>\n",
" <tr><td> </td><th> Array </th><th> Chunk </th></tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr><th> Bytes </th><td> 38.88 MB </td> <td> 38.88 MB </td></tr>\n",
" <tr><th> Shape </th><td> (2700, 3600) </td> <td> (2700, 3600) </td></tr>\n",
" <tr><th> Count </th><td> 2 Tasks </td><td> 1 Chunks </td></tr>\n",
" <tr><th> Type </th><td> float32 </td><td> numpy.ndarray </td></tr>\n",
" </tbody>\n",
"</table>\n",
"</td>\n",
"<td>\n",
"<svg width=\"170\" height=\"140\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
"\n",
" <!-- Horizontal lines -->\n",
" <line x1=\"0\" y1=\"0\" x2=\"120\" y2=\"0\" style=\"stroke-width:2\" />\n",
" <line x1=\"0\" y1=\"90\" x2=\"120\" y2=\"90\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Vertical lines -->\n",
" <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"90\" style=\"stroke-width:2\" />\n",
" <line x1=\"120\" y1=\"0\" x2=\"120\" y2=\"90\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Colored Rectangle -->\n",
" <polygon points=\"0.0,0.0 120.0,0.0 120.0,90.0 0.0,90.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
"\n",
" <!-- Text -->\n",
" <text x=\"60.000000\" y=\"110.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >3600</text>\n",
" <text x=\"140.000000\" y=\"45.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,140.000000,45.000000)\">2700</text>\n",
"</svg>\n",
"</td>\n",
"</tr>\n",
"</table></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(2700, 3600), meta=np.ndarray&gt;</div><input id='attrs-b2d2f6d2-cc1e-4bbe-a6d0-a379f436283a' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-b2d2f6d2-cc1e-4bbe-a6d0-a379f436283a' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-48cacef5-380b-4315-88fe-2f4c7788d17b' class='xr-var-data-in' type='checkbox'><label for='data-48cacef5-380b-4315-88fe-2f4c7788d17b' 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>tracer latitude</dd><dt><span>units :</span></dt><dd>degrees_N</dd><dt><span>valid_range :</span></dt><dd>[-91. 91.]</dd><dt><span>cell_methods :</span></dt><dd>time: point</dd></dl></div><div class='xr-var-data'><table>\n",
"<tr>\n",
"<td>\n",
"<table>\n",
" <thead>\n",
" <tr><td> </td><th> Array </th><th> Chunk </th></tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr><th> Bytes </th><td> 38.88 MB </td> <td> 38.88 MB </td></tr>\n",
" <tr><th> Shape </th><td> (2700, 3600) </td> <td> (2700, 3600) </td></tr>\n",
" <tr><th> Count </th><td> 2 Tasks </td><td> 1 Chunks </td></tr>\n",
" <tr><th> Type </th><td> float32 </td><td> numpy.ndarray </td></tr>\n",
" </tbody>\n",
"</table>\n",
"</td>\n",
"<td>\n",
"<svg width=\"170\" height=\"140\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
"\n",
" <!-- Horizontal lines -->\n",
" <line x1=\"0\" y1=\"0\" x2=\"120\" y2=\"0\" style=\"stroke-width:2\" />\n",
" <line x1=\"0\" y1=\"90\" x2=\"120\" y2=\"90\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Vertical lines -->\n",
" <line x1=\"0\" y1=\"0\" x2=\"0\" y2=\"90\" style=\"stroke-width:2\" />\n",
" <line x1=\"120\" y1=\"0\" x2=\"120\" y2=\"90\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Colored Rectangle -->\n",
" <polygon points=\"0.0,0.0 120.0,0.0 120.0,90.0 0.0,90.0\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
"\n",
" <!-- Text -->\n",
" <text x=\"60.000000\" y=\"110.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >3600</text>\n",
" <text x=\"140.000000\" y=\"45.000000\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,140.000000,45.000000)\">2700</text>\n",
"</svg>\n",
"</td>\n",
"</tr>\n",
"</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-7a154818-029d-4b4e-b0b6-ab8d81732a42' class='xr-section-summary-in' type='checkbox' checked><label for='section-7a154818-029d-4b4e-b0b6-ab8d81732a42' 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>sea_level</span></div><div class='xr-var-dims'>(time, y, x)</div><div class='xr-var-dtype'>float32</div><div class='xr-var-preview xr-preview'>dask.array&lt;chunksize=(1, 540, 720), meta=np.ndarray&gt;</div><input id='attrs-cf5c9ff0-df40-4442-9003-c442579793a7' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-cf5c9ff0-df40-4442-9003-c442579793a7' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-2ca8075d-5387-4b19-8fe9-def586d8867f' class='xr-var-data-in' type='checkbox'><label for='data-2ca8075d-5387-4b19-8fe9-def586d8867f' 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>effective sea level (eta_t + patm/(rho0*g)) on T cells</dd><dt><span>units :</span></dt><dd>meter</dd><dt><span>valid_range :</span></dt><dd>[-1000. 1000.]</dd><dt><span>cell_methods :</span></dt><dd>time: mean</dd><dt><span>time_avg_info :</span></dt><dd>average_T1,average_T2,average_DT</dd><dt><span>coordinates :</span></dt><dd>geolon_t geolat_t</dd><dt><span>standard_name :</span></dt><dd>sea_surface_height_above_geoid</dd></dl></div><div class='xr-var-data'><table>\n",
"<tr>\n",
"<td>\n",
"<table>\n",
" <thead>\n",
" <tr><td> </td><th> Array </th><th> Chunk </th></tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr><th> Bytes </th><td> 42.61 GB </td> <td> 1.56 MB </td></tr>\n",
" <tr><th> Shape </th><td> (1096, 2700, 3600) </td> <td> (1, 540, 720) </td></tr>\n",
" <tr><th> Count </th><td> 54812 Tasks </td><td> 27400 Chunks </td></tr>\n",
" <tr><th> Type </th><td> float32 </td><td> numpy.ndarray </td></tr>\n",
" </tbody>\n",
"</table>\n",
"</td>\n",
"<td>\n",
"<svg width=\"205\" height=\"165\" style=\"stroke:rgb(0,0,0);stroke-width:1\" >\n",
"\n",
" <!-- Horizontal lines -->\n",
" <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"25\" style=\"stroke-width:2\" />\n",
" <line x1=\"10\" y1=\"18\" x2=\"35\" y2=\"43\" />\n",
" <line x1=\"10\" y1=\"36\" x2=\"35\" y2=\"61\" />\n",
" <line x1=\"10\" y1=\"54\" x2=\"35\" y2=\"79\" />\n",
" <line x1=\"10\" y1=\"72\" x2=\"35\" y2=\"97\" />\n",
" <line x1=\"10\" y1=\"90\" x2=\"35\" y2=\"115\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Vertical lines -->\n",
" <line x1=\"10\" y1=\"0\" x2=\"10\" y2=\"90\" style=\"stroke-width:2\" />\n",
" <line x1=\"11\" y1=\"1\" x2=\"11\" y2=\"91\" />\n",
" <line x1=\"12\" y1=\"2\" x2=\"12\" y2=\"92\" />\n",
" <line x1=\"14\" y1=\"4\" x2=\"14\" y2=\"94\" />\n",
" <line x1=\"15\" y1=\"5\" x2=\"15\" y2=\"95\" />\n",
" <line x1=\"16\" y1=\"6\" x2=\"16\" y2=\"96\" />\n",
" <line x1=\"18\" y1=\"8\" x2=\"18\" y2=\"98\" />\n",
" <line x1=\"19\" y1=\"9\" x2=\"19\" y2=\"99\" />\n",
" <line x1=\"20\" y1=\"10\" x2=\"20\" y2=\"100\" />\n",
" <line x1=\"22\" y1=\"12\" x2=\"22\" y2=\"102\" />\n",
" <line x1=\"23\" y1=\"13\" x2=\"23\" y2=\"103\" />\n",
" <line x1=\"24\" y1=\"14\" x2=\"24\" y2=\"104\" />\n",
" <line x1=\"26\" y1=\"16\" x2=\"26\" y2=\"106\" />\n",
" <line x1=\"27\" y1=\"17\" x2=\"27\" y2=\"107\" />\n",
" <line x1=\"28\" y1=\"18\" x2=\"28\" y2=\"108\" />\n",
" <line x1=\"30\" y1=\"20\" x2=\"30\" y2=\"110\" />\n",
" <line x1=\"31\" y1=\"21\" x2=\"31\" y2=\"111\" />\n",
" <line x1=\"32\" y1=\"22\" x2=\"32\" y2=\"112\" />\n",
" <line x1=\"34\" y1=\"24\" x2=\"34\" y2=\"114\" />\n",
" <line x1=\"35\" y1=\"25\" x2=\"35\" y2=\"115\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Colored Rectangle -->\n",
" <polygon points=\"10.0,0.0 35.643422150881364,25.643422150881364 35.643422150881364,115.64342215088136 10.0,90.0\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n",
"\n",
" <!-- Horizontal lines -->\n",
" <line x1=\"10\" y1=\"0\" x2=\"130\" y2=\"0\" style=\"stroke-width:2\" />\n",
" <line x1=\"11\" y1=\"1\" x2=\"131\" y2=\"1\" />\n",
" <line x1=\"12\" y1=\"2\" x2=\"132\" y2=\"2\" />\n",
" <line x1=\"14\" y1=\"4\" x2=\"134\" y2=\"4\" />\n",
" <line x1=\"15\" y1=\"5\" x2=\"135\" y2=\"5\" />\n",
" <line x1=\"16\" y1=\"6\" x2=\"136\" y2=\"6\" />\n",
" <line x1=\"18\" y1=\"8\" x2=\"138\" y2=\"8\" />\n",
" <line x1=\"19\" y1=\"9\" x2=\"139\" y2=\"9\" />\n",
" <line x1=\"20\" y1=\"10\" x2=\"140\" y2=\"10\" />\n",
" <line x1=\"22\" y1=\"12\" x2=\"142\" y2=\"12\" />\n",
" <line x1=\"23\" y1=\"13\" x2=\"143\" y2=\"13\" />\n",
" <line x1=\"24\" y1=\"14\" x2=\"144\" y2=\"14\" />\n",
" <line x1=\"26\" y1=\"16\" x2=\"146\" y2=\"16\" />\n",
" <line x1=\"27\" y1=\"17\" x2=\"147\" y2=\"17\" />\n",
" <line x1=\"28\" y1=\"18\" x2=\"148\" y2=\"18\" />\n",
" <line x1=\"30\" y1=\"20\" x2=\"150\" y2=\"20\" />\n",
" <line x1=\"31\" y1=\"21\" x2=\"151\" y2=\"21\" />\n",
" <line x1=\"32\" y1=\"22\" x2=\"152\" y2=\"22\" />\n",
" <line x1=\"34\" y1=\"24\" x2=\"154\" y2=\"24\" />\n",
" <line x1=\"35\" y1=\"25\" x2=\"155\" y2=\"25\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Vertical lines -->\n",
" <line x1=\"10\" y1=\"0\" x2=\"35\" y2=\"25\" style=\"stroke-width:2\" />\n",
" <line x1=\"34\" y1=\"0\" x2=\"59\" y2=\"25\" />\n",
" <line x1=\"58\" y1=\"0\" x2=\"83\" y2=\"25\" />\n",
" <line x1=\"82\" y1=\"0\" x2=\"107\" y2=\"25\" />\n",
" <line x1=\"106\" y1=\"0\" x2=\"131\" y2=\"25\" />\n",
" <line x1=\"130\" y1=\"0\" x2=\"155\" y2=\"25\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Colored Rectangle -->\n",
" <polygon points=\"10.0,0.0 130.0,0.0 155.64342215088135,25.643422150881364 35.643422150881364,25.643422150881364\" style=\"fill:#8B4903A0;stroke-width:0\"/>\n",
"\n",
" <!-- Horizontal lines -->\n",
" <line x1=\"35\" y1=\"25\" x2=\"155\" y2=\"25\" style=\"stroke-width:2\" />\n",
" <line x1=\"35\" y1=\"43\" x2=\"155\" y2=\"43\" />\n",
" <line x1=\"35\" y1=\"61\" x2=\"155\" y2=\"61\" />\n",
" <line x1=\"35\" y1=\"79\" x2=\"155\" y2=\"79\" />\n",
" <line x1=\"35\" y1=\"97\" x2=\"155\" y2=\"97\" />\n",
" <line x1=\"35\" y1=\"115\" x2=\"155\" y2=\"115\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Vertical lines -->\n",
" <line x1=\"35\" y1=\"25\" x2=\"35\" y2=\"115\" style=\"stroke-width:2\" />\n",
" <line x1=\"59\" y1=\"25\" x2=\"59\" y2=\"115\" />\n",
" <line x1=\"83\" y1=\"25\" x2=\"83\" y2=\"115\" />\n",
" <line x1=\"107\" y1=\"25\" x2=\"107\" y2=\"115\" />\n",
" <line x1=\"131\" y1=\"25\" x2=\"131\" y2=\"115\" />\n",
" <line x1=\"155\" y1=\"25\" x2=\"155\" y2=\"115\" style=\"stroke-width:2\" />\n",
"\n",
" <!-- Colored Rectangle -->\n",
" <polygon points=\"35.643422150881364,25.643422150881364 155.64342215088135,25.643422150881364 155.64342215088135,115.64342215088136 35.643422150881364,115.64342215088136\" style=\"fill:#ECB172A0;stroke-width:0\"/>\n",
"\n",
" <!-- Text -->\n",
" <text x=\"95.643422\" y=\"135.643422\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" >3600</text>\n",
" <text x=\"175.643422\" y=\"70.643422\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(-90,175.643422,70.643422)\">2700</text>\n",
" <text x=\"12.821711\" y=\"122.821711\" font-size=\"1.0rem\" font-weight=\"100\" text-anchor=\"middle\" transform=\"rotate(45,12.821711,122.821711)\">1096</text>\n",
"</svg>\n",
"</td>\n",
"</tr>\n",
"</table></div></li></ul></div></li><li class='xr-section-item'><input id='section-8e40c882-b96a-4ecd-a2f7-1a687ebaf0a9' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-8e40c882-b96a-4ecd-a2f7-1a687ebaf0a9' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (time: 1096, x: 3600, y: 2700)\n",
"Coordinates:\n",
" * time (time) object 2016-01-01 12:00:00 ... 2018-12-31 12:00:00\n",
" lon (y, x) float32 dask.array<chunksize=(2700, 3600), meta=np.ndarray>\n",
" lat (y, x) float32 dask.array<chunksize=(2700, 3600), meta=np.ndarray>\n",
"Dimensions without coordinates: x, y\n",
"Data variables:\n",
" sea_level (time, y, x) float32 dask.array<chunksize=(1, 540, 720), meta=np.ndarray>"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"da = ssh.assign_coords({'geolat_t': grid010.geolat_t, 'geolon_t': grid010.geolon_t})\n",
"da = da.rename({'xt_ocean': 'x', 'yt_ocean': 'y'})\n",
"da = da.rename({'geolon_t': 'lon', 'geolat_t': 'lat'})\n",
"da = da.drop({'x', 'y'})\n",
"\n",
"ds = da.to_dataset()\n",
"ds"
]
},
{
"cell_type": "code",
"execution_count": 22,
"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'>&lt;xarray.Dataset&gt;\n",
"Dimensions: (x: 360, x_b: 361, y: 180, y_b: 181)\n",
"Coordinates:\n",
" lon (y, x) float64 -179.5 -178.5 -177.5 -176.5 ... 177.5 178.5 179.5\n",
" lat (y, x) float64 -89.5 -89.5 -89.5 -89.5 ... 89.5 89.5 89.5 89.5\n",
" lon_b (y_b, x_b) int64 -180 -179 -178 -177 -176 ... 176 177 178 179 180\n",
" lat_b (y_b, x_b) int64 -90 -90 -90 -90 -90 -90 -90 ... 90 90 90 90 90 90\n",
"Dimensions without coordinates: x, x_b, y, y_b\n",
"Data variables:\n",
" *empty*</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-e38fd537-278e-4526-840e-2718fd2d2a06' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-e38fd537-278e-4526-840e-2718fd2d2a06' class='xr-section-summary' title='Expand/collapse section'>Dimensions:</label><div class='xr-section-inline-details'><ul class='xr-dim-list'><li><span>x</span>: 360</li><li><span>x_b</span>: 361</li><li><span>y</span>: 180</li><li><span>y_b</span>: 181</li></ul></div><div class='xr-section-details'></div></li><li class='xr-section-item'><input id='section-ef24b512-cdc5-4291-b387-d6bf0d650850' class='xr-section-summary-in' type='checkbox' checked><label for='section-ef24b512-cdc5-4291-b387-d6bf0d650850' 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>lon</span></div><div class='xr-var-dims'>(y, x)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-179.5 -178.5 ... 178.5 179.5</div><input id='attrs-5031293e-342e-4304-bbc1-3a41bb8d4e38' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-5031293e-342e-4304-bbc1-3a41bb8d4e38' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-005ded9c-9a7e-4dc3-b921-b31aaf2e4d15' class='xr-var-data-in' type='checkbox'><label for='data-005ded9c-9a7e-4dc3-b921-b31aaf2e4d15' 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>longitude</dd></dl></div><div class='xr-var-data'><pre>array([[-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5],\n",
" [-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5],\n",
" [-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5],\n",
" ...,\n",
" [-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5],\n",
" [-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5],\n",
" [-179.5, -178.5, -177.5, ..., 177.5, 178.5, 179.5]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat</span></div><div class='xr-var-dims'>(y, x)</div><div class='xr-var-dtype'>float64</div><div class='xr-var-preview xr-preview'>-89.5 -89.5 -89.5 ... 89.5 89.5</div><input id='attrs-a3f00f81-1233-4846-8945-005cf6118274' class='xr-var-attrs-in' type='checkbox' ><label for='attrs-a3f00f81-1233-4846-8945-005cf6118274' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-5074a387-073f-4164-84c9-4b9c55c29889' class='xr-var-data-in' type='checkbox'><label for='data-5074a387-073f-4164-84c9-4b9c55c29889' 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>latitude</dd></dl></div><div class='xr-var-data'><pre>array([[-89.5, -89.5, -89.5, ..., -89.5, -89.5, -89.5],\n",
" [-88.5, -88.5, -88.5, ..., -88.5, -88.5, -88.5],\n",
" [-87.5, -87.5, -87.5, ..., -87.5, -87.5, -87.5],\n",
" ...,\n",
" [ 87.5, 87.5, 87.5, ..., 87.5, 87.5, 87.5],\n",
" [ 88.5, 88.5, 88.5, ..., 88.5, 88.5, 88.5],\n",
" [ 89.5, 89.5, 89.5, ..., 89.5, 89.5, 89.5]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lon_b</span></div><div class='xr-var-dims'>(y_b, x_b)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>-180 -179 -178 -177 ... 178 179 180</div><input id='attrs-68ca21f6-5e8b-4978-b438-0150272903d5' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-68ca21f6-5e8b-4978-b438-0150272903d5' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-89b68809-3069-4f87-a9c1-f6ffc6e1c858' class='xr-var-data-in' type='checkbox'><label for='data-89b68809-3069-4f87-a9c1-f6ffc6e1c858' 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([[-180, -179, -178, ..., 178, 179, 180],\n",
" [-180, -179, -178, ..., 178, 179, 180],\n",
" [-180, -179, -178, ..., 178, 179, 180],\n",
" ...,\n",
" [-180, -179, -178, ..., 178, 179, 180],\n",
" [-180, -179, -178, ..., 178, 179, 180],\n",
" [-180, -179, -178, ..., 178, 179, 180]])</pre></div></li><li class='xr-var-item'><div class='xr-var-name'><span>lat_b</span></div><div class='xr-var-dims'>(y_b, x_b)</div><div class='xr-var-dtype'>int64</div><div class='xr-var-preview xr-preview'>-90 -90 -90 -90 -90 ... 90 90 90 90</div><input id='attrs-fb6d4798-a3f9-406e-9604-4b88ed40d2cf' class='xr-var-attrs-in' type='checkbox' disabled><label for='attrs-fb6d4798-a3f9-406e-9604-4b88ed40d2cf' title='Show/Hide attributes'><svg class='icon xr-icon-file-text2'><use xlink:href='#icon-file-text2'></use></svg></label><input id='data-65adcbbf-420f-4146-8041-259adcf6ba90' class='xr-var-data-in' type='checkbox'><label for='data-65adcbbf-420f-4146-8041-259adcf6ba90' 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([[-90, -90, -90, ..., -90, -90, -90],\n",
" [-89, -89, -89, ..., -89, -89, -89],\n",
" [-88, -88, -88, ..., -88, -88, -88],\n",
" ...,\n",
" [ 88, 88, 88, ..., 88, 88, 88],\n",
" [ 89, 89, 89, ..., 89, 89, 89],\n",
" [ 90, 90, 90, ..., 90, 90, 90]])</pre></div></li></ul></div></li><li class='xr-section-item'><input id='section-1ac195ca-3c5a-4e6f-adc7-1d514498efb3' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-1ac195ca-3c5a-4e6f-adc7-1d514498efb3' class='xr-section-summary' title='Expand/collapse section'>Data variables: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><ul class='xr-var-list'></ul></div></li><li class='xr-section-item'><input id='section-d6792388-c7de-4b15-8b48-55b4376fdf0e' class='xr-section-summary-in' type='checkbox' disabled ><label for='section-d6792388-c7de-4b15-8b48-55b4376fdf0e' class='xr-section-summary' title='Expand/collapse section'>Attributes: <span>(0)</span></label><div class='xr-section-inline-details'></div><div class='xr-section-details'><dl class='xr-attrs'></dl></div></li></ul></div></div>"
],
"text/plain": [
"<xarray.Dataset>\n",
"Dimensions: (x: 360, x_b: 361, y: 180, y_b: 181)\n",
"Coordinates:\n",
" lon (y, x) float64 -179.5 -178.5 -177.5 -176.5 ... 177.5 178.5 179.5\n",
" lat (y, x) float64 -89.5 -89.5 -89.5 -89.5 ... 89.5 89.5 89.5 89.5\n",
" lon_b (y_b, x_b) int64 -180 -179 -178 -177 -176 ... 176 177 178 179 180\n",
" lat_b (y_b, x_b) int64 -90 -90 -90 -90 -90 -90 -90 ... 90 90 90 90 90 90\n",
"Dimensions without coordinates: x, x_b, y, y_b\n",
"Data variables:\n",
" *empty*"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ds_out = xe.util.grid_global(1, 1)\n",
"ds_out # contains lat/lon values of cell centers and boundaries."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"ename": "RuntimeError",
"evalue": "in-memory factors only supported with GNU (gfortran)",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-23-d87a9f514330>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mregridder\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mxe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRegridder\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mds\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mds_out\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'bilinear'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/xesmf/frontend.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, ds_in, ds_out, method, locstream_in, locstream_out, periodic, **kwargs)\u001b[0m\n\u001b[1;32m 661\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 662\u001b[0m \u001b[0;31m# Create the BaseRegridder\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 663\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgrid_in\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mgrid_out\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 664\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 665\u001b[0m \u001b[0;31m# record output grid and metadata\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/xesmf/frontend.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, grid_in, grid_out, method, filename, reuse_weights, extrap_method, extrap_dist_exponent, extrap_num_src_pnts, weights, ignore_degenerate)\u001b[0m\n\u001b[1;32m 281\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 282\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mreuse_weights\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mweights\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 283\u001b[0;31m \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compute_weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# Dictionary of weights\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 284\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 285\u001b[0m \u001b[0mweights\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfilename\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfilename\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0mweights\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/xesmf/frontend.py\u001b[0m in \u001b[0;36m_compute_weights\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 332\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 333\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_compute_weights\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 334\u001b[0;31m regrid = esmf_regrid_build(\n\u001b[0m\u001b[1;32m 335\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrid_in\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 336\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgrid_out\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/xesmf/backend.py\u001b[0m in \u001b[0;36mesmf_regrid_build\u001b[0;34m(sourcegrid, destgrid, method, filename, extra_dims, extrap_method, extrap_dist_exponent, extrap_num_src_pnts, ignore_degenerate)\u001b[0m\n\u001b[1;32m 479\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msrc_mask_values\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdst_mask_values\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 480\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 481\u001b[0;31m \u001b[0mregrid\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mESMF\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRegrid\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msourcefield\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdestfield\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 482\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 483\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mregrid\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/ESMF/util/decorators.py\u001b[0m in \u001b[0;36mnew_func\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 63\u001b[0m \u001b[0mesmp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mesmpymanager\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mManager\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdebug\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 64\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 65\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mnew_func\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/g/data3/hh5/public/apps/miniconda3/envs/analysis3-21.01/lib/python3.8/site-packages/ESMF/api/regrid.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, srcfield, dstfield, filename, rh_filename, src_mask_values, dst_mask_values, regrid_method, pole_method, regrid_pole_npoints, line_type, norm_type, extrap_method, extrap_num_src_pnts, extrap_dist_exponent, unmapped_action, ignore_degenerate, create_rh, src_frac_field, dst_frac_field, factors)\u001b[0m\n\u001b[1;32m 108\u001b[0m \u001b[0;31m# Confirm the ESMF compiler will suport in-memory factor retrieval\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 109\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfactors\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mconstants\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_ESMF_USE_INMEM_FACTORS\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 110\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mRuntimeError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"in-memory factors only supported with GNU (gfortran)\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 111\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mRuntimeError\u001b[0m: in-memory factors only supported with GNU (gfortran)"
]
}
],
"source": [
"regridder = xe.Regridder(ds, ds_out, 'bilinear')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dr_out = regridder(dr)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python [conda env:analysis3-21.01] *",
"language": "python",
"name": "conda-env-analysis3-21.01-py"
},
"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.6"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment