nasa-jpl / its_live_production

A NASA MEaSUREs project to provide automated, low latency, global glacier flow and elevation change datasets
MIT License
17 stars 6 forks source link

Rename V2 datacubes to have names consistent with composites #21

Open mliukis opened 10 months ago

mliukis commented 10 months ago

Currently used naming convention for the datacubes http://its-live-data.s3.amazonaws.com/datacubes/v2/S50W070/ITS_LIVE_vel_EPSG32718_G0120_X450000_Y4450000.zarr should be changed to be consistent with corresponding composites: http://its-live-data.s3.amazonaws.com/datacubes/v2/S50W070/ITS_LIVE_**velocity**_EPSG32718_**120m**_X450000_Y4450000.zarr

To change global attributes within each of the datacubes in place (thanks to Alex Goodman: I think actually you might not even need to specify mode and the cube will just be writable by default):

import s3fs
import zarr
fs = s3fs.S3FileSystem(key=<aws_access_key_id>, 
                       secret=<aws_secret_access_key>,
                       token=<aws_session_token>)
mapper = fs.get_mapper(<new_s3_url>)
g = zarr.open(mapper, mode='a')
g.attrs['s3'] = <new_s3_url>
g.attrs['url'] = <new_https_url>