From d1fe31cf32533ed57ffde8aa939d2bf26138e2b2 Mon Sep 17 00:00:00 2001 From: Sebastien Jourdain Date: Wed, 30 Oct 2024 15:24:54 -0600 Subject: [PATCH] feat(xarray): add slicing and compute in algo --- examples/jupyter/test-xarray.ipynb | 178 ++++++------------ pan3d/explorers/data_viewer.py | 9 + pan3d/xarray/__source.py | 290 ----------------------------- pan3d/xarray/accessor.py | 44 ++--- pan3d/xarray/algorithm.py | 108 +++++++++-- 5 files changed, 183 insertions(+), 446 deletions(-) delete mode 100644 pan3d/xarray/__source.py diff --git a/examples/jupyter/test-xarray.ipynb b/examples/jupyter/test-xarray.ipynb index 4e9f011..61364f2 100644 --- a/examples/jupyter/test-xarray.ipynb +++ b/examples/jupyter/test-xarray.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "88a3053b-a228-4099-8bd8-d92abaae317b", "metadata": {}, "outputs": [], @@ -24,172 +24,118 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "41a4ebf1-8b90-4709-8d4c-06efb3afcc51", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - } - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/sebastien.jourdain/Documents/code/sbir/pan3d/.venv/lib/python3.10/site-packages/xarray/conventions.py:286: SerializationWarning: variable 'z' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.\n", - " var = coder.decode(var, name=name)\n", - "/Users/sebastien.jourdain/Documents/code/sbir/pan3d/.venv/lib/python3.10/site-packages/xarray/conventions.py:286: SerializationWarning: variable 'u' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.\n", - " var = coder.decode(var, name=name)\n", - "/Users/sebastien.jourdain/Documents/code/sbir/pan3d/.venv/lib/python3.10/site-packages/xarray/conventions.py:286: SerializationWarning: variable 'v' has non-conforming '_FillValue' np.float64(nan) defined, dropping '_FillValue' entirely.\n", - " var = coder.decode(var, name=name)\n" - ] - } - ], + "metadata": {}, + "outputs": [], "source": [ "dataset = open_dataset(\"eraint_uvz\")" ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "54c88fe2-176a-4468-89e3-3dbf2979776a", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - } - }, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "ERROR:root:Err: 0 Type: [Syntax Error] Msg: ERR201 - Undefined symbol: 'u'\tExpression: u*iHat + v*jHat\n", - "ERROR:root:Err: 0 Type: [Syntax Error] Msg: ERR201 - Undefined symbol: 'u'\tExpression: u*iHat + v*jHat\n", - "ERROR:root:Err: 0 Type: [Syntax Error] Msg: ERR201 - Undefined symbol: 'u'\tExpression: u*u + v*v\n", - "ERROR:root:Err: 0 Type: [Syntax Error] Msg: ERR201 - Undefined symbol: 'u'\tExpression: u*u + v*v\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n" - ] - } - ], - "source": [ - "viewer = XArrayViewer()\n", - "await viewer.ui.ready" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "c78e6b6c-6ea0-4f46-ada1-8760ed86474f", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "fbd9427e7e9e437fb5ac8e0de61dc9c3", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "HTML(value='