克里金空间数据,错误var1.pred NA

时间:2018-07-20 15:42:15

标签: r

嘿,我有一个数据集,其中包含几个采样点的z值,我想对它们进行插值,达到我先前创建和网格化的程度,但是我不断获得var1.pred值的NA。

Error in seq.default(min(z[valid]), max(z[valid]), length = cuts + 1) : 
  'from' must be a finite number
In addition: Warning messages:
1: In min(z[valid]) : no non-missing arguments to min; returning Inf
2: In max(z[valid]) : no non-missing arguments to max; returning -Inf

这是我的代码示例。

#convert to spdf
coordinates(VELOCITY2)<- ~ X + Y
wg<-gstat(id='V', formula = V~1, data=VELOCITY2 )

#variogram
vv<-variogram(wg, cutoff=2000, width=100)
print(plot(vv,plot.numbers=T))

#initial variogram model
vm<-vgm(psill=0.02, range=550, model="Wav", nugget=0.005)
print(plot(vv, model=vm))

#fit variogram
vmf<-fit.variogram(vv,vm)
print(plot(vv, model=vmf))

# points to be interpolated
xx<-seq(from=488300, to=493200, by=100)
yy<-seq(from=9839400, to=9843200, by=100)
xy<-expand.grid(x=xx,y=yy)
coordinates(xy)<- ~ x+y

#ordinary kriging
kk<-krige(V~1, VELOCITY2, newdata=grid, model=vmf)

#plot
spplot(kk, "var1.pred")

