我对如何访问netcdf变量中的嵌套变量感到困惑 ,示例文件ftp://rfdata:forceDATA@ftp.iiasa.ac.at/WFDEI/Tair_WFDEI/Tair_WFDEI_197901.nc.gz)
require(ncdf4)
nc=nc_open("Tair_WFDEI_197901.nc")
Tair <- ncvar_get(nc,"Tair")
names(nc$var)
[1] "timestp" "time" "Tair"
> nc$var$time
$id
$id
[1] 3
$group_index
[1] -1
$group_id
[1] 65536
$list_index
[1] 2
$isdimvar
[1] FALSE
attr(,"class")
[1] "ncid4"
$name
[1] "time"
$ndims
[1] 1
$natts
[1] 3
$size
[1] 248
$dimids
[1] 2
$prec
[1] "int"
$units
[1] "seconds since 1979-01-01 00:00:00"
$longname
[1] "time since start of month"
$group_index
[1] 1
$chunksizes
[1] NA
$storage
[1] 2
$shuffle
[1] FALSE
$compression
[1] NA
$dims
list()
$dim
$dim[[1]]
$name
[1] "tstep"
$len
[1] 248
$unlim
[1] TRUE
$group_index
[1] 1
$group_id
[1] 65536
$id
[1] 2
$dimvarid
$id
[1] -1
$group_index
[1] 1
$group_id
[1] 65536
$list_index
[1] -1
$isdimvar
[1] TRUE
attr(,"class")
[1] "ncid4"
$vals
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
[31] 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
[61] 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
[91] 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
[121] 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
[151] 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
[181] 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
[211] 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
[241] 241 242 243 244 245 246 247 248
$units
[1] ""
$create_dimvar
[1] FALSE
attr(,"class")
[1] "ncdim4"
$varsize
[1] 248
$unlim
[1] TRUE
$make_missing_value
[1] FALSE
$missval
[1] NA
$hasAddOffset
[1] FALSE
$hasScaleFact
[1] FALSE
attr(,"class")
[1] "ncvar4"
我想访问$ vals,但是当我尝试
时> nc$var$time$vals
NULL
当我在R控制台中尝试自动完成时,我也无法获得所有值。我很困惑。
> nc$var$time$
nc$var$time$id nc$var$time$name nc$var$time$ndims nc$var$time$natts
nc$var$time$size nc$var$time$dimids nc$var$time$prec nc$var$time$units
nc$var$time$longname nc$var$time$group_index nc$var$time$chunksizes nc$var$time$storage
nc$var$time$shuffle nc$var$time$compression nc$var$time$dims nc$var$time$dim
nc$var$time$varsize nc$var$time$unlim nc$var$time$make_missing_value nc$var$time$missval
nc$var$time$hasAddOffset nc$var$time$hasScaleFact