Public
Edited
Feb 10
4 forks
Insert cell
Insert cell
//Load the API module
je = require("https://data.earth.jaxa.jp/api/javascript/v1.2.3/jaxa.earth.umd.js");
Insert cell
Insert cell
Insert cell
//Date for observation

//The newest data will be get.
date = new Date();

//Specified date
// date = new Date(Date.UTC(2023,3-1,1)); //year, month-1 ,day
Insert cell
//Bounding box of the area for observation
bbox = [-180,-30,0,30]; //west, south, east, north
Insert cell
Insert cell
Insert cell
image1 = await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds2/cog/v1/JAXA.G-Portal_GCOM-W.AMSR2_standard.L3-SST.nighttime.v4_global_daily/collection.json",
band: "SST",
bbox,
date,
width: 300, //pixel
height: 100, //pixel
colorMap: {
min: 14,
max: 32,
colors: "jet",
},
});
Insert cell
image1.getFormattedDate();
Insert cell
image1.getCanvas();
Insert cell
image1.getLegend(300,20,10); //width, height, text size
Insert cell
Insert cell
Insert cell
image2 = await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds2/cog/v1/JMA_COBE-SST-interpolation_SST.v2_global_daily-normal/collection.json",
band: "SST",
bbox,
date: image1.getDate(),
width: 300,
height: 100,
colorMap: {
min: 14,
max: 32,
colors: "jet",
},
});
Insert cell
image2.getFormattedDate();
Insert cell
image2.getCanvas();
Insert cell
image2.getLegend(300,20,10);
Insert cell
Insert cell
Insert cell
image3 = new je.CompositeImage({

//Input images to composite
images: [image1, image2],

//All pixels will be calculated by the operation function
operation: (value_of_image1, value_of_image2) => value_of_image1 - value_of_image2,
colorMap: {
min: -3,
max: 3,
colors: "jet",
},

//Unit of the calculated value
unit: "degC",
});
Insert cell
image3.getCanvas()
Insert cell
image3.getLegend(300,20,10);
Insert cell
Insert cell
Insert cell
bbox_nino3 = [-150,-5,-90,5];
Insert cell
Insert cell
image1_nino3 = await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds2/cog/v1/JAXA.G-Portal_GCOM-W.AMSR2_standard.L3-SST.nighttime.v4_global_daily/collection.json",
band: "SST",
bbox: bbox_nino3,
date,
width: 300,
height: 50,
colorMap: {
min: 14,
max: 32,
colors: "jet",
},
});
Insert cell
image1_nino3.getCanvas()
Insert cell
image1_nino3.getLegend(300,20,10);
Insert cell
Insert cell
image2_nino3 = await je.getImage({
collection: "https://s3.ap-northeast-1.wasabisys.com/je-pds2/cog/v1/JMA_COBE-SST-interpolation_SST.v2_global_daily-normal/collection.json",
band: "SST",
bbox: bbox_nino3,
date: image1_nino3.getDate(),
width: 300,
height: 50,
colorMap: {
min: 14,
max: 32,
colors: "jet",
},
});
Insert cell
image2_nino3.getCanvas()
Insert cell
image2_nino3.getLegend(300,20,10);
Insert cell
Insert cell
image3_nino3 = new je.CompositeImage({
images: [image1_nino3, image2_nino3],
operation: (value_of_image1_nino3, value_of_image2_nino3) => value_of_image1_nino3 - value_of_image2_nino3,
colorMap: {
min: -3,
max: 3,
colors: "jet",
},
unit: "degC",
});
Insert cell
image3_nino3.getCanvas()
Insert cell
image3_nino3.getLegend(300,20,10);
Insert cell
Insert cell
//Mean value of the image3_nino3
mean = je.data.globalStat(image3_nino3.getData()).mean
Insert cell
Insert cell
Insert cell
Insert cell
plotData = {
//Float32Array
const validData = image3_nino3.getData().data.filter(e => !isNaN(e));
const plotData = [];
for(let i=0;i<validData.length;i++){
plotData.push({"SST": validData[i]});
}
return plotData;
}
Insert cell
Plot.plot({
x: {
grid: true
},
y: {
grid: true
},
color: {
legend: true
},
grid: true,
marks: [
Plot.rectY(plotData, Plot.binX({y: "count"}, {x: "SST"})),
Plot.ruleY([0])
]
})
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