我的投诉

    structure(list(X = c(491810.00721276, 492328.97433014, 490911.89327549, 
491615.51887818, 491615.51887818, 492894.620021, 492151.9979203, 
492572.42983547, 492347.61141516, 491363.11382593, 491353.29751125, 
492072.93297881, 490716.22127832, 492001.85406044, 492018.98815452, 
492077.66253205, 492050.13933868, 490972.9839127, 491655.7778789, 
491576.10196219, 492355.7400162, 492297.13259429, 492673.39998931, 
492505.61098796, 492938.89101704, 492796.38161778, 492663.73140998, 
492766.00027009, 492765.78359527, 491933.88466968, 492333.89864649, 
492720.51113432, 492666.86568757, 492667.84225007, 492522.21401529, 
492831.86513802, 492878.85586085, 493201.72451331, 492638.4094498, 
492819.43215484, 492796.76931284, 492747.65005034, 492788.05373669, 
492762.22524575, 492244.6870987, 492264.07015541, 493008.44619315, 
492815.19350734, 492290.80611714, 492277.18886875, 493134.10402992, 
493079.00698391, 493078.7734634, 491865.03127595, 492051.82525174, 
492670.54384925, 492371.64034572, 491846.41277618, 492775.84682769, 
492411.87697905, 492638.79940336, 492638.87569731, 492495.60555568, 
490338.97585592, 490362.31496736, 490377.77810208, 489826.99294604, 
489853.05092929, 489834.89614387, 490306.53786769, 490308.6412613, 
489636.52553863, 489814.82046046, 489667.51345374, 490203.52431788, 
491203.81484533, 491077.79256743, 491073.15243053, 491084.72133938, 
490958.56246482, 490941.8523819, 491050.5864517, 490764.25539687, 
490188.41994785, 490419.69106592, 490424.64284814, 490735.1435195, 
490387.98623199, 489297.98195959, 489300.76955718, 490397.404689, 
489661.53774563, 490894.97121725, 491108.0970718, 491121.07516021, 
490612.02505037, 490615.90676419, 490585.43667157, 490603.01613921, 
490591.97121732, 490535.56215982, 489776.74367816, 489958.02334144, 
490066.17495271, 490031.0577653, 490190.24001607, 490211.20925445, 
490214.70901031, 490003.5550795, 490604.9470475, 491123.82247476, 
489847.73806302, 489976.32595346, 491294.31450964, 491007.18618313, 
490369.37771158, 490354.14687653, 489273.8003189, 493001.10122237, 
489539.64309234, 489012.00149085, 489142.87160796, 488409.5044205, 
489078.66848285, 488976.293483, 489208.90896154, 489567.98757469, 
490259.16079274, 490199.06081707, 490548.30691066, 489506.84939121, 
489507.3984635, 489021.03298499, 488958.65896146, 490198.91372226, 
489139.35891258, 488770.78518218, 488912.45339509, 488981.85549448, 
488921.30666655, 489881.9584, 489672.654689, 489896.83645177, 
489617.50564114, 489919.08864898, 489379.67238921, 491965.57000272, 
491962.99825592, 492682.55996244), Y = c(9840083.34991902, 9839461.79230204, 
9839986.04132536, 9839995.68878658, 9839995.68878658, 9839486.28400126, 
9839853.49933327, 9839540.02081761, 9840596.63605199, 9840110.85284895, 
9840123.81671612, 9839970.95343491, 9840217.59113002, 9840621.88702863, 
9840939.65655981, 9840492.69562223, 9840364.30304425, 9840527.17804416, 
9840153.15948959, 9841067.64777074, 9840733.71222385, 9840674.12726294, 
9841985.09015356, 9841070.55597392, 9841095.72784893, 9841691.20050513, 
9841720.81866902, 9841676.02960665, 9841673.8772629, 9841246.79718484, 
9841422.27277072, 9841223.11749737, 9841990.83136454, 9841994.02765366, 
9841585.87726301, 9841625.27960673, 9841777.00030985, 9841315.42609103, 
9841973.23663798, 9841953.58624746, 9841942.04523162, 9841975.5950365, 
9841921.55109098, 9841756.52179438, 9841803.37823974, 9841535.90655976, 
9841695.74445044, 9841543.94562221, 9842174.64777079, 9842182.19659889, 
9841376.54230196, 9841406.85773171, 9841406.8294114, 9841667.93488034, 
9841949.92609129, 9841973.67413798, 9841897.64874747, 9842246.51398172, 
9842171.76691117, 9841921.16437243, 9842138.53937229, 9842136.97003635, 
9842380.89386459, 9839975.91827856, 9840042.95343491, 9840089.22394263, 
9839589.44562232, 9839978.97296608, 9839972.67706767, 9840000.61749732, 
9840046.62823938, 9840384.73566135, 9840302.14484109, 9840018.78351297, 
9842250.19659889, 9842008.34698953, 9842209.1907394, 9842203.61261452, 
9842217.50519284, 9841646.07648174, 9841683.64679432, 9842192.50519265, 
9842183.09796603, 9842277.04034879, 9841973.30402079, 9841966.2620286, 
9842110.55011467, 9842137.70929444, 9841800.60968466, 9841802.06769271, 
9842097.74445065, 9841639.30499731, 9842195.63995834, 9842542.10675523, 
9842116.55011473, 9841963.44464579, 9841829.30792699, 9841930.18585674, 
9841916.66632539, 9842076.43488016, 9842082.75030963, 9842131.36456766, 
9842160.68292699, 9842132.72687234, 9842139.580388, 9842277.19952862, 
9842102.06183342, 9842101.63605201, 9842143.56085666, 9842095.04718486, 
9841791.23859127, 9842670.9856614, 9843067.83527079, 9841903.34601296, 
9841830.02277074, 9843129.77081764, 9843097.71808326, 9842604.47394268, 
9840407.78644266, 9841952.95148171, 9842186.80011454, 9842038.18195044, 
9841950.33234116, 9841538.57843486, 9842189.03839584, 9842814.41534891, 
9842339.88898166, 9841739.39484119, 9841739.58624731, 9841750.17023162, 
9842428.79816146, 9842966.83429408, 9841471.2981614, 9842028.5803879, 
9841446.35480217, 9841755.92120829, 9842498.21027067, 9842371.99152076, 
9842484.98761453, 9842385.0296069, 9840908.95441133, 9840831.87628639, 
9842363.49738009, 9842105.66730203, 9842228.79132547, 9842178.55792694, 
9840714.60968473, 9841214.43976303, 9842612.580388), V = c(6.8575591273834, 
6.9091981717661, 6.81861092653243, 6.83544315031305, 6.83544315031305, 
6.86928044706404, 6.87308158923757, 6.90102887370632, 6.93656422063757, 
6.82756100389376, 6.8279728230811, 6.86916707425107, 6.88723098934826, 
6.80869108780012, 6.81041873685147, 6.84851460419374, 6.83998564798438, 
6.95597672440102, 6.84830429624437, 6.83571668853121, 6.81554716876882, 
6.81653691949333, 6.86570172920796, 8.4183926299318, 6.82540315375968, 
6.83694453186651, 6.83616001733514, 6.83366932709608, 6.83281519168562, 
6.80657805425162, 6.79252081867902, 6.82804093704906, 6.86560659062316, 
6.86560443487979, 6.81210486339519, 6.83024981887722, 6.85348365590436, 
6.82737621767244, 6.86002774823981, 6.87890401083686, 6.87433304662824, 
6.87310828011749, 6.87227288578899, 6.8406970455203, 6.79788666568234, 
6.79289704147439, 6.84212179617635, 6.82201406577053, 6.85818255251501, 
6.85882147766148, 6.81441839578817, 6.81109679654478, 6.81075562992338, 
6.7695290140362, 6.78453986430733, 6.86470017777305, 6.82941505329464, 
6.80201545646814, 6.89940111534327, 6.83386524913627, 6.88022016259413, 
6.88000932400808, 6.89652613707228, 6.80951701420202, 6.81047007954082, 
6.91318917468862, 6.81620742405261, 6.81609592365983, 6.81555114576811, 
6.82359364040975, 6.82243031847043, 6.74848377545697, 6.77432742350875, 
6.82113095074504, 6.73035636876622, 6.73157311534001, 6.68948620878327, 
6.68804994926179, 6.68991058622174, 6.82298306298922, 6.79655085098109, 
6.67806113435277, 6.67880893125878, 6.67462932793097, 6.76784233910405, 
6.76791677619622, 6.68328242293505, 6.62279457979837, 6.80333643693172, 
6.8017836170837, 6.74582126343433, 6.89705699013895, 6.67169623224357, 
6.71095156872004, 6.70398418262631, 6.74214143831379, 6.77269747758851, 
6.75839168452443, 6.75917136037271, 6.72567955117309, 6.72476400985706, 
6.7940929187327, 6.76465011146018, 6.76185819997855, 6.76483265829331, 
6.73217398985043, 6.7558472215621, 6.75644688026535, 6.76569985187991, 
6.72096268409918, 6.79914751724536, 6.73903734858573, 6.76387478912845, 
6.75057145302792, 6.78523214680787, 6.80514090870779, 6.79610181104104, 
6.94632505323771, 6.87151617920864, 6.73501760825965, 6.8043110280055, 
6.76237168672284, 6.87393143300434, 6.77223974414773, 6.81073018103125, 
6.87291116726081, 6.85121557850258, 6.84429643254038, 6.71871340520001, 
6.80737642861958, 6.87505551354325, 6.78810343307566, 6.77795244044547, 
6.80445829734336, 6.96781526094347, 6.85340711647284, 6.86963847089039, 
6.81734050576888, 6.79958184646059, 6.81761012476222, 7.11505624553277, 
7.10405850051035, 6.74511681211045, 6.82787357725889, 6.75689662271503, 
6.75616848941266, 6.82089585076081, 6.81664705027901, 6.91617186341967
)), .Names = c("X", "Y", "V"), row.names = c(NA, -149L), class = c("tbl_df", 
"tbl", "data.frame"))

0 个答案:

没有答案