Public
Edited
Feb 10
2 forks
Insert cell
Insert cell
//JAXA Earth API for JavaScriptのモジュールを読み込み
je = require("https://data.earth.jaxa.jp/api/javascript/v1.2.3/jaxa.earth.umd.js");
Insert cell
//使用するデータセットを設定
//GSM降雨量の月別平年値 Precipitation Rate (Half-monthly-normal)
//https://data.earth.jaxa.jp/en/datasets/#/id/JAXA.EORC_GSMaP_standard.Gauge.00Z-23Z.v6_half-monthly-normal
collection = "https://s3.ap-northeast-1.wasabisys.com/je-pds/cog/v1/JAXA.EORC_GSMaP_standard.Gauge.00Z-23Z.v6_monthly-normal/collection.json";
Insert cell
//使用するデータセットの中のバンド名を設定
//2012~2021年の月別平均
band = "PRECIP_2012_2021";
Insert cell
//対象とする緯度経度範囲を設定
bbox = {
const center = {lat: 36, lng: 138}; //日本
// const center = {lat: 6, lng: 10}; //アフリカ・サバナ気候
const margin = 10;
return [
center.lng - margin, //West
center.lat - margin, //South
center.lng + margin, //East
center.lat + margin, //North
];
}
Insert cell
//時系列データを取得
images = await je.getTimeSeriesImage({
collection,
band,
bbox,

//取得するデータの期間
start: new Date(2000,0,1), //平年値型のデータセットの場合の年は2000年を指定
end: new Date(2000,11,31), //JavaScriptのDateの引数では、月はMM-1を指定

//取得する画像サイズ
width: 200,
height: 200,

//カラーマップを設定
colorMap: {
min: 0.1,
max: 3,
colors: "jet",
log10: true,
}
});
Insert cell
images[0].getLegend(400, 30, 10);
Insert cell
//2月の状況を可視化
images[1].getCanvas(); //配列上のインデックスは1
Insert cell
//6月の状況を可視化(梅雨の時期の様子)
images[5].getCanvas(); //配列上のインデックスは5
Insert cell
//10月の状況を可視化
images[9].getCanvas(); //配列上のインデックスは9
Insert cell
//グラフ表示用のデータを作成
array = images.map(d => {
const stat = je.data.globalStat(d.data); //月別の各画像内での平均最大最小を算出
return {
"month": parseInt(d.tid),
"max": stat.max,
"mean": stat.mean,
"min": stat.min,
};
});
Insert cell
Plot.plot({
x: {
label: "Month",
grid: true,
},
y: {
label: "Precipitation Rate [mm/h]",
grid: true,
// domain: [0,1.5],
},
marks: [
Plot.line(array, {x: "month", y: "max", stroke: "red"}),
Plot.line(array, {x: "month", y: "mean", strokeWidth: 3}),
Plot.line(array, {x: "month", y: "min", stroke: "blue"}),
]
});
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