t; cnt_pixels = function(s, na.rm = TRUE, ...) {
> # Count number of non NA values in $Value attrib
> sdf = as.data.frame(s)
> if (na.rm) {
> sdf = sdf[complete.cases(sdf),]
> }
> return(length(sdf$Value))
> }
>
> # Using st_apply
> cnt = st_apply(m_stars,
>MARGIN = "DOY",
&g
s/n - Vila Real
> Caceres - MT - CEP 78201-380 (ZIP code)
> Phone: (+55) 65 99686-6970 / (+55) 65 3221-2674
> Lattes CV: http://lattes.cnpq.br/1360403201088680
> OrcID: orcid.org/-0001-8232-6722
> ResearchGate: www.researchgate.net/profile/Alexandre_Santos10
> Publons: https://publons.com/researcher/3085587/alexand
SS=C LC_TELEPHONE=C
> > LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
> > #
> > # attached base packages:
> > # [1] stats graphics grDevices utils datasets methods base
> > #
> > # other attached packages:
> > # [1] raster_3.0-7 sp_1.3-2
> > #
> > # loaded via a
, ymax)
> crs: NA
> names : layer.1, layer.2, layer.3, layer.4, layer.5, layer.6,
> layer.7
> min values : 442.7436, 440.0467, 444.9182, 437.1589, 444.6946, 440.2028,
> 429.6900
> max values : 556.2471, 563.8341, 561.7687, 560.4509, 565.8671, 560.1375,
> 561.7972
mains in memory) to
> see that the indexes are identical (stackApply = ver_median =
> lubridate::wday)
> https://gist.github.com/kokkytos/5d554b5a725bb48d2189e2d1fa0e2206
>
> Thank you again
> On 11/26/19 9:00 PM, Vijay Lulla wrote:
>
> I'm sorry for the miscommunicatio
-11-26_191439_7710_04780.grd
> names : X1, X2, X3, X4, X5,
> X6, X7
> min values : 440.0467, 444.9182, 437.1589, 444.6946, 440.2028, 429.6900,
> 442.7436
> max values : 563.8341, 561.7687, 560.4509, 565.8671, 560.1375, 561.7972,
> 556.2471
&
If you read the code/help for `stackApply` and `zApply` you'll see that the
results that you obtain make sense (at least they seem sensible/reasonable
to me). IMO, if you want to control the ordering of your layers then just
use sapply, like how you've used for ver_mean. IMO, this is the only
Did you try `levelplot(raster(RCP1pctCO2median, 61))`?
On Tue, Oct 29, 2019 at 12:17 AM rain1290--- via R-sig-Geo <
r-sig-geo@r-project.org> wrote:
> Hi there,
> I am trying to create a global plot with median precipitation values. What
> I would like to do is isolate the "median" values and
t;>> Thanks
> >>>> --
> >>>> Micha Silver
> >>>> Ben Gurion Univ.
> >>>> Sde Boker, Remote Sensing Lab
> >>>> cell: +972-523-665918
> >>>> ___
> >>>> R-sig-
ing this with [[]] works really well to create nicely corrected graphs.
>>
>>
>>
>> But fails due it “out of bounds index errors” with regression
>> equations
>>
>>
>>
>> I find this ever so confusing….???
>>
>>
>>
>> Thankyou so much again,
>>
>&
Maybe https://cran.r-project.org/web/packages/spdep/vignettes/nb_igraph.html
can help with all your questions.
https://cran.r-project.org/web/packages/spdep/vignettes/nb_sf.html contains
a little more detail about nb structure. Finally, I encourage you to use
`str` to study the structure of R
uji Sb wrote:
>>
>> > Dear Vijay,
>> >
>> > Thank you again for your reply. I have attached my data for two years
>> and
>> > two variables. Hope they will go through, otherwise the files are also
>> > available here
>> > <
3986143008625, 3.68043269045659, 4.09571655859075,
> 4.57299670034984), year = c(2010, 2020, 2030, 2040, 2050, 2060,
> 2070, 2080, 2090, 2100)), row.names = c(NA, 10L), class = "data.frame")
>
> Sincerely,
>
> Milu
>
> On Wed, Jul 31, 2019 at 9:20 PM Vijay Lulla w
?`rasterFromXYZ` states that "x and y represent spatial coordinates and
must be on a regular grid." And, it appears to me that you might be losing
values by rounding lon/lat values. The help file further suggests that
`rasterize` might be the function you're looking for. List members will
ue, May 7, 2019 at 6:11 PM Vijay Lulla wrote:
>
>> Good one Barry! As far as I'm aware sf uses rgdal to write various file
>> formats and writeOGR has options called dataset_options and layer_options
>> which are considered experimental.
>>
>
> Not quite - `sf`
Good one Barry! As far as I'm aware sf uses rgdal to write various file
formats and writeOGR has options called dataset_options and layer_options
which are considered experimental. Do you know if either of these options
can be used instead of creating a new field/attribute for the sf
dataframe?
It appears that you might have mistakenly typed cbind(103:110, 3:16)
instead of cbind(103:116, 3:16). Regardless, the warning is telling you
that the vectors were of unequal lengths and there was some recycling. You
can learn about recycling rule from searching "recycling rule in R" and
also
+1 from me too for Rolf's nomination!
On Thu, Mar 14, 2019 at 6:43 PM Dexter Locke wrote:
> FWIW: I agree with Rolfs nomination.
>
> +1
>
> -Dexter
> http://dexterlocke.com
>
>
>
> On Thu, Mar 14, 2019 at 5:30 PM Rolf Turner
> wrote:
>
> >
> > On 14/03/19 7:33 AM, Barry Rowlingson wrote:
> >
>
Thanks,
> Alex
>
> On 09/21/2018 12:32 AM, Roger Bivand wrote:
> > On Thu, 20 Sep 2018, Vijay Lulla wrote:
> >
> >> Ok, thanks! While the page provided information about the project and
> >> its
> >> funding status I couldn't find the SQL
Ok, thanks! While the page provided information about the project and its
funding status I couldn't find the SQLite database. Do you happen to know
when this will be available?
On Thu, Sep 20, 2018 at 1:02 PM Roger Bivand wrote:
> On Thu, 20 Sep 2018, Vijay Lulla wrote:
>
> &g
Dear list members,
A few years ago Roger Bivand posted a discussion (
https://stat.ethz.ch/pipermail/r-sig-geo/2015-August/023204.html ) about
consolidating SRS definitions into a SQLite database and I am wondering if
there has been any development along those lines. Specifically, is there
any
e(lon = c(-9, -8, -3), lat = c(-1,
> > 25,
> > 5)),
> > two = data.frame(lon = c(-90), lat = c(-1
> >
> > coordinates(ct$a$one) <- ~lon+lat
> > coordinates(ct$a$two) <- ~lon+lat
> > coordinates(ct$b$one) <-
-
> SpatialPolygons(list(Polygons(list(Polygon(rbind(limmin,limmax))),ID='1')))
> proj4string(spp.farea) <- CRS("+proj=longlat +datum=WGS84")
>
> plot(spp.farea,col="chocolate3",lwd=2,add=T)
>
> # select the squares under the polygon
> fareasq <
You'll have to do clusterExport(cl, c("ll")) before you call parRapply.
Please see ?`parRapply` and pages 10 and 11 of the parallel::parallel
vignette.
HTH,
Vijay.
On Tue, Aug 21, 2018 at 2:54 PM Roman Luštrik
wrote:
> Cross posted on SO:
>
>
y.x), c(utm_x.y,
> utm_y.y))), NA))
>
> dist.mat<-matrix(res$Distance,nrow = 20,ncol = 20)
>
> Data prep for eventually using sf::st_distance:
> pts.utm.sf <- df12 %>%
> st_as_sf(coords=c('X','Y'), crs=4326) %>% #wgs84 long lat
> st_transform(32609) #wgs84 utm zone9
>
Maybe something like this?
poly <- SpatialPolygons(list(Polygons(tapply(seq_len(nrow(vertices)),
vertices$cod,
function(x)
Polygon(vertices[x,1:2])), ID="1")),
And if you need coordinates as part of your data frame just do
cbind(coordinates(x), as.data.frame(x, xy = TRUE))
On Tue, Aug 14, 2018 at 11:50 AM Bede-Fazekas Ákos
wrote:
> Dear Milu,
>
> I think that you are looking for as.data.frame(x, xy = TRUE).
>
> HTH,
> Ákos Bede-Fazekas
> Hungarian
urse,
> any help from anyone else on these kind of issues is highly appreciated.
>
> On 06/12/2018 04:41 PM, Vijay Lulla wrote:
> > Thank you for the explanation of difference between proj.h and proj_api.h
> > and the recommendation of setting environment variable for pkg-config. I
&
, Roger Bivand wrote:
> On Tue, 12 Jun 2018, Vijay Lulla wrote:
>
> I too use R on a mac but I cannot get rgdal to use proj5 (port info proj).
>> rgdal still uses proj4 even when there is a newer version of proj already
>> on my computer. Neither of these proj packages (proj
le as R's internal memory management is made
> > even more efficient. This involves compiled code using memory allocated
> by
> > R to be freed by R's garbage collector, which has to know if an object is
> > still being used. Tomas Kalibera, the author of rchk, helped resolve and
>
mt.edu.br
> > Lattes: http://lattes.cnpq.br/1360403201088680
> > OrcID: orcid.org/-0001-8232-6722
> > Researchgate: www.researchgate.net/profile/Alexandre_Santos10
> > LinkedIn: br.linkedin.com/in/alexandre-dos-santos-87961635
> > Mendeley:www.mendeley.com/profiles/alexandre-dos-santos6/
> >
> > _
..@hafogvatn.is
> >
> > ___
> > R-sig-Geo mailing list
> > R-sig-Geo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
>
> [[alternative HTML version deleted]]
>
> ___
a some generic REST API you'd still have
> to write some client code to interpret the outputs.
>
> Barry
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https
4.html#a7367555
>
>
>
> Thanks in advance for any suggestions,
>
> Todd
>
>
>
> --
>
> Todd McDonnell
>
> Research Scientist, Ph.D.
>
> E Environmental Chemistry
>
> 2161 NW Fillmore Ave., Corvallis, OR
>
>
>
>
> [[alter
ames(tcPainelLog[6:17])
>
> for (j in cols) {
> for (i in 1:length(j)) {
> ifelse(tcPainelLog[[i]] > 0, log(i), log1p(i))
> }
> }
>
>
>
> I would appreciate any help.
>
> Thank you.
>
> Daniel
>
> __
296, fax:
> ++49.(0)6421.2828950, web: gis-ma.org, giswerk.org,
> moc.environmentalinformatics-marburg.de
> ___
> R-sig-Geo mailing list R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> >
> >
> >
ile read in the right way using the raster package? Any other
> option?
>
>
> Greetings,
> -- Thiago V. dos Santos
>
> Postdoctoral Research Fellow
> Department of Climate and Space Science and Engineering
> University of Michigan
>
> ___
According to http://gdal.org/drv_sqlite.html you can unset
OGR_SQLITE_SYNCHRONOUS and it should improve performance. So, use
Sys.setenv(OGR_SQLITE_SYNCHRONOUS="OFF")
in your script/session before you wish to call writes. The SQLite and
GPKG writes are still 11x and 13x respectively slower
On 15/01/17 05:11, Vijay Lulla wrote:
>
>> I think this is because interpNA returns a matrix of one column whereas
>> raster::setValues (used internally by calc) expects the values to be a
>> vector of elements. Changing the last line in `fun_interp` from
>> `return(z)`
I think this is because interpNA returns a matrix of one column whereas
raster::setValues (used internally by calc) expects the values to be a
vector of elements. Changing the last line in `fun_interp` from
`return(z)` to `return(c(z))` might do the trick.
HTH,
Vijay.
On Sat, Jan 14, 2017 at
After reading the vignette I tried it with a few shapefiles and it seems
to be going well so far! Good work!
Congratulations.
On Fri, Nov 4, 2016 at 11:03 AM, Edzer Pebesma <
edzer.pebe...@uni-muenster.de> wrote:
> Package sf (for "simple features") is now on CRAN:
>
>
Have you tried http://www.gadm.org/ ?
On Fri, Nov 4, 2016 at 7:29 AM, SunilChoudhary
wrote:
> Hi Folks
>
> Can someone point me to Shape file for Madhya Pradesh State in India
> preferably with districts.
>
>
> Thanks
> Sunil Choudhary
>
>
>
> [[alternative
You can use the function `setZ` from raster package to set z (here "time")
attribute. Please see ?`setZ`.
On Tue, Sep 6, 2016 at 2:43 PM, Veronica Andreo
wrote:
> Hello
>
> I'm working with raster time series in GRASS, but I needed to apply a
> gap-filling function
Ben,
You're right about a mistake in my code but it is not use of ordered
function. It is that I shouldn't have used the name argument. Following
your example this is what I get:
> m <- function(x) ordered(months(x), labels=month.name)
> x1 <- zApply(s, by=m, mean) # no name argument.
> x1
#
Maybe like this?
R> m <- function(x) ordered(months(x),labels=month.name)
R> x1 <- zApply(s, by=m, mean, name=month.abb[])
R> names(x1) # Appears to have natural ordering
R> all(x[] == x1[]) # TRUE
I'm not sure how using factors will impact other aspects of your project.
HTH,
Vijay.
On Thu, Jul
I'm not sure that this is the best way but I think this does what you want.
R> b1 <- brick(ncol=10,nrow=10,nl=15)
R> b1[] <- rnorm(length(b1),3,2)
R> b2 <- b1*b2
R> b3 <- stack(b1,b2)
R> fun3 <- function(x) { lm(x[16:30] ~ x[1:15])$coefficients[[2]] }
R> out3 <- calc(b3, fun3)
This is similar to
(1,1,1,1,1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE)
> r[idx] <- r[idx] + 1
> plot(r)
> range(getValues(r))
> #[1] 0 1
>
> I could be misreading the original posting, but I think the desire is that
> the result will be increment for each repeated index using just one
> suba
Maybe something like this?
R> r <- raster(nrows=5,ncols=5)
R> r[] <- 0
R> idx <- matrix(c(1,1,1,5,5,1,5,5),ncol=2,byrow=TRUE) # four corners of
the raster!
R> r[idx] <- r[idx] + 1
R> image(r)
>From R's ?`[` : When indexing arrays by '[' a single argument 'i' can be a
matrix with as many columns
%%100
>> meanYM <- calc(s.c, fun=function(x) { by(x, idxYM, sum) })
>> meanM <- calc(meanYM, fun=function(x) { by(x, idxM, mean) })
>> plot(meanYM,1) # Note that no 0 was added across the extent
>> plot(meanM,1) # This is OK too, no grey area
>>
antos
>
> PhD student
> Land and Atmospheric Science
> University of Minnesota
>
>
>
> On Friday, June 3, 2016 4:25 AM, Loïc Dutrieux <loic.dutri...@wur.nl> wrote:
> This can also be done with zApply:
>
> library(zoo)
>
> sYM <- zApply(s, by = as.yearmon, sum)
>
I think the following StackOverflow question has the answer:
http://stackoverflow.com/questions/16135877/applying-a-function-to-a-multidimensional-array-with-grouping-variable/16136775#16136775
Following the instructions listed on that page for your case might go
something like below:
> idxYM <-
Thanks for the explanation.
On Sat, May 28, 2016 at 6:15 AM, Edzer Pebesma
<edzer.pebe...@uni-muenster.de> wrote:
>
>
> On 28/05/16 00:21, Vijay Lulla wrote:
>> Edzer,
>> I'm having trouble replicating what you state. Below is from my R session.
>
> I don'
Edzer,
I'm having trouble replicating what you state. Below is from my R session.
### Start R session interaction
> over(Inter2[1], PolyD2, byid=T)
Attribute
11black
> # The green (1st) segment intersects with the black (1st) polygon => good
> over(Inter2[2], PolyD2, byid=T) # Still not
Nice use of do.call Loic (Sorry, don't know how to do the accents). I
wasn't aware that you can send in a list to args! So, thanks for it.
Now here's my quesiton. If I change the statement
l <- list(s1,s2,s3,s4,fun=mean)
to
l <- list(s1=s1,s2=s2,s3=s3,s4=s4,fun=mean) # similar to Thiago's
solves in a call to overlay
> of the form
>
> overlay(s1 = s1, s2 = s2, s3 = s3, s4 = s4, fun = mean)
>
> which has missing x and y. Not naming the arguments passes s1 to x, s2
> to y and the others to ... allowing overlay to choose the right method.
>
>>
>> Chee
Maybe something like below?
R> avg_rainfall <- do.call(stack,lapply(1:9,function(x)
overlay(stack(s,bands=10*x+(0:9)),fun=mean)))
R> ss <- subset(avg_rainfall,1:9) #?raster::subset
R> st <- subset(avg_rainfall, 2:10)
R> pct_change <- 100 * (st-ss)/ss
HTH,
Vijay.
On Tue, Dec 1, 2015 at 3:14 AM,
>From the help page of `getValues`: "The values returned for a
RasterStack or RasterBrick are always a matrix, with the rows
representing cells, and the columns representing layers" so all
you have to do is transpose the matrix from getValues, cbind the date
column, do your analysis. To go
If you want to use backslash in your string then you'll have to double
them to remove the escape mechanism. So your path should read
"C:\\Program Files\\GDAL\\gdalwarp.exe" etc. Please see ?Quote in R
help.
However, there is another (simpler IMO) solution. If you have the
latest QGIS installed
> 'POLYGON(
>(0 0, 0 10, 10 10, 10 0, 0 0),
>(0 0, 10 0, 10 -10, 0 -10, 0 0))'::geometry,
> 'POLYGON(
>(0.5 0.5, 0.5 10.5, 10.5 10.5, 10.5 0.5, 0.5 0.5),
>(0.5 0.5, 10.5 0.5, 10.5 -10.5, 0.5 -10.5, 0.5 0.5))'::geometry
> ));
>
>
Seems to be working in PostGIS! Below is from my PostGIS session:
gisdb=# SELECT ST_Intersects('POLYGON((0 0, 0 10, 10 10, 10 0, 0
0))'::geometry, 'POLYGON((0 0, 10 0, 10 -10, 0 -10, 0 0))'::geometry);
st_intersects
---
t
(1 row)
gisdb=# SELECT ST_Intersection('POLYGON((0 0, 0
I have no idea what you're trying to accomplish with your program
logic but I think the below might work for you.
R> lai <- raster(ncols=360,nros=180)
R> lai[] <- 1:ncell(lai)
R> idx <- lai < 1000
R> emiss_0 <- lai
R> emiss_0[] <- 0.95
R> emiss_0[idx] <- 0.95 + (lai[idx]*0.01)
R> emiss_nb <-
There's a mistake in proj_geog line. Shouldn't it be
proj_geog - +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84
?
On Fri, Jun 5, 2015 at 3:00 PM, José Luis Rotundo
rotundo.j...@gmail.com wrote:
Dear List,
I am trying to have some spatial data of an atrribute (protein.db) in
a map from
62 matches
Mail list logo