<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Clément Cherblanc</title>
    <description>Clément Cherblanc&apos;s personal website</description>
    <link>https://ClemAntarctica.github.io/</link>
    <atom:link href="https://ClemAntarctica.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 11 Nov 2026 09:06:28 +0000</pubDate>
    <lastBuildDate>Wed, 11 Nov 2026 09:06:28 +0000</lastBuildDate>
    <generator>Jekyll v3.10.0</generator>
    
      <item>
        <title>Proper reading and reprojection of model output on a non-regular grid with no CRS</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;em&gt;This work benefited from the valuable help, sources and great advice of Fredrick Bunt (University of Montana). Big thank you Fred!&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;xarray&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xr&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;rioxarray&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# for the .rio functions
&lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;numpy&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pyproj&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transformer&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;scipy.interpolate&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;griddata&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;procedures-and-good-habits-when-writting-and-reading-large-geo-spatio-temporal-datasets&quot;&gt;Procedures and good habits when writting and reading large geo-spatio-temporal datasets&lt;/h1&gt;

&lt;p&gt;We deal with large datasets, often time in netCDF format, these datasets span space and time, with associated coordinate systems. Proper handling of those coordinates is essential to reduce error and facilitate user-friendliness, which remains a key component of our work, our science needs to be useful, in perticular to others. Knowledge of the global temperature in ten years is only useful if you can use it to draw conclusions on other processes, in other fields of sciences. This document focuses on proper encoding of the spatial Coordinate Reference System (CRS) and data formatting, based on pre-existing conventions, specifically the &lt;a href=&quot;https://cfconventions.org/Data/cf-conventions/cf-conventions-1.11/cf-conventions.pdf&quot;&gt;NetCDF Climate and Forecast (CF) Metadata Convention&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TL/DR&lt;/strong&gt;: when encoding a dataset, this one needs a CRS (Coordinate Reference System) encoded along with coordinates in that CRS. A CRS_WKT (Well Known Text) is an efficient way to encode key information in all files. Make sure your datasets have that CRS/proper grid/WKT encoded in, whether it is a model output or a dataset you created for your own use. If you read someone else’s file with a compromised/missing CRS, here are some methods to help you.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;open_dataset&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;/dmidata/projects/nckf/smb_hirham/ANT11_eval_ERA5/1999/01/01/00/ts_sfx_ANT11_ANT11_eval_ERA5_1hr_199901010000-199902010000.nc&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div&gt;&lt;svg style=&quot;position: absolute; width: 0; height: 0; overflow: hidden&quot;&gt;
&lt;defs&gt;
&lt;symbol id=&quot;icon-database&quot; viewBox=&quot;0 0 32 32&quot;&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;/symbol&gt;
&lt;symbol id=&quot;icon-file-text2&quot; viewBox=&quot;0 0 32 32&quot;&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;/symbol&gt;
&lt;/defs&gt;
&lt;/svg&gt;
&lt;style&gt;/* CSS stylesheet for displaying xarray objects in jupyterlab.
 *
 */

:root {
  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));
  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));
  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));
  --xr-border-color: var(--jp-border-color2, #e0e0e0);
  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);
  --xr-background-color: var(--jp-layout-color0, white);
  --xr-background-color-row-even: var(--jp-layout-color1, white);
  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);
}

html[theme=dark],
body[data-theme=dark],
body.vscode-dark {
  --xr-font-color0: rgba(255, 255, 255, 1);
  --xr-font-color2: rgba(255, 255, 255, 0.54);
  --xr-font-color3: rgba(255, 255, 255, 0.38);
  --xr-border-color: #1F1F1F;
  --xr-disabled-color: #515151;
  --xr-background-color: #111111;
  --xr-background-color-row-even: #111111;
  --xr-background-color-row-odd: #313131;
}

.xr-wrap {
  display: block !important;
  min-width: 300px;
  max-width: 700px;
}

.xr-text-repr-fallback {
  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */
  display: none;
}

.xr-header {
  padding-top: 6px;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: solid 1px var(--xr-border-color);
}

.xr-header &gt; div,
.xr-header &gt; ul {
  display: inline;
  margin-top: 0;
  margin-bottom: 0;
}

.xr-obj-type,
.xr-array-name {
  margin-left: 2px;
  margin-right: 10px;
}

.xr-obj-type {
  color: var(--xr-font-color2);
}

.xr-sections {
  padding-left: 0 !important;
  display: grid;
  grid-template-columns: 150px auto auto 1fr 20px 20px;
}

.xr-section-item {
  display: contents;
}

.xr-section-item input {
  display: none;
}

.xr-section-item input + label {
  color: var(--xr-disabled-color);
}

.xr-section-item input:enabled + label {
  cursor: pointer;
  color: var(--xr-font-color2);
}

.xr-section-item input:enabled + label:hover {
  color: var(--xr-font-color0);
}

.xr-section-summary {
  grid-column: 1;
  color: var(--xr-font-color2);
  font-weight: 500;
}

.xr-section-summary &gt; span {
  display: inline-block;
  padding-left: 0.5em;
}

.xr-section-summary-in:disabled + label {
  color: var(--xr-font-color2);
}

.xr-section-summary-in + label:before {
  display: inline-block;
  content: &apos;►&apos;;
  font-size: 11px;
  width: 15px;
  text-align: center;
}

.xr-section-summary-in:disabled + label:before {
  color: var(--xr-disabled-color);
}

.xr-section-summary-in:checked + label:before {
  content: &apos;▼&apos;;
}

.xr-section-summary-in:checked + label &gt; span {
  display: none;
}

.xr-section-summary,
.xr-section-inline-details {
  padding-top: 4px;
  padding-bottom: 4px;
}

.xr-section-inline-details {
  grid-column: 2 / -1;
}

.xr-section-details {
  display: none;
  grid-column: 1 / -1;
  margin-bottom: 5px;
}

.xr-section-summary-in:checked ~ .xr-section-details {
  display: contents;
}

.xr-array-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 20px auto;
}

.xr-array-wrap &gt; label {
  grid-column: 1;
  vertical-align: top;
}

.xr-preview {
  color: var(--xr-font-color3);
}

.xr-array-preview,
.xr-array-data {
  padding: 0 5px !important;
  grid-column: 2;
}

.xr-array-data,
.xr-array-in:checked ~ .xr-array-preview {
  display: none;
}

.xr-array-in:checked ~ .xr-array-data,
.xr-array-preview {
  display: inline-block;
}

.xr-dim-list {
  display: inline-block !important;
  list-style: none;
  padding: 0 !important;
  margin: 0;
}

.xr-dim-list li {
  display: inline-block;
  padding: 0;
  margin: 0;
}

.xr-dim-list:before {
  content: &apos;(&apos;;
}

.xr-dim-list:after {
  content: &apos;)&apos;;
}

.xr-dim-list li:not(:last-child):after {
  content: &apos;,&apos;;
  padding-right: 5px;
}

.xr-has-index {
  font-weight: bold;
}

.xr-var-list,
.xr-var-item {
  display: contents;
}

.xr-var-item &gt; div,
.xr-var-item label,
.xr-var-item &gt; .xr-var-name span {
  background-color: var(--xr-background-color-row-even);
  margin-bottom: 0;
}

.xr-var-item &gt; .xr-var-name:hover span {
  padding-right: 5px;
}

.xr-var-list &gt; li:nth-child(odd) &gt; div,
.xr-var-list &gt; li:nth-child(odd) &gt; label,
.xr-var-list &gt; li:nth-child(odd) &gt; .xr-var-name span {
  background-color: var(--xr-background-color-row-odd);
}

