[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BYTES to LONG



 My original idea for reading the USGS DLG files in the SDTS format was very similar to Med
Bennett suggestion and it does work.

  OPENR, ReadU,  POINT_LUN, then ReadU them in as LONG

 However, from my (FORTRAN) experience, looping thru an I/O is a slow process.

 I thought, if I read the SDTS file as one binary array with one ReadU statement to limit the
I/O operation, then loop thru it later would speed the process up - which it doesn't. I still
need to use the FOR...ENDFOR which is slow in IDL anyway.

 However for some reason, in the USGS conversion process of these SDTS files, they are
sticking LF (13B) in the data and they are randomly located throughout the file. Or these LF
maybe in some original master file and they leave them in there by mistake. Something I plan
to send an E-Mail to USGS about.

 Anyway, by removing the 13B from the data, I get correct UTM numbers. This is easier, if I
read in the file as a binary array and use the WHERE function to remove the 13B before I
start looping thru it. Reading in the LONG value with ReadU as I originally done ( and Med
suggested ), picked up these LFs producing bad UTM numbers.

 The reason why I took on this task -- CIRA managers are questioning our GIS compatibility
with other agencies. I just wanted to prove to them that we don't need to purchase new
hardware and GIS programs to solve this problem. It can be all done in IDL ( ENVI and River
Tools not required either ).

 The USGS SDTS files with DEM and DLG are ugly, but free. USGS conversion process is still
underway, so not all DEMs and DLGs are available yet in the new Internet friendly (
programmers nightmare ) SDTS format.

 I plan to post my simple SDTS read routine soon.

Kelly


Paul van Delst wrote:

> Kelly Dean wrote:
> >
> >  Thanks Paul,
> >
> >  Your suggestion solved my problem.
> >
> >    long_x = TOTAL( ISHFT( LONG(x), [24,16,8,0] ) )
> >
> >  It converted the 4 Bytes into a LONG UTM number.
>
> Wow. I posted a useful solution...excuse me while I get up from the floor! :o)
>
> I have to admit, I treated your question as a little IDL exercise rather than think a bit
> harder and ask a few more questions to help you solve your problem. If, as Med Bennett
> suggested, you can read the data in as a LONG, isn't that a better method? Or didn't that
> work for you? I have no idea what the format of a USGS SDTS file is so it may be a
> braindead question.
>
> paulv
>
> --
> Paul van Delst           Ph:  (301) 763-8000 x7274
> CIMSS @ NOAA/NCEP        Fax: (301) 763-8545
> Rm.207, 5200 Auth Rd.    Email: pvandelst@ncep.noaa.gov
> Camp Springs MD 20746