Public
Edited
Feb 10
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 = {
const lng = 140;
const lat = 35;
const dl = 20;
return [lng - dl, lat - dl, lng + dl, lat + dl]; //west, south, east, north
}
Insert cell
width = 300;
Insert cell
height = 300;
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,
height,
colorMap: {
min: 10,
max: 35,
colors: "jet",
},
});
Insert cell
image1.getFormattedDate();
Insert cell
image1.getCanvas();
Insert cell
image1.getLegend(300,20,10); //width, height, text size
Insert cell
//Mean 平均値
je.data.globalStat(image1.getData()).mean
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,
height,
colorMap: {
min: 10,
max: 35,
colors: "jet",
},
});
Insert cell
image2.getFormattedDate();
Insert cell
image2.getCanvas();
Insert cell
image2.getLegend(300,20,10);
Insert cell
//Mean 平均値
je.data.globalStat(image2.getData()).mean
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: -6,
max: 6,
colors: "jet",
},

//Unit of the calculated value
unit: "degC",
});
Insert cell
image3.getCanvas()
Insert cell
image3.getLegend(300,20,10);
Insert cell
//Mean 平均値
je.data.globalStat(image3.getData()).mean
Insert cell
Insert cell
Insert cell
plotData = {
//Float32Array
const validData = image3.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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more