0

这三行将打开并从 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 发现最大值为 400,最小值为 0(这是正常的,这就是值的样子)。任何想法为什么我得到错误的号码?

4

1 回答 1

0

See this question: Does ComputeBandStats take nodata into account?. The statistics contained in the file's metadata may not be fresh or precisely calculated. If you want accurate statistics you should calculate them yourself, or make sure the flag for calculating them using approximations is set to False.

于 2017-02-08T21:25:43.160 回答