Appendix E — Calculate Aridity Index
この章では、Aridity Index (AI; 乾燥指数) を計算します。 AI は気候の乾燥度を表す指標で、降水量 (precipitation; \(P\)) を潜在蒸発散量 (potential evapotranspiration; \(PET\)) で割った値として定義します (World Atlas of Desertification 1992)。 値が小さいほど、降水量に対して潜在蒸発散量が大きく、乾燥した条件を示します。
乾燥指数には複数の定義がありますが、ここでは以下の式を用います。
\[AI = \frac{P}{PET}\]
ここで、\(P\) は降水量、\(PET\) は潜在蒸発散量です。
ライブラリの読み込み
データの読み込み
このリポジトリの解析では、環境変数 PROJECT_DATA_DIR に入力・出力データの保存先を指定しています。 必要に応じて、適宜変更してください。
data_dir <- Sys.getenv("PROJECT_DATA_DIR")
sf_climate <- readRDS(file.path(
data_dir,
"climate_mesh_data_joined/climate_mesh_data_with_pet.rds"
))Aridity Index の計算
年単位の Aridity Index を計算し、sf_climate オブジェクトに新しい列 aridity_index として追加します。 PET が 0 以下または欠損している場合は、Aridity Index を定義できないため NA とします。
同様に、月ごとの Aridity Index も計算します。 列名は aridity_index_Jan から aridity_index_Dec までの形式にします。
month_labels <- month.abb
for (month in seq_along(month_labels)) {
month_label <- month_labels[month]
precipitation_col <- paste0("precipitation_", month_label)
pet_col <- paste0("PET", month)
aridity_index_col <- paste0("aridity_index_", month_label)
pet_values <- sf_climate[[pet_col]]
sf_climate[[aridity_index_col]] <- ifelse(
is.na(pet_values) | pet_values <= 0,
NA_real_,
sf_climate[[precipitation_col]] / pet_values
)
}データの保存
RDS形式とCSV形式で保存します。 必要に応じて、保存先のパスを変更してください。
saveRDS(
sf_climate,
file.path(
data_dir,
"climate_mesh_data_joined/climate_mesh_data_with_aridity_index.rds"
)
)
df_climate <- st_drop_geometry(sf_climate)
write.csv(
df_climate,
file.path(
data_dir,
"climate_mesh_data_joined/climate_mesh_data_with_aridity_index.csv"
),
row.names = FALSE
)References
World Atlas of Desertification. 1992. UNEP.