Public
Edited
Feb 10
1 fork
Insert cell
Insert cell
je = require("https://data.earth.jaxa.jp/api/javascript/v1.2.3/jaxa.earth.umd.js");
Insert cell
bbox = {
//関東中部地方
const lng = 138;
const lat = 36;
const dl = 3.5;

//九州地方
// const lng = 130;
// const lat = 32;
// const dl = 2.2;
return [lng - dl,lat - dl,lng + dl,lat + dl]; //[west, south, east, north]
}
Insert cell
Insert cell
data1 = (await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds/cog/v1/NASA.EOSDIS_Terra.MODIS_MOD11C1-LST.daytime.v061_global_half-monthly/collection.json",
date: new Date(Date.UTC(2023, 3-1, 1)),

band: "LST",
width: 300,
height: 300,
bbox,
})).getData();
Insert cell
//-5~35℃を表示するためのカラーマップを作成(データはケルビン単位のため273.15を加算)
cmap1 = new je.image.ColorMap(-5 + 273.15,35 + 273.15,"jet");
Insert cell
image1 = je.image.createImage(data1,cmap1).getCanvas();
Insert cell
Insert cell
mean1 = je.data.globalStat(data1).mean - 273.15
Insert cell
Insert cell
Insert cell
data2 = (await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds/cog/v1/NASA.EOSDIS_Terra.MODIS_MOD11C1-LST.daytime.v061_global_half-monthly-normal/collection.json",
date: new Date(Date.UTC(2023, 3-1, 1)),

band: "LST_2012_2021",
width: 300,
height: 300,
bbox,
})).getData();
Insert cell
image2 = je.image.createImage(data2,cmap1).getCanvas();
Insert cell
Insert cell
mean2 = je.data.globalStat(data2).mean - 273.15
Insert cell
Insert cell
Insert cell
//data1 - data2のデータを作成
data3 = {
const data = new Float32Array(data1.data.length);
for(let i=0;i<data.length;i++) data[i] = data1.data[i] - data2.data[i];
return {
data,
width: data1.width,
height: data1.height,
bbox: data1.bbox,
photometricInterpretation: data1.photometricInterpretation, //画像作成のために必要です
};
}
Insert cell
//-16~16℃を青~白~赤に塗るカラーバーを作成
cmap3 = new je.image.ColorMap(-16,16,["#0000ff","#ffffff","#ff0000"]);
Insert cell
image3 = je.image.createImage(data3, cmap3).getCanvas();
Insert cell
Insert cell
mean3 = je.data.globalStat(data3).mean
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more