这三行将打开并从netcdf文件中读取一个变量:
f=open.ncdf("C:\\BR_Ji1.nc")
A = get.var.ncdf(nc=f,varid="date",verbose=TRUE)
B = get.var.ncdf(nc=f,varid="GPP",verbose=TRUE)
[1] "get.var.ncdf: entering. Here is varid:"
[1] "GPP"
[1] "checking to see if passed varid is actually a dimvar"
[1] "entering vobjtodimname with varid= GPP"
[1] "vobjtodimname: is a character type varid. This file has 6 dims"
[1] "vobjtodimname: no cases found, returning FALSE"
[1] "get.var.ncdf: isdimvar: FALSE"
[1] "vobjtovarid: entering with varid=GPP"
[1] "Variable named GPP found in file with varid= 17"
[1] "vobjtovarid: returning with varid deduced from name; varid= 17"
[1] "get.var.ncdf: ending up using varid= 17"
[1] "ndims: 2"
[1] "get.var.ncdf: varsize:"
[1] 1 17520
[1] "get.var.ncdf: start:"
[1] 1 1
[1] "get.var.ncdf: count:"
[1] 1 17520
[1] "get.var.ncdf: totvarsize: 17520"
[1] "Getting var of type 3 (1=short, 2=int, 3=float, 4=double, 5=char, 6=byte)"
[1] "get.var.ncdf: C call returned 0"
[1] "count.nodegen: 17520 Length of data: 17520"
[1] "get.var.ncdf: final dims of returned array:"
[1] 17520
[1] "varid: 17"
[1] "nc$varid2Rindex: 1" "nc$varid2Rindex: 2" "nc$varid2Rindex: 0" "nc$varid2Rindex: 0" "nc$varid2Rindex: 3"
[6] "nc$varid2Rindex: 0" "nc$varid2Rindex: 4" "nc$varid2Rindex: 5" "nc$varid2Rindex: 6" "nc$varid2Rindex: 7"
[11] "nc$varid2Rindex: 8" "nc$varid2Rindex: 9" "nc$varid2Rindex: 10" "nc$varid2Rindex: 11" "nc$varid2Rindex: 12"
[16] "nc$varid2Rindex: 13" "nc$varid2Rindex: 14" "nc$varid2Rindex: 15" "nc$varid2Rindex: 16" "nc$varid2Rindex: 17"
[21] "nc$varid2Rindex: 18" "nc$varid2Rindex: 19" "nc$varid2Rindex: 20"
[1] "nc$varid2Rindex[varid]: 14"
[1] "get.var.ncdf: setting missing values to NA"
[1] "missval: -9999 tol: 0.09999"
[1] "get.var.ncdf: implementing add_offset ( FALSE ) and scale_factor ( FALSE )"
[1] "var has NEITHER add_offset nor scale_factor"
**K = get.var.ncdf(nc=f,varid="Qle",verbose=TRUE)
write.table(t(rbind(A,B,K)),"C:\\Ji1-gpp-lat.txt")**
当我查看提取的数据时,我发现我有非常小的负值。 然后我使用了gdalinfo,发现max是400而min是0(这是正常的,这就是值的样子)。任何想法,为什么我错误地得到这个数字?
答案 0 :(得分:0)
请参阅此问题:Does ComputeBandStats take nodata into account?。文件元数据中包含的统计信息可能不是新鲜的或精确计算的。如果您想要准确的统计数据,您应该自己计算它们,或者确保使用近似值计算它们的标志设置为False。