.xr-var-name {
  grid-column: 1;
}

.xr-var-dims {
  grid-column: 2;
}

.xr-var-dtype {
  grid-column: 3;
  text-align: right;
  color: var(--xr-font-color2);
}

.xr-var-preview {
  grid-column: 4;
}

.xr-index-preview {
  grid-column: 2 / 5;
  color: var(--xr-font-color2);
}

.xr-var-name,
.xr-var-dims,
.xr-var-dtype,
.xr-preview,
.xr-attrs dt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.xr-var-name:hover,
.xr-var-dims:hover,
.xr-var-dtype:hover,
.xr-attrs dt:hover {
  overflow: visible;
  width: auto;
  z-index: 1;
}

.xr-var-attrs,
.xr-var-data,
.xr-index-data {
  display: none;
  background-color: var(--xr-background-color) !important;
  padding-bottom: 5px !important;
}

.xr-var-attrs-in:checked ~ .xr-var-attrs,
.xr-var-data-in:checked ~ .xr-var-data,
.xr-index-data-in:checked ~ .xr-index-data {
  display: block;
}

.xr-var-data &gt; table {
  float: right;
}

.xr-var-name span,
.xr-var-data,
.xr-index-name div,
.xr-index-data,
.xr-attrs {
  padding-left: 25px !important;
}

.xr-attrs,
.xr-var-attrs,
.xr-var-data,
.xr-index-data {
  grid-column: 1 / -1;
}

dl.xr-attrs {
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 125px auto;
}

.xr-attrs dt,
.xr-attrs dd {
  padding: 0;
  margin: 0;
  float: left;
  padding-right: 10px;
  width: auto;
}

.xr-attrs dt {
  font-weight: normal;
  grid-column: 1;
}

.xr-attrs dt:hover span {
  display: inline-block;
  background: var(--xr-background-color);
  padding-right: 10px;
}

.xr-attrs dd {
  grid-column: 2;
  white-space: pre-wrap;
  word-break: break-all;
}

.xr-icon-database,
.xr-icon-file-text2,
.xr-no-icon {
  display: inline-block;
  vertical-align: middle;
  width: 1em;
  height: 1.5em !important;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}
