To create a web page capable of accessing the Zarr data in the cloud we will utilize VueJS. The Vue CLI will help bootstrap the creation of a new project.
Copy npm install -g @vue/cli @vue/cli-service-global
We use the Zarr.js typescript library to directly access our data living in the Amazon S3 Zarr store
Copy <template>
<div class="zarr-test">
</div>
</template>
<script>
import { openArray, slice } from "zarr";
const BUCKET_URL = "https://cires.s3-us-west-2.amazonaws.com/version2"
export default {
name: 'zarr-test',
data() {
return {
zarr: null,
dimension: null,
zarrData: null,
}
},
created () {
const response = this.getZarr().then(data => {
this.zarr = data;
});
console.log(response);
},
methods : {
getZarr : async() => {
return openArray({ store: BUCKET_URL, path: "/gu1002", mode: "r" });
}
},
watch: {
zarr: function (val) {
this.dimension = val.meta.shape
this.zarr.get([0, 1, slice(null)]).then(d => {
this.zarrData = d
console.log(d.data);
});
// const chunk = this.getZarrData();
// console.log(chunk.shape)
},
}
}
</script>
<style></style>