home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / softsys / khoros / 2932 < prev    next >
Encoding:
Text File  |  1992-11-20  |  5.3 KB  |  133 lines

  1. Newsgroups: comp.soft-sys.khoros
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!sun-barr!ames!news.hawaii.edu!uhunix.uhcc.Hawaii.Edu!donna
  3. From: donna@uhunix.uhcc.Hawaii.Edu (Donna Okazaki)
  4. Subject: Re: DLG2VIFF
  5. Message-ID: <1992Nov20.214121.19791@news.Hawaii.Edu>
  6. Sender: root@news.Hawaii.Edu (News Service)
  7. Nntp-Posting-Host: uhunix.uhcc.hawaii.edu
  8. Organization: University of Hawaii
  9. References: <41543@pprg.eece.unm.edu.pprg.unm.edu>
  10. Date: Fri, 20 Nov 1992 21:41:21 GMT
  11. Lines: 120
  12.  
  13. In article <41543@pprg.eece.unm.edu.pprg.unm.edu> rasure@borris.eece.unm.edu (John Rasure) writes:
  14. >
  15. >In "DLG2VIFF", Chris Blasband writes:
  16. >+ I have received over 900 DLG files from USGS and I am
  17. >+ trying to use the dlg2viff command to transform them
  18. >+ into viff files. When I type in the command, Khoros
  19. >+ just sits there and does nothing (it does not even
  20. >+ open up the output file).
  21. >+ 
  22. >+ Has anyone successfully read in the optional formatted
  23. >+ DLG files, and if so, what's the trick.
  24. >
  25. >It has been awhile since this has come up.  About 9 months ago, we
  26. >considered rewriting the dlg2viff code for a Khoros 1.0 patch - but
  27. >we did not.  It was implemented poorly.
  28. >
  29. >What prompted us to look at it in detail was that there was a bug on SUNS
  30. >that did not show up on DEC machines .... in trying to track it down we
  31. >decided the best thing to do was leave it alone and rewrite it when we
  32. >get resources to do so - it may or may not be in Khoros 2.0.
  33. >
  34.  
  35. I have been using DLG2VIFF on a Sparc 2 running SunOS 4.1.2
  36. on USGS Optional format, level-3 DLG files with no problem.
  37. (Using Khoros 1.0.5).  When I read the data from the tape, I
  38. converted them from fixed length to variable length records,
  39. terminated by newlines.
  40.  
  41. However, I agree that its design leaves much to be desired
  42. and may get around to rewriting it myself if my stack ever gets
  43. that low. <wishful thinking> :-)
  44.  
  45. BTW, there is a small bug/oversight in the readline() function in
  46. dlg.c which doesn't seem to affect DLG2VIFF, but is annoying 
  47. for those of us trying to use the readdlg() function to extract 
  48. line records from level-3 files.  The following patch fixes this:
  49.  
  50. *****patch dlg.c in $KHOROS_HOME/src/file_formats/Lib*****
  51. 591a592
  52. >     /* 11-13-92 - patched to read line number */
  53. 593c594
  54. <     readfixed (file,  5, "%d", dummys);
  55. ---
  56. >     readfixed (file,  5, "%d", &(lineptr->linenum));
  57. *****end of patch*****
  58.  
  59.  
  60. Also, there is a major bug in DEM2VIFF which causes it to crash
  61. on some DEM files.  I also thought it should be able to read DEM's
  62. with elevation in FEET and convert it to meters instead of
  63. rejecting the DEM and it should also apply the z-resolution factor
  64. to the elevations.  These fixes are contained in the following patch:
  65.  
  66. *****patch ldem2viff.c in $KHOROS_HOME/src/file_formats/Lib*****
  67. 61a62
  68. > #include <math.h>
  69. 62a64
  70. > #define FEET2METERS .3048
  71. 180a183
  72. >      * 10-15-92 Added feet capability.
  73. 183,185c186,188
  74. <         if (dem_img->elevationunit != METERS) {
  75. <             fprintf (stderr, "error in ldem2viff: 1-degree DEM data must ");
  76. <             fprintf (stderr, "have elevations given in meters\n");
  77. ---
  78. >         if (dem_img->elevationunit != METERS && dem_img->elevationunit != FEET) {
  79. >             fprintf (stderr, "error in ldem2viff: 1-degree DEM data must ");
  80. >             fprintf (stderr, "have elevations given in meters or feet\n");
  81. 190,192c193,195
  82. <         if (dem_img->elevationunit != METERS) {
  83. <             fprintf (stderr, "error in ldem2viff: 7.5-minute DEM data must ");
  84. <             fprintf (stderr, "have elevations given in meters\n");
  85. ---
  86. >         if (dem_img->elevationunit != METERS && dem_img->elevationunit != FEET) {
  87. >             fprintf (stderr, "error in ldem2viff: 7.5-minute DEM data must ");
  88. >             fprintf (stderr, "have elevations given in meters or feet\n");
  89. 291c294,295
  90. <                 elevation = elevation + (float)dem_img->data[x]->elevation;
  91. ---
  92. >                 elevation = elevation + 
  93. >                             (float)(dem_img->data[x]->elevation * dem_img->zres);
  94. 292a297,303
  95. >                 /*
  96. >                  * 10-15-92 Adjust feet to meters if necessary.
  97. >                  */
  98. >                 if (dem_img->elevationunit == FEET) {
  99. >                     elevation *= FEET2METERS;
  100. >                 }
  101. 406c417,418
  102. <                 elevation = elevation + dem_img->data[x]->elevation;
  103. ---
  104. >                 elevation = elevation +
  105. >                             (float)(dem_img->data[x]->elevation * dem_img->zres);
  106. 409,410c421
  107. <                  *
  108. <                  *
  109. ---
  110. >                  * 10-15-92 Adjust feet to meters if necessary.
  111. 411a423,430
  112. >                 if (dem_img->elevationunit == FEET) {
  113. >                     elevation *= FEET2METERS;
  114. >                 }
  115. >                 /*
  116. >                  * 10-21-92 Fix calculation of i.  Range must go from
  117. >                  * 0 to (xv_rows-1) so data won't overflow outside of array.
  118. >                  */
  119. 413,414c432,433
  120. <                 i = (int) (((northing-min_northing)/northing_range) * xv_rows);
  121. <                 i = xv_rows -i;
  122. ---
  123. >                 i = irint(((xv_rows-1)*(northing-min_northing))/northing_range);
  124. >                 i = (xv_rows-1) - i;
  125. *****end of patch*****
  126.  
  127. -----
  128. She surveys seafloors       | Donna Okazaki
  129. to the seashore             | Univ. of Hawaii, Geography Dept.
  130.         ~ ~ ~ ~             | donna@uhunix.uhcc.hawaii.edu
  131.