&lt;/style&gt;
&lt;div class=&quot;xr-wrap&quot; style=&quot;display:none&quot;&gt;&lt;div class=&quot;xr-header&quot;&gt;&lt;div class=&quot;xr-obj-type&quot;&gt;xarray.Dataset&lt;/div&gt;&lt;/div&gt;&lt;ul class=&quot;xr-sections&quot;&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-93e2e899-70fb-47e9-a460-632787d14f5e&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; disabled=&quot;&quot; /&gt;&lt;label for=&quot;section-93e2e899-70fb-47e9-a460-632787d14f5e&quot; class=&quot;xr-section-summary&quot; title=&quot;Expand/collapse section&quot;&gt;Dimensions:&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;ul class=&quot;xr-dim-list&quot;&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;y&lt;/span&gt;: 637&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;x&lt;/span&gt;: 739&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;time&lt;/span&gt;: 745&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-b5f8fcbd-5824-4c19-a819-b1cfaec9bb71&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; checked=&quot;&quot; /&gt;&lt;label for=&quot;section-b5f8fcbd-5824-4c19-a819-b1cfaec9bb71&quot; class=&quot;xr-section-summary&quot;&gt;Coordinates: &lt;span&gt;(5)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;ul class=&quot;xr-var-list&quot;&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;y&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(y)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;0.0 1.1e+04 ... 6.985e+06 6.996e+06&lt;/div&gt;&lt;input id=&quot;attrs-7a2dfc46-079e-4e11-89bf-17a470f59011&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-7a2dfc46-079e-4e11-89bf-17a470f59011&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-ba2152c0-8601-4623-b80b-75ef7f316f6b&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-ba2152c0-8601-4623-b80b-75ef7f316f6b&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;axis :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Y&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;projection_y_coordinate&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Y Coordinate Of Projection&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;units :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;m&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([      0.,   11000.,   22000., ..., 6974000., 6985000., 6996000.])&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;x&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(x)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;0.0 1.1e+04 ... 8.107e+06 8.118e+06&lt;/div&gt;&lt;input id=&quot;attrs-f21ad9df-e270-4a10-a1e4-4d7b958c9995&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-f21ad9df-e270-4a10-a1e4-4d7b958c9995&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-9fd138c2-e91d-4d3d-9af3-16bfd0941413&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-9fd138c2-e91d-4d3d-9af3-16bfd0941413&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;axis :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;X&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;projection_x_coordinate&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;X Coordinate Of Projection&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;units :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;m&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([      0.,   11000.,   22000., ..., 8096000., 8107000., 8118000.])&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;time&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(time)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;datetime64[ns]&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;1999-01-01 ... 1999-02-01&lt;/div&gt;&lt;input id=&quot;attrs-cae00db7-fd66-40da-8f2c-c9f599c9fa5e&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-cae00db7-fd66-40da-8f2c-c9f599c9fa5e&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-88182b72-0496-46ee-9279-b2496f7eaffb&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-88182b72-0496-46ee-9279-b2496f7eaffb&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;time&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Time&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;_CoordinateAxisType :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Time&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([&amp;#x27;1999-01-01T00:00:00.000000000&amp;#x27;, &amp;#x27;1999-01-01T01:00:00.000000000&amp;#x27;,
       &amp;#x27;1999-01-01T02:00:00.000000000&amp;#x27;, ..., &amp;#x27;1999-01-31T22:00:00.000000000&amp;#x27;,
       &amp;#x27;1999-01-31T23:00:00.000000000&amp;#x27;, &amp;#x27;1999-02-01T00:00:00.000000000&amp;#x27;],
      dtype=&amp;#x27;datetime64[ns]&amp;#x27;)&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span&gt;lon&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(y, x)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;...&lt;/div&gt;&lt;input id=&quot;attrs-fbed53c7-0f4d-43c3-9011-8fe4b376bc84&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-fbed53c7-0f4d-43c3-9011-8fe4b376bc84&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-d828c54d-acde-489c-89ce-01ec41f4e34a&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-d828c54d-acde-489c-89ce-01ec41f4e34a&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;longitude&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Longitude&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;units :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;degrees_east&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;_CoordinateAxisType :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Lon&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;[470743 values with dtype=float64]&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span&gt;lat&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(y, x)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;...&lt;/div&gt;&lt;input id=&quot;attrs-0578e7b5-225d-440a-ae42-38631501c0e3&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-0578e7b5-225d-440a-ae42-38631501c0e3&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-a5977794-f2ea-4c6d-b088-3dccdc0cb7e4&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-a5977794-f2ea-4c6d-b088-3dccdc0cb7e4&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;latitude&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Latitude&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;units :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;degrees_north&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;_CoordinateAxisType :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Lat&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;[470743 values with dtype=float64]&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-fa66418e-d38c-459c-83d4-eba268465859&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; checked=&quot;&quot; /&gt;&lt;label for=&quot;section-fa66418e-d38c-459c-83d4-eba268465859&quot; class=&quot;xr-section-summary&quot;&gt;Data variables: &lt;span&gt;(2)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;ul class=&quot;xr-var-list&quot;&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span&gt;Polar_Stereographic&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;()&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;|S1&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;...&lt;/div&gt;&lt;input id=&quot;attrs-a771ae10-c78d-4562-97bc-ffcf5a11287f&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-a771ae10-c78d-4562-97bc-ffcf5a11287f&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-9b1bf73b-9327-4426-b669-00f42d9359bc&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-9b1bf73b-9327-4426-b669-00f42d9359bc&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;grid_mapping_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;polar_stereographic&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;straight_vertical_longitude_from_pole :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;20.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;latitude_of_projection_origin :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;-90.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;standard_parallel :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;-90.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;false_easting :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;4416613.428326072&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;false_northing :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;3071812.9120324715&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;earth_radius :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;6371229.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;proj4 :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;+proj=stere +lat_0=-90.000000 +lat_ts=-90.000000 +lon_0=20.000000 +k_0=1.0 +x_0=4416613.428326 +y_0=3071812.912032 +a=6371229.000000 +b=6371229.000000&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;[1 values with dtype=|S1]&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span&gt;ts&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(time, y, x)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float32&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;...&lt;/div&gt;&lt;input id=&quot;attrs-10b6dd4d-040c-49be-8c51-cecf4750f21d&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-10b6dd4d-040c-49be-8c51-cecf4750f21d&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-1c7d0d32-ef2a-4520-b601-1275bb40e041&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-1c7d0d32-ef2a-4520-b601-1275bb40e041&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;surface_temperature&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Surface Temperature&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;units :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;K&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;FA_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;SFX.TS&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;par :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;11&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;lvt :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;heightAboveGround&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;lev :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;tri :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;grid_mapping :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Polar_Stereographic&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;cell_methods :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;time: point&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;[350703535 values with dtype=float32]&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-c02ec854-2f6c-4dca-be8e-147bc4a08e22&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;section-c02ec854-2f6c-4dca-be8e-147bc4a08e22&quot; class=&quot;xr-section-summary&quot;&gt;Indexes: &lt;span&gt;(3)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;ul class=&quot;xr-var-list&quot;&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;y&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-40484bd1-e994-4b28-9a95-06a4392baf7a&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-40484bd1-e994-4b28-9a95-06a4392baf7a&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(Index([      0.0,   11000.0,   22000.0,   33000.0,   44000.0,   55000.0,
         66000.0,   77000.0,   88000.0,   99000.0,
       ...
       6897000.0, 6908000.0, 6919000.0, 6930000.0, 6941000.0, 6952000.0,
       6963000.0, 6974000.0, 6985000.0, 6996000.0],
      dtype=&amp;#x27;float64&amp;#x27;, name=&amp;#x27;y&amp;#x27;, length=637))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;x&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-bf30fac4-1958-4ae9-b9d2-72a2f460b88c&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-bf30fac4-1958-4ae9-b9d2-72a2f460b88c&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(Index([      0.0,   11000.0,   22000.0,   33000.0,   44000.0,   55000.0,
         66000.0,   77000.0,   88000.0,   99000.0,
       ...
       8019000.0, 8030000.0, 8041000.0, 8052000.0, 8063000.0, 8074000.0,
       8085000.0, 8096000.0, 8107000.0, 8118000.0],
      dtype=&amp;#x27;float64&amp;#x27;, name=&amp;#x27;x&amp;#x27;, length=739))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;time&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-ec27729f-242f-43bb-9fa9-1b40abb8fa6a&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-ec27729f-242f-43bb-9fa9-1b40abb8fa6a&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(DatetimeIndex([&amp;#x27;1999-01-01 00:00:00&amp;#x27;, &amp;#x27;1999-01-01 01:00:00&amp;#x27;,
               &amp;#x27;1999-01-01 02:00:00&amp;#x27;, &amp;#x27;1999-01-01 03:00:00&amp;#x27;,
               &amp;#x27;1999-01-01 04:00:00&amp;#x27;, &amp;#x27;1999-01-01 05:00:00&amp;#x27;,
               &amp;#x27;1999-01-01 06:00:00&amp;#x27;, &amp;#x27;1999-01-01 07:00:00&amp;#x27;,
               &amp;#x27;1999-01-01 08:00:00&amp;#x27;, &amp;#x27;1999-01-01 09:00:00&amp;#x27;,
               ...
               &amp;#x27;1999-01-31 15:00:00&amp;#x27;, &amp;#x27;1999-01-31 16:00:00&amp;#x27;,
               &amp;#x27;1999-01-31 17:00:00&amp;#x27;, &amp;#x27;1999-01-31 18:00:00&amp;#x27;,
               &amp;#x27;1999-01-31 19:00:00&amp;#x27;, &amp;#x27;1999-01-31 20:00:00&amp;#x27;,
               &amp;#x27;1999-01-31 21:00:00&amp;#x27;, &amp;#x27;1999-01-31 22:00:00&amp;#x27;,
               &amp;#x27;1999-01-31 23:00:00&amp;#x27;, &amp;#x27;1999-02-01 00:00:00&amp;#x27;],
              dtype=&amp;#x27;datetime64[ns]&amp;#x27;, name=&amp;#x27;time&amp;#x27;, length=745, freq=None))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-d4d8c7ed-4e99-4e13-abd2-d38fab247ee6&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;section-d4d8c7ed-4e99-4e13-abd2-d38fab247ee6&quot; class=&quot;xr-section-summary&quot;&gt;Attributes: &lt;span&gt;(10)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;Conventions :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;CF-1.4&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;institute_id :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;HCLIMcom&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;model_id :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;HCLIM&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;experiment_id :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;ANT11_eval_ERA5&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;domain :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;ANT11&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;frequency :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;1hr&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;driving_model_id :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;ERA5&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;creation_date :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Sun Mar 31 03:23:30 2024&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;title :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Surface Temperature&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;comment :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Created with gl/xtool&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is an example dataset from an 11km reanalysis of ERA5. I would like to attract your attention on the Dimensions and Coordinates. There are two dimensions here: &lt;em&gt;x&lt;/em&gt; and &lt;em&gt;y&lt;/em&gt;. Coordinates are that &lt;em&gt;x&lt;/em&gt; and &lt;em&gt;y&lt;/em&gt;, &lt;em&gt;time&lt;/em&gt; and &lt;em&gt;lat&lt;/em&gt; and &lt;em&gt;lon&lt;/em&gt;. We notice right away that &lt;em&gt;x&lt;/em&gt; and &lt;em&gt;y&lt;/em&gt; are 1D arrays, vectors in other words, of size 739 and 635 respectively. This indicates a “regular grid”, that can be simply be defined by these two vectors. In other words, one row of that grid will have a single &lt;em&gt;y&lt;/em&gt; value, and one column will have a single &lt;em&gt;x&lt;/em&gt; value. This regular grid may look exactly like what we need, but we need to make sure that this grid is connected to reality somehow. Indeed, we need to locate this grid with respect to some standards, imagine a coordinate reference system in high school mathematics, you need the coordinates of the origin and its unit vectors. This is the information carried by the CRS, it is a standard way of encoding some coordinate system’s key information, it will usually be latitudes/longitudes or in meters, both having their advantages and inconvenients. Thousands of CRS exist, you can find them on &lt;a href=&quot;https://epsg.io/&quot;&gt;EPSG.io&lt;/a&gt;, some will be globally oriented (ex: the modern definition of latitude and longitude is a CRS), some will be more regionally oriented, peticularily the metered CRS (a CRS that uses a unit of meters), they are really accurate at small scale but start being wrong further away from the CRS’s origin due to the curvature of the Earth. There are very simple ways to check one datatset’s CRS:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Dataset CRS: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;crs&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Dataset CRS: None
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is problematic, there is no CRS encoded here. A common procedure is to have an Attribute called &lt;strong&gt;CRS_WKT&lt;/strong&gt;, standing for Coordinate Reference System Well Known Text, summarizing all the information about the CRS in one spot. More information can be found in the NetCDF CF Metadata Convention document. Here, there is no such attribute because this &lt;em&gt;x&lt;/em&gt;/&lt;em&gt;y&lt;/em&gt; grid is actually the grid on which the model was run. &lt;strong&gt;The format of this dataset is standard (Section 5.2 of the NetCDF CF Metadata Conventions), it is output this way such that no alteration of the data or grid is done and the user can choose to make their own changes.&lt;/strong&gt; We only have one last source of information: the lat and lon, let’s look at them.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;fig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplots&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ncols&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;figsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ax&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ax&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Latitute&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Longitude&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Text(0.5, 1.0, &apos;Longitude&apos;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_figures_24-25/2024_geodata_reading_reproject_FIG1.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We are in a complex situation where the coordinates that make physical sense, that matter to us, are a 2D grid, which does not function well with xarray and netCDFs. Indeed, we cannot just erase &lt;em&gt;x&lt;/em&gt; and &lt;em&gt;y&lt;/em&gt;, they are Dimensions and can therefore not be removed, although they have no meaning to anyone else than the person running the model. There are several ways to resolve this.&lt;/p&gt;

&lt;h1 id=&quot;1-manually-create-a-grid-with-appropriate-coordinates&quot;&gt;1: Manually create a grid with appropriate coordinates&lt;/h1&gt;

&lt;p&gt;We will simply reproject the grid of lat/lon onto a grid that suits us better, but without altering the original dataset. For that exercice, I chose to reproject everything onto a metered CRS centered around Antarctica, the &lt;a href=&quot;https://epsg.io/3031&quot;&gt;EPSG:3031&lt;/a&gt;. This method has the advantage of not compromising the data. Interpolation indeed would affect the data, while reprojecting the grid only affect the location of these data.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;transformer&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Transformer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;from_crs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4326&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3031&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;always_xy&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;transformer&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;Concatenated Operation Transformer: pipeline&amp;gt;
Description: axis order change (2D) + Antarctic Polar Stereographic
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transformer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;fig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplots&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ncols&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;figsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ax&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pcolormesh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_figures_24-25/2024_geodata_reading_reproject_FIG2.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;## Bonus: finding the x/y of the south pole on the new grid
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;unravel_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argmin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;r&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;Coordinates of the cell closest to the south pole (our grid is 11km spaced, so we are ~4km away from the south pole):&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;t&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Coordinates of the cell closest to the south pole (our grid is 11km spaced, so we are ~4km away from the south pole): 4005.7661470373446 -4382.867657798594
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I would like to bring your attention on the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Notice the location of the origin for both grids: 0 is somewhere off in the ocean for the left plot, it is at the south pole in our reprojected grid.&lt;/li&gt;
  &lt;li&gt;The orientation: it changed, both Antarctica has been turned but also our grid coordinates are different, shown by the white triangles on the side.&lt;/li&gt;
  &lt;li&gt;The scale along one axis: Antarctica has somewhat shrinked on the right plot, although this could be a plotting artifact, this is also the result of distances being appropriately represented after using the lat/lon to meters conversion.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The right plot is closer to a usable grid, we can actual start performing certain tasks using the ´x_reprojected´ and ´y_reprojected´ grids, for example extracting the data at a given location (whether it is lat/lon or meters) very easily.&lt;/p&gt;

&lt;p&gt;This method does not affect the data itself, only the location of it, but it takes us away from xarray (example of an extremely powerful and optimised library for this kind of problems), we would like to have a properly set dataset instead of this hybrid numpy/xarray solution, but this only comes at the cost of resampling the data.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;######## Bonus: most efficient way to pull data from a list of coordinates:
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lat_stations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;89&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;88&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;85&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;lon_stations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;150&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# mock numbers
&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;x_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_stations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;transformer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;transform&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lon_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lat_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;arg_stations&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;arg_station&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;argmin&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;((&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;**&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;   &lt;span class=&quot;c1&quot;&gt;# find the argument of the cell closest to the desired location
&lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;arg_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;unravel_index&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arg_station&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt; 

&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;Station indices:&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&apos;Data at those indices (first time step):&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;s_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;s_&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arg_stations&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Station indices: [(289, 400), (286, 383), (247, 440)]
Data at those indices (first time step): [254.09996, 256.95547, 255.72516]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;2-resampling-the-data&quot;&gt;2: Resampling the data&lt;/h1&gt;

&lt;p&gt;If altering the data is not a problem for you; if you want to save the data into your own simple file; if you want to use the full power of xarray on a well organized dataset, you may need to resample the data. To do so, we use the SciPy griddata function.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;aspect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;/&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;size&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;700&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;ny&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;aspect&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# the first dimension is for time
&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Target Grid Shape: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Target Grid Shape: (1, 603, 700)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;a-building-the-target-grid-as-a-regular-grid&quot;&gt;A) Building the Target Grid as a Regular Grid&lt;/h2&gt;
&lt;p&gt;We want a regular grid where every pixel is the same size in x and y. The y coordinates are flipped
to follow the common convention of having a decreasing y coordinate for raster data.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;x_target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;y_target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;linspace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;min&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ny&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)[::&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;X_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Y_target&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;np&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;meshgrid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;fig&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;subplots&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ncols&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;figsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;X&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;imshow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Y_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;axs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;set_title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Y&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Text(0.5, 1.0, &apos;Y&apos;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_figures_24-25/2024_geodata_reading_reproject_FIG3.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;b-regridding-the-data-with-griddata&quot;&gt;B) Regridding the Data with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;griddata&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;We need to interpolate the data onto the target grid.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;regridded_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;griddata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;x_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_reprojected&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;].&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_numpy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;().&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;list&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;zip&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Y_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ravel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;method&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;cubic&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;regridded_data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;regridded_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;reshape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pcolormesh&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;X_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Y_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;regridded_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;])&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_figures_24-25/2024_geodata_reading_reproject_FIG4.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;c-building-a-new-xarray-object&quot;&gt;C) Building a New Xarray Object&lt;/h2&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;xdata&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;xr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;DataArray&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;regridded_data&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;dims&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;time&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;y&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;x&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;coords&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ds&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;time&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x_target&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write_crs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;EPSG:3031&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;xdata&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div&gt;&lt;svg style=&quot;position: absolute; width: 0; height: 0; overflow: hidden&quot;&gt;
&lt;defs&gt;
&lt;symbol id=&quot;icon-database&quot; viewBox=&quot;0 0 32 32&quot;&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;/symbol&gt;
&lt;symbol id=&quot;icon-file-text2&quot; viewBox=&quot;0 0 32 32&quot;&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;path d=&quot;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&quot;&gt;&lt;/path&gt;
&lt;/symbol&gt;
&lt;/defs&gt;
&lt;/svg&gt;
&lt;style&gt;/* CSS stylesheet for displaying xarray objects in jupyterlab.
 *
 */

