0

我目前正在使用专注于Fire Danger Indices的 NETCDF 数据集。使用netcdf4fields库,我创建了以下可视化:( 火灾天气指数使用image.plot函数)

问题是这张地图以太平洋为中心(PC),我要求它以子午线为中心(MC),因为我希望使用特定的纬度和经度(北纬 8°4' 到 37°6')提取印度国家的信息北纬 68°7' 至东经 97°25')。

我尝试使用与用于 MC 地图的坐标相同的坐标,但输出如下火灾天气指数(诅咒)

相同的代码如下:

library(ncdf4)
library(fields)

data <- nc_open(file.choose())


#extracting longitudes and latitudes for mapping
long <- ncvar_get(data, "longitude")
lati <- ncvar_get(data, "latitude")

x <- which(long > 68.7)
long <- long[x]
x <- which(long < 97.25)
long <- long[x]

x <- which(lati > 8.4)
lati <- lati[x]
x <- which(lati < 37.6)
lati <- lati[x]


#sorting longitudes and latitudes 
longs <- sort(long)
latis <- sort(lati)

#extracting the 3 variables in the dataset on the bases of: longitude, latitude, time
bui <- ncvar_get(data, "bui", start  = c(68.7, 8.4, 1), count = c(length(long) , length(lati), 1))
c <- ncvar_get(data, "dc", start = c(68.7, 8.4, 1), count = c(length(long) , length(lati), 1))
fwi <- ncvar_get(data, "fwi", start = c(68.7, 8.4, 1), count = c(length(long) , length(lati), 1))


#plotting the variables using image.plot from the fields package and saving them as .png files
png("bui.png", width = 800, height = 1000)
image.plot(longs, latis, bui)
dev.off()

png("dc.png", width = 800, height = 1000)
image.plot(longs, latis, dc)
dev.off()

png("fwi.png", width = 800, height = 1000)
image.plot(longs, latis, fwi)
dev.off()

那么任何人都可以建议一种将 PC 地图转换为 MC 地图或将 MC 坐标转换为 PC 地图的方法吗?提前致谢!

4

0 回答 0