[Rnomads-user] Issue with using multiple Lat/Lon. Not sure what is causing it.

Ruben Kertesz rkertesz at emnet.net
Tue Mar 1 01:03:13 CET 2016


Good evening,

I have been using rNOMADS for some rainfall work and am happy to say that it is very powerful! Today I ran into an issue where I can’t use multiple lat/lon values for the RTModelProfile function. Actually, I can if they are very close to (-79.052104, 35.907553 - lon/lat). I would like to ask if anyone has insight into why this is happening.

First of all, I put my code up to pastebin here: http://pastebin.com/WyVn84bp
The issue is showing up in BuildProfile. The code is reproduced here. I get valid values in layer.img when using the single x/y.

  if (spatial.average) {
        for (k in seq_len(length(gridded.data$levels))) {
            for (j in seq_len(length(gridded.data$variables))) {
                layer.img <- t(rbind(as.vector(cart.pts$x), as.vector(cart.pts$y[nrow(cart.pts$y):1,
                  ]), as.vector(t(gridded.data$z[k, j, , ]))))
                profile.data[k, j] <- MBA::mba.points(layer.img,
                  cbind(0, 0))[[1]][3]
            }

If I use this:
lon <- c(-79.052104)#, -78.010020)
lat <- c(35.907553)#, 36.000200)

Then I get this in layer.img:


            [,1]       [,2] [,3]

 [1,] -102.02596 -129.16620    0

 [2,] -102.68684  -73.50205    0

 [3,] -103.33989  -17.83809    0

 [4,] -103.98508   37.82569    0

 [5,] -104.62235   93.48929    0

 [6,]  -57.42160 -129.57281    0

 [7,]  -57.79351  -73.91126    0

 [8,]  -58.16101  -18.24976    0

 [9,]  -58.52409   37.41168    0

[10,]  -58.88271   93.07305    0

[11,]  -12.81848 -129.75192    0

[12,]  -12.90150  -74.09151    0

[13,]  -12.98354  -18.43110    0

[14,]  -13.06459   37.22931    0

[15,]  -13.14464   92.88971    0

[16,]   31.78435 -129.70356    0

[17,]   31.99021  -74.04284    0

[18,]   32.19362  -18.38214    0

[19,]   32.39459   37.27855    0

[20,]   32.59308   92.93921    0

[21,]   76.38788 -129.42772    0

[22,]   76.88265  -73.76524    0

[23,]   77.37156  -18.10286    0

[24,]   77.85458   37.55941    0

[25,]   78.33167   93.22158    0


BUT If I use this:
lon <- c(-79.052104, -78.010020)
lat <- c(35.907553, 36.000200)

Then I get this. The NA causes all sorts of problems. I ran out of steam to try and figure out why this is happening.


            [,1]       [,2] [,3]

 [1,] -101.50132 -141.10061   NA

 [2,] -102.16831  -85.43643    0

 [3,] -102.82751  -29.77243    0

 [4,] -103.47889   25.89139    0

 [5,] -104.12238   81.55503    0

 [6,] -104.75795  137.21848   NA

 [7,]  -57.12636 -141.50666    0

 [8,]  -57.50171  -85.84509    0

 [9,]  -57.87267  -30.18358    0

[10,]  -58.23923   25.47787    0

[11,]  -58.60135   81.13926    0

[12,]  -58.95901  136.80059    0

[13,]  -12.75258 -141.68551    0

[14,]  -12.83637  -86.02510    0

[15,]  -12.91917  -30.36469    0

[16,]  -13.00100   25.29572    0

[17,]  -13.08183   80.95612    0

[18,]  -13.16167  136.61652    0

[19,]   31.62094 -141.63722    0

[20,]   31.82869  -85.97649    0

[21,]   32.03402  -30.31579    0

[22,]   32.23692   25.34490    0

[23,]   32.43735   81.00557    0

[24,]   32.63532  136.66622    0

[25,]   75.99511 -141.36177    0

[26,]   76.49445  -85.69927    0

[27,]   76.98796  -30.03687    0

[28,]   77.47562   25.62543    0

[29,]   77.95737   81.28762    0

[30,]   78.43319  136.94971    0

[31,]  120.37085 -140.85909    0

[32,]  121.16188  -85.19335    0

[33,]  121.94369  -29.52787    0

[34,]  122.71621   26.13736    0

[35,]  123.47939   81.80233    0

[36,]  124.23317  137.46704    0

[37,]  164.74907 -140.12908    0

[38,]  165.83197  -84.45864    0

[39,]  166.90224  -28.78867    0

[40,]  167.95981   26.88082    0

[41,]  169.00459   82.54982    0

[42,]  170.03650  138.21833    0


Any help is greatly appreciated!

Ruben Kertesz, Ph.D.
Environmental Engineer
EmNet LLC
121 S. Niles Ave.
Suite #22
South Bend, IN 46617
Office: 574.855.1012 x115

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rnomads-user/attachments/20160301/762341c1/attachment-0001.html>


More information about the Rnomads-user mailing list