에 대한
> library(ncdf)
> precipitation = open.ncdf("precipitation_2013.nc")
> lonmat = get.var.ncdf(nc= precipitation,varid="longitude")
> latmat = get.var.ncdf(nc= precipitation,varid="latitude")
> plot(lonmat, latmat, main= "Precipitation grid 2013")
감사합니다,하지만 때 실제로 어떤 일이 벌어지는지를 보시오.
print(precipitation)
[1] "file ~/Downloads/precipitation_2013.nc has 3 dimensions:"
[1] "longitude Size: 8"
[1] "latitude Size: 5"
[1] "time Size: 730"
[1] "------------------------"
[1] "file ~/Downloads/precipitation_2013.nc has 1 variables:"
[1] "short tp[longitude,latitude,time] Longname:Total precipitation Missval:-32767"
실제 데이터에는, latitude
및 time
의 세 가지 치수를 갖는 short
유형의 변수가 있습니다. 차원 값은 별도의 변수로 저장되며 값을 수집하는 변수는 차원 만 참조합니다. 그것을 무엇, 당신이 실제로 당신은 실제 변수를 추출하여 데이터를 포함 할 수있는 값
> latmat
[1] 60.0 58.5 57.0 55.5 54.0
> lonmat
[1] 19.5 21.0 22.5 24.0 25.5 27.0 28.5 30.0
을 가진 경우 플롯하려는 : 그래서 질문 질문 netCDF의 또는 지리 정보 시스템의 독립적 인 긴 형식으로 가져오고 할당 치수 값을 결과 data.frame
에 :
이 library(reshape2)
tp.molten <- melt(get.var.ncdf(nc= precipitation,varid="tp"), varnames=c("longitude", "latitude", "time"))
tp.molten$longitude <- lonmat[tp.molten$longitude]
tp.molten$latitude <- lonmat[tp.molten$latitude ]
tp.molten$time<- get.var.ncdf(nc= precipitation,varid="time")[tp.molten$time ]
close.ncdf(precipitation) # don't forget
head(tp.molten)
longitude latitude time value
1 19.5 19.5 990564 0.002813700
2 21.0 19.5 990564 0.004143370
3 22.5 19.5 990564 0.006473583
4 24.0 19.5 990564 0.008655690
5 25.5 19.5 990564 0.007778240
6 27.0 19.5 990564 0.005223891
지금 당신은 예를 들어 하나 개의 평가시기하여이 데이터를 부분 집합 수와 경도 - 위도 - 그리드에이 음모
,451,515, library(ggplot2)
ggplot(data = tp.molten[ tp.molten$time == 992052, ], aes(x = latitude, y = longitude, fill = value)) +
geom_raster()

없음 크로스 게시 ! http://gis.stackexchange.com/questions/97371/dimension-length-of-netcdf-file-differs – mdsumner
제 의견으로는 프로그래밍 질문이므로이 질문에 답하겠습니다. – Beasterfield