Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have a a Large RasterStack of temperatures and a 10570 points in a Large SpatialPointsDataFrame and I'm using extract() to assign the temperatures to each point in R.

sub<-stack(temp@layers[18263:23011])
pts@data <- data.frame(pts@data, extract(sub, pts))

This gives me a table with a column for each raster:

DATE2       BICHO   X2000.01.01   X2000.01.02   (...)   X2012.12.31
2009-04-08  Woody      20.7          19.2        ...         9.1
2009-04-09  Woody      20.5          19.3        ...         9.5
2009-04-10  Woody      20.7          19.2        ...         9.6
2004-11-30  Woody      20.9          19.1        ...         9.8
2004-12-01  Buzz       20.3          19.4        ...         10
2004-12-02  Buzz       20.7          19.2        ...         9.5
2012-12-05  Buzz       20.6          19.2        ...         9.8
2012-12-05  Andy      -99.99        -99.99       ...        -99.99
2012-12-05  Rex        20.5          19.3        ...         9.1

The problem is, when there are repeated dates, the temperature value of one of the dates is set to -99. How can I solve this problem?

share|improve this question
    
What is temp@layers? You should not be using the @ operator btw, where did this code come from? –  mdsumner Apr 15 at 12:14
    
temp is the initial stack file. In that line I'm subsetting the initial stack from years 1850-2013 to 2000-2013. –  JMarcelino Apr 15 at 12:38
    
just use sub <- subset(temp, 18263:23011) and then (admittedly I don't know what should happen here, sp can be overly prescriptive) use your second line as you did. I suspect your -99 thing is due to a problem with the coordinates themselves, but you don't provide enough info here. –  mdsumner Apr 15 at 13:20

1 Answer 1

up vote 1 down vote accepted

I found the problem, the temperature RasterStack does not cover all the extent of the country I'm working on.
I'm using E-OBS gridded dataset from European Climate Assessment & Dataset, by the way.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.