11``` {r}
22library(Ipaper)
33library(data.table)
4-
54library(tidymet)
65library(lubridate)
76library(terra)
@@ -30,11 +29,11 @@ df_mat2 = df_mat[year(date) >= 1960]
3029## 1. 数据量过大,每年单独处理
3130
3231``` {r}
33- cdd = 500
34- # l = cal_weight(X, range, res=cellsize, cdd = cdd, wFUN = "wFUN_adw")
35- # weight = do.call(rbind, l) %>% as.data.table()
36- r <- spInterp_adw(X, Y, range, res = cellsize, cdd = cdd)
37- print(str(r))
32+ # cdd = 500
33+ # # l = cal_weight(X, range, res=cellsize, cdd = cdd, wFUN = "wFUN_adw")
34+ # # weight = do.call(rbind, l) %>% as.data.table()
35+ # r <- spInterp_adw(X, Y, range, res = cellsize, cdd = cdd)
36+ # print(str(r))
3837```
3938
4039
@@ -43,14 +42,17 @@ print(str(r))
4342> 只做目标区域的插值
4443
4544``` {r}
46- cellsize = 0.01
45+ # bbox(105.62916666665245, 28.827500000006523, 116.74499999997568, 34.548333333334654)
46+ range <- c(105, 117, 28, 35)
47+ # poly <- st_rect(range)
48+ # write_shp(poly, "湖北_shape.shp")
49+ cellsize = 0.05
4750range = st_range(basin, cellsize)
4851
4952ra = make_rast(range, cellsize)
5053values(ra) = 1:size(ra)
51-
52- plot(ra)
53- plot(vect(basin), add=TRUE)
54+ # plot(ra)
55+ # plot(vect(basin), add=TRUE)
5456```
5557
5658
@@ -75,6 +77,7 @@ print(str(r))
7577## 3. 转为nc文件
7678
7779``` {r}
80+ # 之前只做了官山
7881res <- r %$% cbind(coord, predicted)
7982ra <- rast(res, extent = ext(range))
8083
@@ -88,7 +91,6 @@ writeCDF(ra, fout, "prcp", "precipitation", "mm/h",
8891 overwrite = TRUE)
8992```
9093
91-
9294### 日降水
9395
9496``` {r}
0 commit comments