:root {
  --xr-font-color0: var(--jp-content-font-color0, rgba(0, 0, 0, 1));
  --xr-font-color2: var(--jp-content-font-color2, rgba(0, 0, 0, 0.54));
  --xr-font-color3: var(--jp-content-font-color3, rgba(0, 0, 0, 0.38));
  --xr-border-color: var(--jp-border-color2, #e0e0e0);
  --xr-disabled-color: var(--jp-layout-color3, #bdbdbd);
  --xr-background-color: var(--jp-layout-color0, white);
  --xr-background-color-row-even: var(--jp-layout-color1, white);
  --xr-background-color-row-odd: var(--jp-layout-color2, #eeeeee);
}

html[theme=dark],
body[data-theme=dark],
body.vscode-dark {
  --xr-font-color0: rgba(255, 255, 255, 1);
  --xr-font-color2: rgba(255, 255, 255, 0.54);
  --xr-font-color3: rgba(255, 255, 255, 0.38);
  --xr-border-color: #1F1F1F;
  --xr-disabled-color: #515151;
  --xr-background-color: #111111;
  --xr-background-color-row-even: #111111;
  --xr-background-color-row-odd: #313131;
}

.xr-wrap {
  display: block !important;
  min-width: 300px;
  max-width: 700px;
}

.xr-text-repr-fallback {
  /* fallback to plain text repr when CSS is not injected (untrusted notebook) */
  display: none;
}

.xr-header {
  padding-top: 6px;
  padding-bottom: 6px;
  margin-bottom: 4px;
  border-bottom: solid 1px var(--xr-border-color);
}

.xr-header &gt; div,
.xr-header &gt; ul {
  display: inline;
  margin-top: 0;
  margin-bottom: 0;
}

.xr-obj-type,
.xr-array-name {
  margin-left: 2px;
  margin-right: 10px;
}

.xr-obj-type {
  color: var(--xr-font-color2);
}

.xr-sections {
  padding-left: 0 !important;
  display: grid;
  grid-template-columns: 150px auto auto 1fr 20px 20px;
}

.xr-section-item {
  display: contents;
}

.xr-section-item input {
  display: none;
}

.xr-section-item input + label {
  color: var(--xr-disabled-color);
}

.xr-section-item input:enabled + label {
  cursor: pointer;
  color: var(--xr-font-color2);
}

.xr-section-item input:enabled + label:hover {
  color: var(--xr-font-color0);
}

.xr-section-summary {
  grid-column: 1;
  color: var(--xr-font-color2);
  font-weight: 500;
}

.xr-section-summary &gt; span {
  display: inline-block;
  padding-left: 0.5em;
}

.xr-section-summary-in:disabled + label {
  color: var(--xr-font-color2);
}

.xr-section-summary-in + label:before {
  display: inline-block;
  content: &apos;►&apos;;
  font-size: 11px;
  width: 15px;
  text-align: center;
}

.xr-section-summary-in:disabled + label:before {
  color: var(--xr-disabled-color);
}

.xr-section-summary-in:checked + label:before {
  content: &apos;▼&apos;;
}

.xr-section-summary-in:checked + label &gt; span {
  display: none;
}

.xr-section-summary,
.xr-section-inline-details {
  padding-top: 4px;
  padding-bottom: 4px;
}

.xr-section-inline-details {
  grid-column: 2 / -1;
}

.xr-section-details {
  display: none;
  grid-column: 1 / -1;
  margin-bottom: 5px;
}

.xr-section-summary-in:checked ~ .xr-section-details {
  display: contents;
}

.xr-array-wrap {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 20px auto;
}

.xr-array-wrap &gt; label {
  grid-column: 1;
  vertical-align: top;
}

.xr-preview {
  color: var(--xr-font-color3);
}

.xr-array-preview,
.xr-array-data {
  padding: 0 5px !important;
  grid-column: 2;
}

.xr-array-data,
.xr-array-in:checked ~ .xr-array-preview {
  display: none;
}

.xr-array-in:checked ~ .xr-array-data,
.xr-array-preview {
  display: inline-block;
}

.xr-dim-list {
  display: inline-block !important;
  list-style: none;
  padding: 0 !important;
  margin: 0;
}

.xr-dim-list li {
  display: inline-block;
  padding: 0;
  margin: 0;
}

.xr-dim-list:before {
  content: &apos;(&apos;;
}

.xr-dim-list:after {
  content: &apos;)&apos;;
}

.xr-dim-list li:not(:last-child):after {
  content: &apos;,&apos;;
  padding-right: 5px;
}

.xr-has-index {
  font-weight: bold;
}

.xr-var-list,
.xr-var-item {
  display: contents;
}

.xr-var-item &gt; div,
.xr-var-item label,
.xr-var-item &gt; .xr-var-name span {
  background-color: var(--xr-background-color-row-even);
  margin-bottom: 0;
}

.xr-var-item &gt; .xr-var-name:hover span {
  padding-right: 5px;
}

.xr-var-list &gt; li:nth-child(odd) &gt; div,
.xr-var-list &gt; li:nth-child(odd) &gt; label,
.xr-var-list &gt; li:nth-child(odd) &gt; .xr-var-name span {
  background-color: var(--xr-background-color-row-odd);
}

.xr-var-name {
  grid-column: 1;
}

.xr-var-dims {
  grid-column: 2;
}

.xr-var-dtype {
  grid-column: 3;
  text-align: right;
  color: var(--xr-font-color2);
}

.xr-var-preview {
  grid-column: 4;
}

.xr-index-preview {
  grid-column: 2 / 5;
  color: var(--xr-font-color2);
}

.xr-var-name,
.xr-var-dims,
.xr-var-dtype,
.xr-preview,
.xr-attrs dt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.xr-var-name:hover,
.xr-var-dims:hover,
.xr-var-dtype:hover,
.xr-attrs dt:hover {
  overflow: visible;
  width: auto;
  z-index: 1;
}

.xr-var-attrs,
.xr-var-data,
.xr-index-data {
  display: none;
  background-color: var(--xr-background-color) !important;
  padding-bottom: 5px !important;
}

.xr-var-attrs-in:checked ~ .xr-var-attrs,
.xr-var-data-in:checked ~ .xr-var-data,
.xr-index-data-in:checked ~ .xr-index-data {
  display: block;
}

.xr-var-data &gt; table {
  float: right;
}

.xr-var-name span,
.xr-var-data,
.xr-index-name div,
.xr-index-data,
.xr-attrs {
  padding-left: 25px !important;
}

.xr-attrs,
.xr-var-attrs,
.xr-var-data,
.xr-index-data {
  grid-column: 1 / -1;
}

dl.xr-attrs {
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 125px auto;
}

.xr-attrs dt,
.xr-attrs dd {
  padding: 0;
  margin: 0;
  float: left;
  padding-right: 10px;
  width: auto;
}

.xr-attrs dt {
  font-weight: normal;
  grid-column: 1;
}

.xr-attrs dt:hover span {
  display: inline-block;
  background: var(--xr-background-color);
  padding-right: 10px;
}

.xr-attrs dd {
  grid-column: 2;
  white-space: pre-wrap;
  word-break: break-all;
}

.xr-icon-database,
.xr-icon-file-text2,
.xr-no-icon {
  display: inline-block;
  vertical-align: middle;
  width: 1em;
  height: 1.5em !important;
  stroke-width: 0;
  stroke: currentColor;
  fill: currentColor;
}
&lt;/style&gt;
&lt;div class=&quot;xr-wrap&quot; style=&quot;display:none&quot;&gt;&lt;div class=&quot;xr-header&quot;&gt;&lt;div class=&quot;xr-obj-type&quot;&gt;xarray.DataArray&lt;/div&gt;&lt;div class=&quot;xr-array-name&quot;&gt;&lt;/div&gt;&lt;ul class=&quot;xr-dim-list&quot;&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;time&lt;/span&gt;: 1&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;y&lt;/span&gt;: 603&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;xr-has-index&quot;&gt;x&lt;/span&gt;: 700&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;ul class=&quot;xr-sections&quot;&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;div class=&quot;xr-array-wrap&quot;&gt;&lt;input id=&quot;section-3fc24cab-1ea6-4a33-ae9a-f4297e185ad5&quot; class=&quot;xr-array-in&quot; type=&quot;checkbox&quot; checked=&quot;&quot; /&gt;&lt;label for=&quot;section-3fc24cab-1ea6-4a33-ae9a-f4297e185ad5&quot; title=&quot;Show/hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-array-preview xr-preview&quot;&gt;&lt;span&gt;nan nan nan nan nan nan nan nan ... nan nan nan nan nan nan nan nan&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-array-data&quot;&gt;&lt;pre&gt;array([[[nan, nan, nan, ..., nan, nan, nan],
        [nan, nan, nan, ..., nan, nan, nan],
        [nan, nan, nan, ..., nan, nan, nan],
        ...,
        [nan, nan, nan, ..., nan, nan, nan],
        [nan, nan, nan, ..., nan, nan, nan],
        [nan, nan, nan, ..., nan, nan, nan]]])&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-1b7ad529-dfc9-4232-81e0-0df1aa05e86e&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; checked=&quot;&quot; /&gt;&lt;label for=&quot;section-1b7ad529-dfc9-4232-81e0-0df1aa05e86e&quot; class=&quot;xr-section-summary&quot;&gt;Coordinates: &lt;span&gt;(4)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;ul class=&quot;xr-var-list&quot;&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;time&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(time)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;datetime64[ns]&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;1999-01-01&lt;/div&gt;&lt;input id=&quot;attrs-5bfaa5c1-7f61-4657-b856-a298fb1f39c6&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-5bfaa5c1-7f61-4657-b856-a298fb1f39c6&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-3bc74ed5-9028-4efe-ae8b-483cf718852c&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-3bc74ed5-9028-4efe-ae8b-483cf718852c&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;standard_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;time&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;long_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Time&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;_CoordinateAxisType :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Time&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([&amp;#x27;1999-01-01T00:00:00.000000000&amp;#x27;], dtype=&amp;#x27;datetime64[ns]&amp;#x27;)&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;y&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(y)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;5.067e+06 5.052e+06 ... -4.051e+06&lt;/div&gt;&lt;input id=&quot;attrs-6d1742c5-e49f-47db-925a-c7fb61086b23&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; disabled=&quot;&quot; /&gt;&lt;label for=&quot;attrs-6d1742c5-e49f-47db-925a-c7fb61086b23&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-b39faf78-efdb-4ce7-b9df-3a5032f4710b&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-b39faf78-efdb-4ce7-b9df-3a5032f4710b&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([ 5066989.156886,  5051843.642368,  5036698.127849, ..., -4020319.554211,
       -4035465.068729, -4050610.583248])&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span class=&quot;xr-has-index&quot;&gt;x&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;(x)&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;float64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;-5.071e+06 -5.057e+06 ... 4.7e+06&lt;/div&gt;&lt;input id=&quot;attrs-e8a9a9c8-9a1b-48e4-88df-3f294f3cdef6&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; disabled=&quot;&quot; /&gt;&lt;label for=&quot;attrs-e8a9a9c8-9a1b-48e4-88df-3f294f3cdef6&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-e5971868-87e9-4a3e-9503-090e1a32cf2e&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-e5971868-87e9-4a3e-9503-090e1a32cf2e&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array([-5071446.506883, -5057466.884673, -5043487.262462, ...,  4672350.17376 ,
        4686329.79597 ,  4700309.418181])&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-var-name&quot;&gt;&lt;span&gt;spatial_ref&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-dims&quot;&gt;()&lt;/div&gt;&lt;div class=&quot;xr-var-dtype&quot;&gt;int64&lt;/div&gt;&lt;div class=&quot;xr-var-preview xr-preview&quot;&gt;0&lt;/div&gt;&lt;input id=&quot;attrs-f9a1fc58-f0ad-4c5d-8fdd-e2418ab0a385&quot; class=&quot;xr-var-attrs-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;attrs-f9a1fc58-f0ad-4c5d-8fdd-e2418ab0a385&quot; title=&quot;Show/Hide attributes&quot;&gt;&lt;svg class=&quot;icon xr-icon-file-text2&quot;&gt;&lt;use xlink:href=&quot;#icon-file-text2&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;input id=&quot;data-fae7908c-8632-4bc9-9ec4-e9c61ed3227f&quot; class=&quot;xr-var-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;data-fae7908c-8632-4bc9-9ec4-e9c61ed3227f&quot; title=&quot;Show/Hide data repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-var-attrs&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;dt&gt;&lt;span&gt;crs_wkt :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;PROJCS[&amp;quot;WGS 84 / Antarctic Polar Stereographic&amp;quot;,GEOGCS[&amp;quot;WGS 84&amp;quot;,DATUM[&amp;quot;WGS_1984&amp;quot;,SPHEROID[&amp;quot;WGS 84&amp;quot;,6378137,298.257223563,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;7030&amp;quot;]],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;6326&amp;quot;]],PRIMEM[&amp;quot;Greenwich&amp;quot;,0,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;8901&amp;quot;]],UNIT[&amp;quot;degree&amp;quot;,0.0174532925199433,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;9122&amp;quot;]],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;4326&amp;quot;]],PROJECTION[&amp;quot;Polar_Stereographic&amp;quot;],PARAMETER[&amp;quot;latitude_of_origin&amp;quot;,-71],PARAMETER[&amp;quot;central_meridian&amp;quot;,0],PARAMETER[&amp;quot;false_easting&amp;quot;,0],PARAMETER[&amp;quot;false_northing&amp;quot;,0],UNIT[&amp;quot;metre&amp;quot;,1,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;9001&amp;quot;]],AXIS[&amp;quot;Easting&amp;quot;,NORTH],AXIS[&amp;quot;Northing&amp;quot;,NORTH],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;3031&amp;quot;]]&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;semi_major_axis :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;6378137.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;semi_minor_axis :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;6356752.314245179&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;inverse_flattening :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;298.257223563&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;reference_ellipsoid_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;WGS 84&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;longitude_of_prime_meridian :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;prime_meridian_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;Greenwich&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;geographic_crs_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;WGS 84&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;horizontal_datum_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;World Geodetic System 1984&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;projected_crs_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;WGS 84 / Antarctic Polar Stereographic&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;grid_mapping_name :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;polar_stereographic&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;standard_parallel :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;-71.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;straight_vertical_longitude_from_pole :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;false_easting :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;false_northing :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;0.0&lt;/dd&gt;&lt;dt&gt;&lt;span&gt;spatial_ref :&lt;/span&gt;&lt;/dt&gt;&lt;dd&gt;PROJCS[&amp;quot;WGS 84 / Antarctic Polar Stereographic&amp;quot;,GEOGCS[&amp;quot;WGS 84&amp;quot;,DATUM[&amp;quot;WGS_1984&amp;quot;,SPHEROID[&amp;quot;WGS 84&amp;quot;,6378137,298.257223563,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;7030&amp;quot;]],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;6326&amp;quot;]],PRIMEM[&amp;quot;Greenwich&amp;quot;,0,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;8901&amp;quot;]],UNIT[&amp;quot;degree&amp;quot;,0.0174532925199433,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;9122&amp;quot;]],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;4326&amp;quot;]],PROJECTION[&amp;quot;Polar_Stereographic&amp;quot;],PARAMETER[&amp;quot;latitude_of_origin&amp;quot;,-71],PARAMETER[&amp;quot;central_meridian&amp;quot;,0],PARAMETER[&amp;quot;false_easting&amp;quot;,0],PARAMETER[&amp;quot;false_northing&amp;quot;,0],UNIT[&amp;quot;metre&amp;quot;,1,AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;9001&amp;quot;]],AXIS[&amp;quot;Easting&amp;quot;,NORTH],AXIS[&amp;quot;Northing&amp;quot;,NORTH],AUTHORITY[&amp;quot;EPSG&amp;quot;,&amp;quot;3031&amp;quot;]]&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;div class=&quot;xr-var-data&quot;&gt;&lt;pre&gt;array(0)&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-8c57f145-d2a0-4286-b7c7-0dc8efd78302&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;section-8c57f145-d2a0-4286-b7c7-0dc8efd78302&quot; class=&quot;xr-section-summary&quot;&gt;Indexes: &lt;span&gt;(3)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;ul class=&quot;xr-var-list&quot;&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;time&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-50753fe7-dc30-4eac-8305-8631fbf4e530&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-50753fe7-dc30-4eac-8305-8631fbf4e530&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(DatetimeIndex([&amp;#x27;1999-01-01&amp;#x27;], dtype=&amp;#x27;datetime64[ns]&amp;#x27;, name=&amp;#x27;time&amp;#x27;, freq=None))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;y&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-f4c9110f-55df-4334-9c45-1784ac132795&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-f4c9110f-55df-4334-9c45-1784ac132795&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(Index([  5066989.156886292,   5051843.642367795,   5036698.127849301,
         5021552.613330806,    5006407.09881231,   4991261.584293814,
         4976116.069775319,   4960970.555256825,   4945825.040738329,
         4930679.526219834,
       ...
        -3914300.952581398, -3929446.4670998934, -3944591.9816183886,
       -3959737.4961368837,  -3974883.010655379,  -3990028.525173874,
       -4005174.0396923693,  -4020319.554210865,   -4035465.06872936,
       -4050610.5832478553],
      dtype=&amp;#x27;float64&amp;#x27;, name=&amp;#x27;y&amp;#x27;, length=603))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-var-item&quot;&gt;&lt;div class=&quot;xr-index-name&quot;&gt;&lt;div&gt;x&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;xr-index-preview&quot;&gt;PandasIndex&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;input id=&quot;index-0e3c9266-89c1-4329-a460-ce00849afb05&quot; class=&quot;xr-index-data-in&quot; type=&quot;checkbox&quot; /&gt;&lt;label for=&quot;index-0e3c9266-89c1-4329-a460-ce00849afb05&quot; title=&quot;Show/Hide index repr&quot;&gt;&lt;svg class=&quot;icon xr-icon-database&quot;&gt;&lt;use xlink:href=&quot;#icon-database&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/label&gt;&lt;div class=&quot;xr-index-data&quot;&gt;&lt;pre&gt;PandasIndex(Index([ -5071446.506882979,  -5057466.884672587,  -5043487.262462196,
        -5029507.640251804,  -5015528.018041413, -5001548.3958310215,
        -4987568.773620631,  -4973589.151410239,  -4959609.529199847,
        -4945629.906989456,
       ...
        4574492.8182870895,   4588472.440497482,   4602452.062707873,
         4616431.684918264,   4630411.307128657,  4644390.9293390475,
         4658370.551549438,   4672350.173759829,   4686329.795970222,
         4700309.418180612],
      dtype=&amp;#x27;float64&amp;#x27;, name=&amp;#x27;x&amp;#x27;, length=700))&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/li&gt;&lt;li class=&quot;xr-section-item&quot;&gt;&lt;input id=&quot;section-07b1a510-e7fd-4f98-bd96-cd8ba78ac589&quot; class=&quot;xr-section-summary-in&quot; type=&quot;checkbox&quot; disabled=&quot;&quot; /&gt;&lt;label for=&quot;section-07b1a510-e7fd-4f98-bd96-cd8ba78ac589&quot; class=&quot;xr-section-summary&quot; title=&quot;Expand/collapse section&quot;&gt;Attributes: &lt;span&gt;(0)&lt;/span&gt;&lt;/label&gt;&lt;div class=&quot;xr-section-inline-details&quot;&gt;&lt;/div&gt;&lt;div class=&quot;xr-section-details&quot;&gt;&lt;dl class=&quot;xr-attrs&quot;&gt;&lt;/dl&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;plt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figure&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;figsize&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;xdata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;plot&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;robust&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;cmap&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;viridis&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_figures_24-25/2024_geodata_reading_reproject_FIG5.png&quot; alt=&quot;png&quot; /&gt;&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Regridded data CRS: &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;xdata&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;rio&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;crs&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Regridded data CRS: EPSG:3031
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The key point here is that you are able to save this data in a new netCDF file because it has a regular grid. Regular examples from the netCDF or xarray library would suffice to do so.&lt;/p&gt;
</description>
        <pubDate>Fri, 04 Oct 2024 00:00:00 +0000</pubDate>
        <link>https://ClemAntarctica.github.io/science/tutorials/python/2024/10/04/Proper-reading-CRS-datasets.html</link>
        <guid isPermaLink="true">https://ClemAntarctica.github.io/science/tutorials/python/2024/10/04/Proper-reading-CRS-datasets.html</guid>
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
        <category>Python</category>
        
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
        <category>Python</category>
        
      </item>
    
      <item>
        <title>Keeping your science and your papers safe (MEGAsync)</title>
        <description>&lt;p&gt;Keeping your scientific (or not) data and others safe is a key part of efficient science and work. Here I describe my setup to have my important documents, my research code, my writing versions, etc, all synced on a cloud and on my computers in real time.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Disclaimer 1: I am “grandfathered” in MEGAsync, meaning that I signed up to the service when it offered a greater free storage. I have 50Gb for free but signing up for it now will provide you with 20 Gb.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Disclaimer 2: I am not paid by MEGA, I just describe the setup that works amazing for me.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MEGAsync is a sub-product of the &lt;a href=&quot;https://mega.nz&quot;&gt;MEGA cloud service&lt;/a&gt;, it allows for real time syncing of a folder on your computer, to the cloud folder. Any altered file on a given computer will be updated near-instantly in the drive, and in all other accessible computers. This makes up for several extremely practical uses:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;Your files are stored online, so whatever happens to your computer now, you can recover your files. If you get a new computer, just add MEGAsync and you will have all of your files.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Any deleted file ends in the “.debris” folder, meaning you can recover lost files, even months afterwards, including past versions of some of your files.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Perfect computer-switching. I have a laptop that I carry around all the time, its useful in classes, during travels, at home, etc; but I also have a big computer in my lab, for bigger computation and more comfortable work. I can switch between the two computers instantaneously, finding all of my code and datasets where I want them to be.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;This is very compatible with coding: your python scripts and notebooks, your datasets and other files are always available at the same location in your file hierarchy. I do not sync my python environments but can access all of my code with no compatibility issues.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;Because you can decide which of you cloud folder is synced on each one of your computers, I keep most of my files synced on all my computers, but I only keep my “important documents” synced on my phone. This folder contains pdfs of important things for me, like scans of ID, university transcripts, diplomas, etc, and I can always access the latest version of all of those documents from my phone or my computers when needed.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;I sync my scientific paper library on the cloud. I use zotero and make the software pull from a specific folder of my synced folder. I can download a paper on one computer, and access it somewhere else instantaneously.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep in mind that your are limited in storage amount, and to a daily quota of file transfer per computer. Keep also in mind that large datasets may need to not be in the synced folder. Finally, if your code generates a heavy files, even temporarily, your transfer quota may exceed.&lt;/p&gt;

</description>
        <pubDate>Thu, 20 Jun 2024 00:00:00 +0000</pubDate>
        <link>https://ClemAntarctica.github.io/science/tutorials/2024/06/20/drive-syncing.html</link>
        <guid isPermaLink="true">https://ClemAntarctica.github.io/science/tutorials/2024/06/20/drive-syncing.html</guid>
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
      </item>
    
      <item>
        <title>Automatic computation of shadows over a landscape using QGIS and python (miniconda on Linux)</title>
        <description>&lt;p&gt;In my research for my Master’s thesis, I had to generate the shadows of mountains over a landscape, not just hillshade but actually the projected shadow of mountains over valley bottoms, to get a little closer to the actual solar radiation hitting the ground. I needed to do this computation for each day of the year and multiple times a day. I also needed a high enough resolution because it was for scientific purposes, the higher resolution, the better results in theory. This post is a description of my method, such that it could be replicated.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Generating the sun’s location;&lt;/li&gt;
  &lt;li&gt;QGIS shadow plugin;&lt;/li&gt;
  &lt;li&gt;Automatization of the shadow computation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&quot;1-terrain-properties-and-sun-azimuth-and-altitude&quot;&gt;1. Terrain properties and sun azimuth and altitude&lt;/h1&gt;

&lt;p&gt;In order to compute the incident solar radiation on a surface, we need both the surface information and the incidence of the sun. The surface information is a DEM of your choice, QGIS will know how to use it. I used a 30m DEM of my study area in northern Montana. The sun location requires a bit more work.
At a given date, time and location, the sun will have a given altitude (smallest angle between the horizon and the sun) and a given azimuth (angle of the projection of the sun on the Earth surface to the north). For a large area (define large …). You may need to compute the sun’s location at every location because in the northern hemisphere, the sun will appear lower in the sky (smaller altitude) the further north you go, but in a small enough area like the one I considered, at mid-latitudes, I made the simplification of only considering one sun azimuth and altitude.&lt;/p&gt;

&lt;p&gt;I computed the sun azimuth at hourly resolution for a whole year using the code at &lt;a href=&quot;https://github.com/pokekrom/science/blob/main/BLOG_01_shadow_computation/compute_sun_location.ipynb&quot;&gt;this address&lt;/a&gt;, using the &lt;a href=&quot;https://pysolar.org/&quot;&gt;python library pysolar&lt;/a&gt;. I investigated the importance of time resolution and found about 0.5% of cumulative sun radiation difference between hourly and 10-minute computation (&lt;a href=&quot;https://github.com/pokekrom/science/blob/main/BLOG_01_shadow_computation/SR%20hourly%20VS%2010minutes.ipynb&quot;&gt;code for this comparison&lt;/a&gt;). 
To verify that the numbers output by pysolar are not absurd, I plotted all the sun azimuths, altitudes and colored them with the intensity of the incident solar radiation, for a given hour of the day, we find what resembles analemma, as can be seen on the following image. This is encouraging, but should be considered with caution still.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://raw.githubusercontent.com/pokekrom/science/main/BLOG_01_shadow_computation/analema.png&quot; alt=&quot;Analema&quot; /&gt;&lt;/p&gt;

&lt;h1 id=&quot;2-qgis-shadow-plugin&quot;&gt;2. QGIS Shadow plugin&lt;/h1&gt;

&lt;p&gt;I am no QGIS expert, but I have come to use it on occasion, particularly I have found this cool plugin called “Terrain Shading” developed by Zoran Čučković. He talks in depth about his plugin, its methods and outputs on &lt;a href=&quot;http://www.zoran-cuckovic.from.hr/QGIS-terrain-shading/&quot;&gt;his website&lt;/a&gt; and with further explanation on &lt;a href=&quot;https://landscapearchaeology.org/qgis-terrain-shading/&quot;&gt;this blog&lt;/a&gt;, I will now solely focus on the automatization of the call of this plugin.
&lt;strong&gt;/!\ IMPORTANT&lt;/strong&gt;: For reasons mentioned in &lt;a href=&quot;https://landscapearchaeology.org/2020/wgs/&quot;&gt;this article&lt;/a&gt;, the DEM must be in a metered CRS, this is was the plugins can use, the use of latitude and longitude will result in distortions and will probably not even work for this project.
The idea is simple: the function “Shadow depth” of the plugin computes the height of the shadow column at a given location, you may keep this information, I simply picked a threshold of 5m and assigned 1 to any cell with &amp;gt;5m shadow depth, and 0 otherwise. I then up-sampled my map to go from 30m to 1km resolution for the sake of my work.&lt;/p&gt;

&lt;h1 id=&quot;3-automatization-of-the-shadow-computation&quot;&gt;3. Automatization of the shadow computation&lt;/h1&gt;

&lt;p&gt;This plugin is great, but at hourly resolution for a whole year, no way I will repeat this task manually thousands of times! This is where the QGIS console comes in handy. This is where things become a little bit tricky too. You need the “processing” and “pandas” libraries, accessible from the QGIS console. There may be ways that I do not know about, but the following wat worked for me:
I am on Linux, I use miniconda to handle python environments, one of them is dedicated to this work, the following steps apply:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Create a miniconda environment dedicated to QGIS;&lt;/li&gt;
  &lt;li&gt;Install QGIS in this environment, as well as pandas;&lt;/li&gt;
  &lt;li&gt;Open QGIS from this environment and console;&lt;/li&gt;
  &lt;li&gt;Open your DEM;&lt;/li&gt;
  &lt;li&gt;Open the python console by going into: Plugins → python console;&lt;/li&gt;
  &lt;li&gt;You are ready to execute the code!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The python script that I wrote must then be called manually by you from the console, you can find it at &lt;a href=&quot;https://github.com/pokekrom/science/blob/main/BLOG_01_shadow_computation/shadow_script_QGIS.py&quot;&gt;this link&lt;/a&gt;. This is a very short code that will produce one raster (“.tif” file) per time step considered. Remember to take a buffer outside your exact working area to consider the shadows of landscape outside your working area.&lt;/p&gt;

&lt;p&gt;The code does the following things:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;It imports the 2 necessary libraries (again, make sure that they are installed in the right environment, that QGIS was opened from a terminal using this environment)&lt;/li&gt;
  &lt;li&gt;It loads the csv file containing the sun altitudes and azimuths and starts looping through all the values:
    &lt;ul&gt;
      &lt;li&gt;If the altitude is &amp;lt;0, there is no sun, let’s spare the computation time and skip it;&lt;/li&gt;
      &lt;li&gt;if the altitude is &amp;gt;0, then I call the “Shadow depth” function of the plugin, and save the output with a number (increment I), which basically is the i-th hour of the year. This allows me to them transform those thousands of rasters later on to be in whatever format I desire.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The call of the function should be quite straightforward, the parameters used too. You can also see the organization of my folders and how I save the computed shadows.&lt;/p&gt;

&lt;p&gt;You end up with numerous files that are ready for processing! If you have any question about this work, would like guidance or make suggestions or corrections, feel free to reach out at my contact email that can be found on this website. I am no expert and might have done mistakes, I would welcome your expertise and help.&lt;/p&gt;

</description>
        <pubDate>Fri, 23 Feb 2024 00:00:00 +0000</pubDate>
        <link>https://ClemAntarctica.github.io/science/tutorials/python/2024/02/23/DEM-shadows.html</link>
        <guid isPermaLink="true">https://ClemAntarctica.github.io/science/tutorials/python/2024/02/23/DEM-shadows.html</guid>
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
        <category>Python</category>
        
        
        <category>Science</category>
        
        <category>Tutorials</category>
        
        <category>Python</category>
        
      </item>
    
  </channel>
</rss>
