File tree 1 file changed +25
-0
lines changed 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 1
1
import json
2
+ import logging
2
3
import os
3
4
import shutil
4
5
from pathlib import Path
@@ -92,6 +93,30 @@ def zenodo_zarr(testdata_path, tmpdir_factory):
92
93
)
93
94
shutil .move (str (rootfolder / zarrname ), str (folder ))
94
95
96
+ # Fix a wrong piece of metadata
97
+ zattrs_path = folder / "B/03/0/.zattrs"
98
+ logging .warning (
99
+ f"Update coordinateTransformations in { str (zattrs_path )} , "
100
+ "see https://github.com/fractal-analytics-platform/"
101
+ "fractal-tasks-core/issues/420."
102
+ )
103
+ with zattrs_path .open ("r" ) as f :
104
+ zattrs = json .load (f )
105
+ for ind , ds in enumerate (zattrs ["multiscales" ][0 ]["datasets" ]):
106
+ new_ds = ds .copy ()
107
+ old_transf = ds ["coordinateTransformations" ][0 ]
108
+ new_transf = old_transf .copy ()
109
+ assert old_transf ["type" ] == "scale"
110
+ assert len (old_transf ["scale" ]) == 3
111
+ new_transf ["scale" ] = [1.0 , * old_transf ["scale" ]]
112
+ new_ds ["coordinateTransformations" ][0 ] = new_transf
113
+ assert len (new_transf ["scale" ]) == len (
114
+ zattrs ["multiscales" ][0 ]["axes" ]
115
+ )
116
+ zattrs ["multiscales" ][0 ]["datasets" ][ind ] = new_ds
117
+ with zattrs_path .open ("w" ) as f :
118
+ json .dump (zattrs , f )
119
+
95
120
folders = [str (f ) for f in folders ]
96
121
97
122
return folders
You can’t perform that action at this time.
0 commit comments