Skip to content

Commit

Permalink
Update gp to 7.0.1. Fix genSketchTable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
avmey committed Feb 4, 2025
1 parent 21144c3 commit 46a61b9
Show file tree
Hide file tree
Showing 19 changed files with 281 additions and 560 deletions.
26 changes: 21 additions & 5 deletions data/bin/genCog4326.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { $ } from "zx";

import datasources from "../../project/datasources.json";
import datasources from "../../project/datasources.json" with { type: "json" };
import project from "../../project/projectClient.js";

// NEARSHORE HABITAT
Expand All @@ -18,17 +17,34 @@ import project from "../../project/projectClient.js";
// await $`rm ${warpDst}`;
// console.log(`Finished reimporting ${datasource.datasourceId}`);

project.getMetricGroup("renewableEnergy").classes.forEach(async (curClass) => {
// OFFSHORE HABITAT
const offshore = project.getMetricGroup("offshoreHabitat");
for (const curClass of offshore.classes) {
const datasource = datasources.find(
(d) => d.datasourceId === curClass.datasourceId!,
);
console.log(`Reimporting ${curClass.datasourceId}`);
if (!datasource) throw new Error(`Datasource ${curClass} not found`);
if (!datasource) throw new Error(`Datasource ${datasource} not found`);
const src = datasource?.src;
const warpDst = "data/dist/" + datasource.datasourceId + "_4326.tif";
const dst = "data/dist/" + datasource.datasourceId + ".tif";
await $`gdalwarp -t_srs "EPSG:4326" -dstnodata ${datasource?.noDataValue} --config GDAL_PAM_ENABLED NO --config GDAL_CACHEMAX 500 -wm 500 -multi -wo NUM_THREADS=ALL_CPUS ${src} ${warpDst}`;
await $`gdal_translate -b ${datasource?.band} -r nearest --config GDAL_PAM_ENABLED NO --config GDAL_CACHEMAX 500 -co COMPRESS=LZW -co NUM_THREADS=ALL_CPUS -of COG -stats ${warpDst} ${dst}`;
await $`rm ${warpDst}`;
console.log(`Finished reimporting ${datasource.datasourceId}`);
});
}

// project.getMetricGroup("renewableEnergy").classes.forEach(async (curClass) => {
// const datasource = datasources.find(
// (d) => d.datasourceId === curClass.datasourceId!,
// );
// console.log(`Reimporting ${curClass.datasourceId}`);
// if (!datasource) throw new Error(`Datasource ${curClass} not found`);
// const src = datasource?.src;
// const warpDst = "data/dist/" + datasource.datasourceId + "_4326.tif";
// const dst = "data/dist/" + datasource.datasourceId + ".tif";
// await $`gdalwarp -t_srs "EPSG:4326" -dstnodata ${datasource?.noDataValue} --config GDAL_PAM_ENABLED NO --config GDAL_CACHEMAX 500 -wm 500 -multi -wo NUM_THREADS=ALL_CPUS ${src} ${warpDst}`;
// await $`gdal_translate -b ${datasource?.band} -r nearest --config GDAL_PAM_ENABLED NO --config GDAL_CACHEMAX 500 -co COMPRESS=LZW -co NUM_THREADS=ALL_CPUS -of COG -stats ${warpDst} ${dst}`;
// await $`rm ${warpDst}`;
// console.log(`Finished reimporting ${datasource.datasourceId}`);
// });
Loading

0 comments on commit 46a61b9

Please sign in to comment.