Parameters#666
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces state sharing and persistence features, allowing users to export and restore their application state (including local NetCDF and Zarr files saved via IndexedDB) through URL parameters. Key feedback highlights critical improvements to robustness and correctness: wrapping URL state parsing in try-catch blocks with proper null checks, resolving an IndexedDB key mismatch when saving NetCDF files, providing fallback values for optional chaining in axis calculations to avoid NaN values, correcting a typo in the serialized plot state keys, and cleaning up the Three.js camera reference to prevent memory leaks.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
This update adds a button and back-end for saving and restoring plots based on states.
Clicking this button copies all of the current settings to URL. This also opens things up to being more easily compatible with a coding library eventually.
At the moment it is crazy long. Will update it later to only save the states that are changed from default values.
At the moment it doesnt work with local zarr files through the Browser. Or local NetCDF from Julia. Julia will be fairly easily fixable. Local Zarr through browser may not be easily doable.
Future: Will add more information in the menu informign what's going on. As well as downloading a file
json/yamlto upload instead of having to store the url somewhere.example:
https://browzarr.io/latest/?data=%7B%22globalState%22%3A%7B%22initStore%22%3A%22https%3A%2F%2Fs3.bgc-jena.mpg.de%3A9000%2Fesdl-esdc-v3.0.2%2Fesdc-16d-2.5deg-46x72x1440-3.0.2.zarr%22%2C%22storeFromURL%22%3Afalse%2C%22variable%22%3A%22air_temperature_2m%22%7D%2C%22plotState%22%3A%7B%22pointSize%22%3A5%2C%22scalePoints%22%3Afalse%2C%22scaleIntensity%22%3A1%2C%22timeScale%22%3A1%2C%22valueRange%22%3A%5B0%2C1%5D%2C%22xRange%22%3A%5B-1%2C1%5D%2C%22yRange%22%3A%5B-1%2C1%5D%2C%22zRange%22%3A%5B-1%2C1%5D%2C%22showPoints%22%3Atrue%2C%22linePointSize%22%3A2%2C%22lineWidth%22%3A1.25%2C%22lineColor%22%3A%22%23111111%22%2C%22pointColor%22%3A%22%23EA8686%22%2C%22useLineColor%22%3Afalse%2C%22lineResolution%22%3A3%2C%22cOffset%22%3A0%2C%22cScale%22%3A1%2C%22useFragOpt%22%3Afalse%2C%22useCustomColor%22%3Afalse%2C%22useCustomPointColor%22%3Afalse%2C%22transparency%22%3A0%2C%22nanTransparency%22%3A1%2C%22nanColor%22%3A%22%23000000%22%2C%22showBorders%22%3Afalse%2C%22borderColor%22%3A%22%23000000%22%2C%22lonExtent%22%3A%5B-180%2C180%5D%2C%22latExtent%22%3A%5B-90%2C90%5D%2C%22originalExtent%22%3A%7B%22x%22%3A-180%2C%22y%22%3A180%2C%22z%22%3A-90%2C%22w%22%3A90%7D%2C%22lonResolution%22%3A1%2C%22latResolution%22%3A1%2C%22colorIdx%22%3A0%2C%22vTransferRange%22%3Afalse%2C%22vTransferScale%22%3A1%2C%22sphereResolution%22%3A10%2C%22displacement%22%3A0%2C%22displaceSurface%22%3Atrue%2C%22offsetNegatives%22%3Atrue%2C%22zSlice%22%3A%5B0%2Cnull%5D%2C%22ySlice%22%3A%5B0%2Cnull%5D%2C%22xSlice%22%3A%5B0%2Cnull%5D%2C%22interpPixels%22%3Afalse%2C%22useOrtho%22%3Afalse%2C%22rotateFlat%22%3Afalse%2C%22coarsen%22%3Afalse%2C%22kernel%22%3A%7B%22kernelDepth%22%3A1%2C%22kernelSize%22%3A1%7D%2C%22useBorderTexture%22%3Afalse%2C%22maskValue%22%3A0%2C%22borderWidth%22%3A0.05%2C%22cameraPosition%22%3A%7B%22x%22%3A-3.780967105888259%2C%22y%22%3A-1.5251678420343258%2C%22z%22%3A-2.8945035494563265%7D%2C%22disablePointScale%22%3Afalse%7D%2C%22zarrState%22%3A%7B%22zSlice%22%3A%5B0%2C322%5D%2C%22ySlice%22%3A%5B0%2Cnull%5D%2C%22xSlice%22%3A%5B0%2Cnull%5D%2C%22compress%22%3Afalse%2C%22useNC%22%3Afalse%2C%22fetchNC%22%3Afalse%2C%22coarsen%22%3Afalse%2C%22kernelSize%22%3A2%2C%22kernelDepth%22%3A2%2C%22icechunkOptions%22%3Anull%2C%22fetchOptions%22%3Anull%2C%22fetchKey%22%3A0%7D%7D