Hi,
I have been trying to modify a geofield in a MODIS HDF-EOS file with the following code:
(infile is a string with the location of the .hdf)
nswath = eos_sw_inqswath(infile, swath_list)
swath_name = strsplit(swath_list, ',', /extract)
fid = eos_sw_open(infile, /rdwr)
swath_id = eos_sw_attach(fid, swath_name[0])
geofield_count = eos_sw_inqgeofields(swath_id, geofield_list, geofield_ranks, geofield_types)
geofield_names = strsplit(geofield_list, ',', /extract)
name=geofield_names[0]
print,name
result = eos_sw_detach(swath_id)
swath_id = eos_sw_attach(fid, swath_name[0])
status = EOS_SW_DEFDIM(swath_id, "GeoTrack", 2000)
status = EOS_SW_DEFDIM(swath_id, "GeoXTrack", 2200)
status = EOS_SW_WRITEGEOMETA(swath_id,name, "GeoTrack,GeoXtrack", 5)
print,status
result = eos_sw_detach(swath_id)
swath_id = eos_sw_attach(fid, swath_name[0])
geofield_count = eos_sw_inqgeofields(swath_id, geofield_list, geofield_ranks, geofield_types)
print,geofield_list
result=eos_sw_close(fid)
However, I am having a bit of a problem. Rather than overwriting the previous geofield the EOS_SW_WRITEGEOMETA command seems to be creating an entirely new one with the same name.
I compared geofield_list pre- and post- calling this command and before I have this output:
Latitude, Longitude
After calling eos_sw_writegeometa I get this:
Latitude, Longitude, Latitude
Could someone point me in the direction of what I've done wrong here? I'm guessing I have overlooked something simple!
I'm also not sure about the detach and attach commands, I've tried various combinations of positions and numbers of calls, but they don't seem to make much difference. I've left them in the above code, though.
Thanks,
Simon.
|