Skip to content

simple backend engine for image formats#355

Open
keewis wants to merge 3 commits into
xarray-contrib:mainfrom
keewis:custom-backend
Open

simple backend engine for image formats#355
keewis wants to merge 3 commits into
xarray-contrib:mainfrom
keewis:custom-backend

Conversation

@keewis

@keewis keewis commented Jun 9, 2026

Copy link
Copy Markdown
Member

This is currently tested using the gif I've attached (no unit tests, yet), but this can definitely be extended to other image formats.

cc @eni-awowale, @VeckoTheGecko

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

❌ Deploy failed

PR preview ❌ Failed ❌ Failed
🔗 Preview https://xarray-contrib-xarray-tutorial-preview-pr-355.surge.sh (may be unavailable)
📝 Commitc5f8170
🪵 LogsView logs
📋 Build log (last lines)
npm warn exec The following package was not found and will be installed: surge@0.27.4

   Running as scottyh@uw.edu (Student)

        project: ./html
         domain: xarray-contrib-xarray-tutorial-preview-pr-355.surge.sh
           size: 409 files, 29.9 MB


/home/runner/.npm/_npx/23158936acd5c32d/node_modules/surge/lib/middleware/deploy.js:229
    helpers.log("   Processing Error:".yellow, payload.error.filename).log()
                                                             ^

TypeError: Cannot read properties of undefined (reading 'filename')
    at EventEmitter.<anonymous> (/home/runner/.npm/_npx/23158936acd5c32d/node_modules/surge/lib/middleware/deploy.js:229:62)
    at EventEmitter.emit (node:events:519:28)
    at IncomingMessage.<anonymous> (/home/runner/.npm/_npx/23158936acd5c32d/node_modules/surge-stream/lib/stream.js:183:17)
    at IncomingMessage.emit (node:events:531:35)
    at emitErrorNT (node:internal/streams/destroy:170:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)

Node.js v22.22.3

🤖 Powered by surge-preview

@keewis

keewis commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

instead of imageio this could also use moviepy to support video formats, not just static images / gifs.

Edit: if we list the relevant API somewhere (moviepy or imageio), writing a custom backend could also become a fun exercise.

@ianhi

ianhi commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

This is great. Such a good idea y'all had to extend like this.

we can maybe extend the metaphor a big by also pulling in gif metadata into attrs? Or even into coords/indexes

@VeckoTheGecko

Copy link
Copy Markdown
Contributor

Time to load the gifs from Giphy into a Datatree where branch nodes are categories of gifs 😈
(Jk...unless)

@keewis

keewis commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Such a good idea y'all had to extend like this.

AFAIR that credit goes to @eni-awowale.

Either way, sounds good to me. We're already pulling gif metadata into variable attributes (duration and background), but we can definitely go further. I just didn't have a gif with more metadata, but that should be easy enough to change. What would you define as coords? I was thinking duration could become a RangeIndex instance, tying to the custom indexes section (we have duration and n_images), possibly with a PintIndex for units?.

Time to load the gifs from Giphy into a Datatree where branch nodes are categories of gifs 😈

That's actually quite a good idea... Obviously, these gifs will be too numerous to fit so we'll have to select a small-ish number, but writing a open_datatree should work.

Something else I was wondering is how to decode the colour data. Right now, I just load the colour channels individually, but it should also be possible to interpret these 24 bits as a float32.

If you go with movie formats you'd also have the audio channels, which can be decoded into separate variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants