NCAS-CMS / PyActiveStorage

Python implementation of Active Storage
2 stars 2 forks source link

Use a temporary file for Zarr group JSON #135

Closed markgoddard closed 1 year ago

markgoddard commented 1 year ago

When using multiple netCDF files with the same names, the Zarr group JSON file would previously not be overwritten after it was first written. This would lead to subsequent uses potentially using an invalid Zarr group metadata file.

This change switches to use a temporary file to store the Zarr group metadata. This should not be a problem because the Zarr datasource is cached in the Active object as the _zds member between operations.

Closes #134

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.10% :tada:

Comparison is base (8adf0f0) 86.53% compared to head (4ed6003) 86.63%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #135 +/- ## ========================================== + Coverage 86.53% 86.63% +0.10% ========================================== Files 8 8 Lines 594 591 -3 ========================================== - Hits 514 512 -2 + Misses 80 79 -1 ``` | [Files Changed](https://app.codecov.io/gh/valeriupredoi/PyActiveStorage/pull/135?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Valeriu+Predoi) | Coverage Δ | | |---|---|---| | [activestorage/netcdf\_to\_zarr.py](https://app.codecov.io/gh/valeriupredoi/PyActiveStorage/pull/135?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Valeriu+Predoi#diff-YWN0aXZlc3RvcmFnZS9uZXRjZGZfdG9femFyci5weQ==) | `86.95% <100.00%> (+1.24%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.