reading and writing with assoc [message #49715] |
Thu, 10 August 2006 13:55 |
psbeps
Messages: 8 Registered: March 2005
|
Junior Member |
|
|
I am trying to read a binary file and write the same data back to a new
file with one of its arrays replaced with a new array. I've only used
assoc to read files, and when I try to write the file with assoc, I
wind up with a smaller file. My new array should be the same size as
the old array, so I don't know what I'm doing wrong that is making the
new file too small. Here's how I'm reading the data, but how do I write
it back with aiLandsea replaced with a new array?
a=assoc(unit3, $
{field_data $
,anal_temp:0 $
,avg_grad :0 $
,grad_xplus:0 $
,grad_xminus:0 $
,grad_yplus :0 $
,grad_yminus:0 $
,phys_descr:0b $
,spare1:0b $
,nobs:0b $
,obs_age:0b $
,reliab:0 $
,coverage:0 $
,covar_xplus:0b $
,covar_xminus:0b $
,covar_yplus:0b $
,covar_yminus:0b $
,climate_temp:0 $
,obs_age_2:0 $
},offset)
kk=long(0)
For ii = 0, num_rowsL-1 do begin
For jj= 0, num_colsL-1 do begin
kk=long((ii*num_colsL)+jj + ii)
tmp=a(kk)
byteorder,tmp
aiNobs(jj, ii) = tmp.nobs
aiAgeobs(jj, ii) = tmp.obs_age
aiReliab(jj, ii) = tmp.reliab
aiPercice(jj, ii) = tmp.phys_descr
aiLandsea(jj,ii)=tmp.spare1
sst(jj,ii) = tmp.anal_temp*10
Endfor; end for(num_colsL)
Endfor; end for(num_rowsL)
Thanks,
Jill
|
|
|