R语言对河南省PM25的ADW空间插值

中科白癜风公益惠民活动 https://m-mip.39.net/baidianfeng/mipso_6359028.html
本文仅以ADW空间插值为例,核密度空间插值、克里金(Kriging)空间插值及反距离权重(IDW)空间插值请参考往期推文源代码自行修改,本文不再累述。文中以猫猫老家河南省个PM25地面监测站点数据为例进行插值分析。

##loadpackageslibrary(ggplot2)library(ADW)TempBrazil-read.csv("F:/Rpeng/32/data/henan_pm25.csv")LonLat=TempBrazil[,1:2]#Data.framewithLongtudeandLatitudeTemp=TempBrazil[,3]#VectorwithobservationsinpointsLonInterval=c(,)#CoordinatesofextremespoinsoflongitudetogridLatInterval=c(31,37)#CoordinatesofextremespoinsoflatitudetogridInterpoled=ADW(xy=LonLat,z=Temp,xrange=LonInterval,yrange=LatInterval,res=0.01)#library(maptools)setwd("F:/Rpeng/32/data")#tz.contour-readShapePoly("henan_city.shp")#usethistocliplibrary(rgdal)tz.contour-readOGR("henan_province.shp")#usethistocliptz.contour.dfr-fortify(tz.contour,region="name")#usethistoplotlibrary(raster)idw.r-rasterFromXYZ(Interpoled[,c("Longitude","Latitude","Variable")])idw.crp-crop(idw.r,tz.contour)idw.msk-mask(idw.crp,tz.contour)idw.msk.dfr-as.data.frame(rasterToPoints(idw.msk))names(idw.msk.dfr)[1:2]-c("Longitude","Latitude")##nowplot:3library(ggspatial)ggplot()+geom_tile(data=idw.msk.dfr,alpha=0.8,aes(x=Longitude,y=Latitude,fill=round(Variable,0)))+annotation_scale(location="bl")+annotation_north_arrow(location="tr",which_north="false",style=north_arrow_fancy_orienteering)+scale_fill_gradientn(colors=rev(rainbow()))+geom_path(data=tz.contour.dfr,aes(long,lat,group=group),color="grey")+labs(fill="PM2.5",title="PM2.5inHeNanProvince")+coord_equal()+scale_x_continuous(expand=c(0,0))+scale_y_continuous(expand=c(0,0))+theme_bw()

获取本文代码和数据的途径:

气象水文科研猫



转载请注明地址:http://www.sanbaicaoasb.com/scls/8481.html
  • 上一篇文章:
  • 下一篇文章: 没有了
  • 热点文章

    • 没有热点文章

    推荐文章

    • 没有推荐文章