Changeset 70 for trunk/ReadWrite/idl-NetCDF/ncdf_read.pro
- Timestamp:
- 05/16/06 14:41:08 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ReadWrite/idl-NetCDF/ncdf_read.pro
r67 r70 87 87 ;; global attributes 88 88 89 gatts=replicate({name:'', $ 90 datatype:'', $ 91 length:0L, $ 92 values:ptr_new()}, $ 93 info.ngatts) 94 for iatt=0,info.ngatts-1 do begin 95 name=ncdf_attname(id,iatt,/global) 96 gatts[iatt].name=name 97 att=ncdf_attinq(id,name,/global) 98 gatts[iatt].length=att.length 99 gatts[iatt].datatype=att.datatype 100 ncdf_attget,id,name,vals,/global 101 gatts[iatt].values=ptr_new(vals) 102 endfor 89 if info.ngatts gt 0 then begin 90 gatts=replicate({name:'', $ 91 datatype:'', $ 92 length:0L, $ 93 values:ptr_new()}, $ 94 info.ngatts) 95 for iatt=0,info.ngatts-1 do begin 96 name=ncdf_attname(id,iatt,/global) 97 gatts[iatt].name=name 98 att=ncdf_attinq(id,name,/global) 99 gatts[iatt].length=att.length 100 gatts[iatt].datatype=att.datatype 101 ncdf_attget,id,name,vals,/global 102 gatts[iatt].values=ptr_new(vals) 103 endfor 104 endif else begin 105 ;; arbitary scalar value 106 ;; an empty list would be sensible but IDL doesn't support it 107 gatts=-1 108 endelse 103 109 104 110 … … 108 114 vatts=replicate(ptr_new(),info.nvars) 109 115 for ivar=0,info.nvars-1 do begin 110 vatts[ivar]=ptr_new(replicate({name:'', $ 111 datatype:'', $ 112 length:0L, $ 113 values:ptr_new()}, $ 116 if vinfo[ivar].natts gt 0 then begin 117 vatts[ivar]=ptr_new(replicate({name:'', $ 118 datatype:'', $ 119 length:0L, $ 120 values:ptr_new()}, $ 114 121 vinfo[ivar].natts)) 115 for iatt=0,vinfo[ivar].natts-1 do begin 116 name=ncdf_attname(id,ivar,iatt) 117 (*vatts[ivar])[iatt].name=name 118 att=ncdf_attinq(id,ivar,name) 119 (*vatts[ivar])[iatt].length=att.length 120 (*vatts[ivar])[iatt].datatype=att.datatype 121 ncdf_attget,id,ivar,name,vals 122 (*vatts[ivar])[iatt].values=ptr_new(vals) 123 endfor 122 for iatt=0,vinfo[ivar].natts-1 do begin 123 name=ncdf_attname(id,ivar,iatt) 124 (*vatts[ivar])[iatt].name=name 125 att=ncdf_attinq(id,ivar,name) 126 (*vatts[ivar])[iatt].length=att.length 127 (*vatts[ivar])[iatt].datatype=att.datatype 128 ncdf_attget,id,ivar,name,vals 129 (*vatts[ivar])[iatt].values=ptr_new(vals) 130 endfor 131 endif else begin 132 vatts[ivar]=ptr_new(-1) 133 ;; Pointer to arbitrary scalar -- analogous to case of lack of 134 ;; global attributes above. We could put a <NullPointer> here 135 ;; instead, but try to be friendlier to code that might try 136 ;; to dereference it. 137 endelse 124 138 endfor 125 139
Note: See TracChangeset
for help on using the changeset viewer.