r - Error plotting data from netcdf file "increasing x y values expected" -


i want plot sea surface temperature data regular grid can't find proper way it. data comes in nc format , can downloaded http://www.nodc.noaa.gov/satellitedata/pathfinder4km/

i use r code access data problem appears when trying plot

library("ncdf") download.file("ftp://ftp.nodc.noaa.gov/pub/data.nodc/pathfinder/version5.2/2003/20030715000715-nodc-l3c_ghrsst-sstskin-avhrr_pathfinder-pfv5.2_noaa17_g_2003196_night-v02.0-fv02.0.nc", destfile="sst.nc") data=open.ncdf("sst.nc") x <- get.var.ncdf(data,"lon") y <- get.var.ncdf(data,"lat") sst=get.var.ncdf(data,"sea_surface_temperature")  filled.contour(x,y,sst, color = terrain.colors, asp = 1) 

and error message

error en filled.contour(x, y, sst, color = terrain.colors, asp = 1) : increasing 'x' , 'y' values expected

i think problem comes y coordinate, latitude runs 90 -90. i've seen questions on stackoverflow in creating new grid akima package should not necessary in case.

here can find summary of data file

http://ubuntuone.com/1midyvqoepn24gkqbtxy7k

thanks in advance help

solved

thanks paul hiemstra

the point not read lat-lon values data set know i,j coordinates of data points in matrix , select geographic area want plot. following commands work me:

library("ncdf") download.file("ftp://ftp.nodc.noaa.gov/pub/data.nodc/pathfinder/version5.2/2003/20030715000715-nodc-l3c_ghrsst-sstskin-avhrr_pathfinder-pfv5.2_noaa17_g_2003196_night-v02.0-fv02.0.nc", destfile="sst.nc") data=open.ncdf("sst.nc") sst=get.var.ncdf(data,"sea_surface_temperature") x = seq(1, 8640, length.out = nrow(sst))         # matrix dimension 8640x4320 y = seq(1, 4320, length.out = ncol(sst))  sst1 <- sst[c(1000:1500),c(1000:1500)]           # subsetting region x = seq(1, 500, length.out = nrow(sst1)) y = seq(1, 500, length.out = ncol(sst1))  png(filename="sst.png",width=800,height=600,bg="white") filled.contour(x,y,sst1, color = terrain.colors, asp = 1) dev.off() 

now have figure out how label plot longtiude , latitude @ x-y coordinates.

the problem following. x , y variables of same size of sst, i.e. provide maps of x , y coordinates. filled_contour function needs not these maps, more x , y coordinates associated rows , columns in sst increasing x values.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -