0

I have downloaded the sea surface temperature for January from here https://oceancolor.gsfc.nasa.gov/l3/

and imported it into R.

I know how to crop using extent(ymax, ymin, xmax,xmin) but I can't figure out how to do it just for one station (53.9S, 174,1W) or the nearest one to that coordinate. Is there a way I can crop the data just for one station?

val <- extract(174.1,53.9) Error in .local(x, y, ...) : extents do not overlap

SST_Jan <- brick("~https://oceandata.sci.gsfc.nasa.gov/cgi/getfile/A20021822018212.L3m_MC_SST_sst_9km.nc", stopIfNotEqualSpaced = FALSE, varname = "sst")

print(SST_Jan)

val<-extract(174.1, 53.9)

SST_Jan_station <- extract(SST_Jan, val)

I would like to be able to plot the changes in SST at that particular location over the 12 months

Thank you,

1 Answers1

1

The extract function doesn't work with a numeric vector.

You can put the coordinates in a matrix -

pnt = matrix(c(174.1, 53.9), ncol = 2)
pnt
##       [,1] [,2]
## [1,] 174.1 53.9

And then extract will work -

extract(SST_Jan, pnt)
##      layer
## [1,]  8.24
Michael Dorman
  • 950
  • 6
  • 8