home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / vis5d / spec / howtoget.txt next >
Text File  |  1994-06-21  |  17KB  |  458 lines

  1. VIS5D 
  2.  
  3. This following, extracted from a letter from Bill Hibbard to O'Reilly 
  4. & Associates, sums up the situation with VIS5D:
  5.  
  6.    We do not have a neatly worded file spec for the VIS-5D input
  7.    files, since we do not intend that anyone write software to create
  8.    those files.  Rather, we supply source code (in both C and Fortran)
  9.    for a program that writes our file format, plus documentation to help
  10.    our users to modify this program to add logic for reading their own
  11.    file formats.  That is, this is a do-it-yourself file format
  12.    conversion program.
  13.  
  14.    I have included below the information about getting VIS-5D by anonymous
  15.    ftp, plus Section 3 of our README file, that includes the source code
  16.    and documentation for our do-it-yourself file format conversion program.
  17.  
  18. --------------- how to get VIS-5D by anonymous ftp --------------------
  19.  
  20. VIS-5D version 3.1
  21.  
  22. VIS-5D is a system for interactive visualization of 5-D gridded data
  23. sets such as those made by numeric weather models.  One can make
  24. isosurfaces, contour line slices, colored slices, wind vector slices,
  25. wind trajectories, etc. of data in a 3-D grid and then rotate and animate
  26. the image in realtime.  There are also features for text annotation and
  27. video production.
  28.  
  29. Distributed under the terms of the GNU General Public License as published
  30. by the Free Software Foundation.  Development funded by NASA.
  31.  
  32. Hardware requirements:
  33. Silicon Graphics:
  34. IRIS with VGX, GTX, TG, or G graphics
  35. SGI Crimson or Indigo
  36. 32MB RAM suggested
  37. IRIX 4.0.x
  38. IBM RS/6000:
  39. 3-D graphics hardware with GL
  40. 32MB RAM suggested
  41. AIX version 3 or later
  42. Stardent/Stellar:
  43. GS-1000 or GS-2000
  44. TrueColor display
  45. 32MB RAM suggested
  46.  
  47. How to get it:
  48. % ftp iris.ssec.wisc.edu
  49. or
  50. % ftp 144.92.108.63
  51.  
  52. login: anonymous
  53. password: myname@location
  54.  
  55. ftp> cd pub/vis5d
  56. ftp> ascii
  57. ftp> get README
  58. ftp> bye
  59.  
  60. See section 2 of the README file for complete system requirements
  61.         and installation instructions.
  62.  
  63. Includes:
  64. Complete source code for visualization program and utilities
  65. 2 sample data sets
  66. Sample conversion program to put your data into VIS-5D format
  67. Documentation and porting guide
  68. Executable files are also available
  69.  
  70. Contact:
  71.         Bill Hibbard (whibbard@macc.wisc.edu)
  72.         Brian Paul (bpaul@macc.wisc.edu)
  73.  
  74. Space Science and Engineering Center
  75. University of Wisconsin - Madison
  76. 1225 W. Dayton St.
  77. Madison, WI  53706
  78.  
  79. -------- documentation and source code for file conversion program ----------
  80.  
  81. 3. PUTTING YOUR DATA INTO VIS-5D FILES
  82.  
  83.      A data set for VIS-5D has a real number at each point
  84. in a five-dimensional grid.  These data are organized into a
  85. series of three-dimensional spatial grids whose dimensions
  86. are latitude, longitude and height (i.e. altitude).  The
  87. three-dimensional grids are organized into short sequences
  88. to enumerate the values of multiple physical variables at a
  89. single time.  The short sequences of physical variables are
  90. repeated into a longer sequence which steps through many
  91. time steps.
  92.  
  93.      These data are stored in our 3D grid files.  A 3D grid
  94. file is identified with an integer between 1 and 9999, and
  95. contains a sequence of 3D grids, which are also identified
  96. by integers.  A 3D grid file contains a directory entry for
  97. each 3D grid, which describes the size and geographic
  98. location of the grid, and the date, time and name of
  99. physical variable of the data in the grid array.  A five-
  100. dimensional data set consists of a sequence of 3D grids in a
  101. 3D grid file, all with the same size and geographic
  102. locations.  The grid sequence repeats the same short
  103. sequence of physical variables stepping forward through
  104. time.  For example, the grid sequence from a weather model
  105. could be:
  106.  
  107.                       PHYSICAL
  108.    GRID               VARIABLE
  109.   NUMBER  DATE  TIME    NAME
  110.      1   88035 000000    U
  111.      2   88035 000000    V
  112.      3   88035 000000    W
  113.      4   88035 000000    T
  114.      5   88035 000000    P
  115.      6   88035 010000    U
  116.      7   88035 010000    V
  117.      8   88035 010000    W
  118.      9   88035 010000    T
  119.     10   88035 010000    P
  120.     11   88035 020000    U
  121.     12   88035 020000    V
  122.     13   88035 020000    W
  123.     14   88035 020000    T
  124.     15   88035 020000    P
  125.  
  126.      This data set consists of 3 time steps of 5 physical
  127. variables.  The physical variables are the U, V and W
  128. components of the wind vector, the temperature T and the
  129. pressure P.  The date is February 4, 1988 and the time steps
  130. are midnight, 1 AM and 2 AM.  Dates are represented by five
  131. digit decimal integers YYDDD where YY are the last two
  132. digits of the year and DDD is the three digit day within the
  133. year, so February 4, 1988 is 88035.  Times are represented
  134. by six digit decimal integers HHMMSS where HH are the hour,
  135. MM are the minute, and SS are the second, so 2 AM is 020000.
  136.  
  137.      The following sample program creates a 3D grid file and
  138. fills its 3D grids with data for a five-dimensional data
  139. set.  It is repeated in the file sample.F, with make file
  140. sample.m.  The easiest way to read your data into a 3D grid
  141. file is to alter the sample.F program.  The subroutines it
  142. calls are all in the libmain.a library, and their source is
  143. in the src subdirectory.  Here is a listing of sample.F:
  144.  
  145.   1 C THE MAIN PROGRAM OF YOUR CONVERSION PROGRAM MUST
  146.   2 C BE NAMED SUBROUTINE MAIN0
  147.   3 C
  148.   4       SUBROUTINE MAIN0
  149.   5 C
  150.   6 C THE NEXT TWO COMMENTS ARE PRINTED BY THE 'help sample'
  151. COMMAND
  152.   7 C ? SAMPLE program to convert data to 3D grid files
  153.   8 C ? sample gridf#
  154.   9 C
  155.  10 C DIMENSIONS OF 3D GRID
  156.  11 C NOTE NLATS AND NLONS MUST BOTH BE LESS THAN OR EQUAL
  157. TO 150
  158.  12 C NLATS, NLONS AND NHGTS MUST ALL BE AT LEAST 2
  159.  13       PARAMETER (NLATS=31,NLONS=51,NHGTS=16)
  160.  14 C
  161.  15 C NUMBER OF PHYSICAL VARIABLES AND NUMBER OF TIME STEPS
  162.  16 C NOTE EITHER OR BOTH MAY BE EQUAL TO 1.  THAT IS, VIS-5D DOES
  163.  17 C NOT FORCE YOU TO HAVE MULTIPLE VARIABLES OR TIME
  164. DYNAMICS.
  165.  18       PARAMETER (NVARS=5,NTIMES=100)
  166.  19 C
  167.  20 C ARRAY FOR 3D GRID DATA
  168.  21       REAL*4 G(NLATS, NLONS, NHGTS)
  169.  22 C ARRAYS FOR GRID FILE ID AND GRID DIRECTORY
  170.  23       INTEGER ID(8), IDIR(64)
  171.  24 C ARRAY FOR VARIABLE NAMES
  172.  25       CHARACTER*4 CNAME(5)
  173.  26 C
  174.  27 C LATITUDE, LONGITUDE AND HEIGHT BOUNDS FOR SPATIAL GRID
  175.  28       DATA XLATS/20.0/,XLATN/50.0/
  176.  29       DATA XLONE/70.0/,XLONW/120.0/
  177.  30       DATA XHGTB/0.0/,XHGTT/15.0/
  178.  31 C
  179.  32 C STARTING DATE IN YYDDD AND TIME IN HHMMSS
  180.  33       DATA JDAY/88035/,JTIME/020000/
  181.  34 C TIME STEP IN HHMMSS
  182.  35       DATA JSTEP/000100/
  183.  36 C
  184.  37 C NAMES OF THE FIVE PHYSICAL VARIABLES
  185.  38       DATA CNAME/'U   ', 'V   ', 'W   ', 'T   ', 'P   '/
  186.  39 C INITIALIZE GRID DIRECTORY TO ZEROS
  187.  40       DATA IDIR/64*0/
  188.  41 C
  189.  42 C READ GRID FILE NUMBER FROM COMMAND LINE.  IPP WILL
  190.  43 C CONVERT THE PARAMETER # 1 TO AN INTEGER, WITH A
  191. DEFAULT
  192.  44 C VALUE OF 0.
  193.  45       IGRIDF=IPP(1,0)
  194.  46 C IF ILLEGAL GRID FILE NUMBER, PRINT ERROR MESSAGE AND
  195. RETURN
  196.  47       IF(IGRIDF .LT. 1 .OR. IGRIDF .GT. 9999) THEN
  197.  48         CALL EDEST('BAD GRID FILE NUMBER ',IGRIDF)
  198.  49         CALL EDEST('MUST BE BETWEEN 1 AND 9999 ',0)
  199.  50         RETURN
  200.  51       ENDIF
  201.  52 C
  202.  53 C CALCULATE GRID INTERVALS
  203.  54       XLATIN=(XLATN-XLATS)/(NLATS-1)
  204.  55       XLONIN=(XLONW-XLONE)/(NLONS-1)
  205.  56       XHGTIN=(XHGTT-XHGTB)/(NHGTS-1)
  206.  57 C
  207.  58 C DATE AND TIME FOR FIRST TIME STEP
  208.  59 C IDAYS CONVERTS YYDDD FORMAT TO DAYS SINCE JAN. 1, 1900
  209.  60       IDAY=IDAYS(JDAY)
  210.  61 C ISECS CONVERTS HHMMSS FORMAT TO SECONDS SINCE MIDNIGHT
  211.  62       ISEC=ISECS(JTIME)
  212.  63 C
  213.  64 C INITIALIZE GRID IDENTIFIER TEXT TO BLANKS
  214.  65 C NOTE LIT CONVERTS A CHARACTER*4 TO AN INTEGER*4
  215.  66       DO 10 I=1,8
  216.  67 10    ID(I)=LIT('    ')
  217.  68 C
  218.  69 C SET UP DIRECTORY ENTRY
  219.  70 C
  220.  71 C DIMENSIONS OF GRID
  221.  72       IDIR(1)=NLATS*NLONS*NHGTS
  222.  73       IDIR(2)=NLATS
  223.  74       IDIR(3)=NLONS
  224.  75       IDIR(4)=NHGTS
  225.  76 C
  226.  77 C LATITUDES AND LONGITUDES IN DEGREES * 10000
  227.  78       IDIR(22)=4
  228.  79       IDIR(23)=NINT(XLATN*10000.)
  229.  80       IDIR(24)=NINT(XLONW*10000.)
  230.  81       IDIR(25)=NINT(XLATIN*10000.0)
  231.  82       IDIR(26)=NINT(XLONIN*10000.0)
  232.  83 C
  233.  84 C HEIGHTS IN METERS
  234.  85       IDIR(31)=1
  235.  86       IDIR(32)=NINT(XHGTT*1000.)
  236.  87       IDIR(33)=NINT(XHGTIN*1000.)
  237.  88 C
  238.  89 C CREATE THE GRID FILE
  239.  90       CALL IGMK3D(IGRIDF, ID, NLATS*NLONS*NHGTS)
  240.  91 C
  241.  92 C LOOP FOR TIME STEPS
  242.  93       DO 200 IT=1,NTIMES
  243.  94 C
  244.  95 C SET DATE AND TIME IN DIRECTORY ENTRY
  245.  96 C IYYDDD CONVERTS DAYS SINCE JAN. 1, 1900 TO OUR YYDDD
  246. FORMAT
  247.  97       IDIR(6)=IYYDDD(IDAY)
  248.  98 C IHMS CONVERTS SECONDS SINCE MIDNIGHT TO OUR HHMMSS
  249. FORMAT
  250.  99       IDIR(7)=IHMS(ISEC)
  251. 100 C
  252. 101 C LOOP FOR PHYSICAL VARIABLES
  253. 102       DO 190 IV=1,NVARS
  254. 103 C
  255. 104 C SET VARIABLE NAME IN DIRECTORY ENTRY
  256. 105       IDIR(9)=LIT(CNAME(IV))
  257. 106 C
  258. 107 C
  259. ************************************************************
  260. *
  261. 108 C READ YOUR DATA FOR TIME STEP NUMBER IT AND VARIABLE
  262. NUMBER IV
  263. 109 C INTO THE ARRAY G HERE.
  264. 110 C NOTE THAT G(1,1,1) IS THE NORTH WEST BOTTOM CORNER AND
  265. 111 C G(NLATS,NLONS,NHGTS) IS THE SOUTH EAST TOP CORNER.
  266. 112 C MARK A GRID POINT AS 'MISSING DATA' BY SETTING IT =
  267. 1.0E35
  268. 113 C
  269. ************************************************************
  270. *
  271. 114 C
  272. 115 C CALCULATE 3D GRID NUMBER
  273. 116       IGRID=IV+NVARS*(IT-1)
  274. 117 C WRITE DATA IN G AND DIRECTORY IN IDIR TO 3D GRID
  275. 118 C NOTE WE PASS THE NEGATIVE OF THE GRID NUMBER (I.E. -
  276. IGRID)
  277. 119       CALL IGPT3D(IGRIDF,-
  278. IGRID,G,NLATS,NLONS,NHGTS,IDIR,IGNO)
  279. 120 C
  280. 121 C END OF PHYSICAL VARIABLE LOOP
  281. 122 190   CONTINUE
  282. 123 C
  283. 124 C INCREMENT DATE AND TIME, CONVERT JSTEP FROM HHMMSS TO
  284. SECONDS
  285. 125       ISEC=ISEC+ISECS(JSTEP)
  286. 126 C IF SECONDS CARRY PAST ONE DAY, ADJUST SECONDS AND DAYS
  287. 127       IDAY=IDAY+ISEC/(24*3600)
  288. 128       ISEC=MOD(ISEC,24*3600)
  289. 129 C
  290. 130 C END OF TIME STEP LOOP
  291. 131 200   CONTINUE
  292. 132 C
  293. 133       RETURN
  294. 134       END
  295.  
  296.      The routines IGMK3D and IGPT3D are the interface to the
  297. 3D grid structures.  The call to IGMK3D at line 90 creates a
  298. 3D grid file. Its parameters are:
  299.  
  300.    1  INTEGER*4 - number of 3D grid file to create
  301.    2  array of 8 INTEGER*4 - a 32 byte text ID for the file
  302.    3  INTEGER*4 - maximum number of grid points in any 3D
  303. grid.
  304.  
  305. After the 3D grid file is created, IGPT3D is called in line
  306. 119 once for each combination of time step and physical
  307. variable to put 3D grids into the file.  Its parameters are:
  308.  
  309.    1  INTEGER*4 - number of 3D grid file to write to
  310.    2  INTEGER*4 - minus the number of the 3D grid to write.
  311. This is
  312.                   0 or positive to indicate write to next
  313. empty grid.
  314.    3  array of REAL*4 - array of grid points to write
  315.    4  INTEGER*4 - first dimension of grid array, # of
  316. latitudes
  317.    5  INTEGER*4 - second dimension of grid array, # of
  318. longitudes
  319.    6  INTEGER*4 - third dimension of grid array, # of
  320. heights
  321.    7  array of 64 INTEGER*4 - directory for 3D grid
  322.    8  INTEGER*4 - number of 3D grid actually written,
  323. returned by
  324.                   IGPT3D.
  325.  
  326.      VIS-5D allows data sets which span more than one 3D
  327. grid file.  In this case the grid sequence of repeating
  328. variables and repeating time steps continues across grid
  329. file boundaries.  A single 3D grid file is limited to
  330. 100,000,000 grid points (400 megabytes).  If your data set
  331. contains more than this number of grid points, then you
  332. should alter sample.F to create a new 3D grid file (by
  333. incrementing IGRIDF and calling IGMK3D) on every Nth time
  334. step, where N time steps will fit in one 3D grid file.  Note
  335. that the comp5d command described in section 4 references
  336. data sets as sequences of 3D grid files.
  337.  
  338.      The VIS-5D system processes the gridded data based on
  339. the information in the grid directories, which is contained
  340. in the IDIR array in the sample.F program.  It is a good
  341. idea to initialize IDIR to all zeros, as in line 40.  The
  342. size of the 3D grid is set in entries 1 to 4 of IDIR (lines
  343. 72 to 75).  Note the restrictions on data set size described
  344. in section 4 of this document.
  345.  
  346.      The date and time of the 3D grid are set in entries 6
  347. and 7 of IDIR, as in lines 97 and 99.  Note that they are
  348. represented in our YYDDD and HHMMSS formats described above.
  349. Four functions are available in libmain.a for converting
  350. between these formats and a format which makes date and time
  351. calculations easy.  The IDAYS function converts YYDDD format
  352. to days since January 1, 1900, as in line 60.  The ISECS
  353. function converts HHMMSS format to seconds since midnight,
  354. as in lines 62 and 125.  This makes it easy to do
  355. calculations with dates and times, as in lines 125, 127 and
  356. 128.  Then the IYYDDD function converts days back to YYDDD
  357. and the IHMS function converts back to HHMMSS, as in lines
  358. 97 amd 99.
  359.  
  360.      The physical variable name is 4 ASCII characters packed
  361. into entry 9 of IDIR, as in line 105.  The LIT function in
  362. libmain.a converts a CHARACTER*4 to an INTEGER*4.
  363.  
  364.      The spatial location of the grid is described in terms
  365. of latitude and longitude in ten-thousandths of a degree,
  366. and in terms of height (altitude) in meters.  The grid
  367. element G(1,1,1) is in the north west bottom corner of the
  368. grid, and the grid element G(NLATS,NLONS,NHGTS) is in the
  369. south east top corner.  The grid latitude and longitude are
  370. described in entries 21 to 25 of IDIR, as in lines 78 to 82.
  371. The grid heights are described in entries 31 to 33, as in
  372. lines 85 to 87.  The NINT function is a FORTRAN intrinsic
  373. for converting a REAL to the nearest INTEGER.  The latitude,
  374. longitude and height spacings are simply the distances
  375. between between successive grid points.  Latitudes are
  376. positive in the northern hemisphere, longitudes are positive
  377. in the western hemispere, and of course heights are positive
  378. above sea level.
  379.  
  380.      The real work in modifying the sample.F program is
  381. writing code for getting your data into the G array, in
  382. lines 107 to 113.  For some data you may want to fake the
  383. latitude, longitude and height coordinates.  However, if
  384. your data is geographical and large scale, then you may want
  385. to describe its location accurately, and it may be necessary
  386. to resample your data to a regularly spaced grid in
  387. latitude, longitude and height from some other map
  388. projection.  It may also be necessary to transpose your data
  389. array to get the index order to be LAT, LON and HGT, and to
  390. invert your data array in some index to make sure G(1,1,1)
  391. is the north west bottom corner.  Even in faked coordinates,
  392. you may need to transpose or invert your data array to get
  393. the right 'handedness' in the display.  The VIS-5D system
  394. allows grid points marked as missing, indicated by array
  395. values greater than 1.0E30.  If you do fake the latitude,
  396. longitude and height coordinates, then the topography and
  397. map display of the vis5d program will be meaningless.  If
  398. you calculate trajectories for your data set, either use
  399. accurate coordinates, or take great care to get relative
  400. time, distance and velocity scales consistent in the faked
  401. coordinates.  Otherwaise trajectory paths will not be
  402. realistic.
  403.  
  404.      The IPP function in libmain.a returns the value of a
  405. command parameter as INTEGER*4, as in line 45.  There are
  406. similar functions CPP and DPP in libmain.a which return
  407. CHARACTER*12 (converted to upper case) and REAL*8 values for
  408. command parameters.  They get command parameters based on
  409. their sequential position in the command line.  They all
  410. have similar function parameters:
  411.  
  412.    1  INTEGER*4 - sequence number of command parameter
  413.    2 (IPP) INTEGER*4 - default value of command parameter
  414. or
  415.    2 (CPP) CHARACTER*12 - default value of command parameter
  416. or
  417.    2 (DPP) REAL*8 - default value of command parameter.
  418.  
  419. There is also a mechanism for picking up command parameters
  420. based on keywords.  This is done with the functions IKWP,
  421. CKWP and DKWP in libmain.a.  They get command parameters
  422. based on position after a keyword of the form '-keyword'.
  423. IKWP returns an INTEGER*4, CKWP returns a CHARACTER*12
  424. (converted to upper case) and DKWP returns a REAL*8.  They
  425. all have similar function parameters:
  426.  
  427.    1  CHARACTER*12 - keyword string in command line
  428.    2  INTEGER*4 - sequence number of command parameter after
  429. keyword
  430.    3 (IKWP) INTEGER*4 - default value of command parameter
  431. or
  432.    3 (CKWP) CHARACTER*12 - default value of command
  433. parameter
  434. or
  435.    3 (DKWP) REAL*8 - default value of command parameter.
  436.  
  437. The NKWP function in libmain.a returns the number of
  438. sequential parameters after a keyword.  Its function
  439. parameter is:
  440.  
  441.    1  CHARACTER*12 - keyword string in command line.
  442.  
  443.      On the most machines the REAL*4 format is not a subset
  444. of the REAL*8 format, so make sure to declare DPP and DKWP
  445. as REAL*8, as well as their third function parameters (for
  446. default values of command parameters).
  447.  
  448.      If you would rather write your grid conversion program
  449. in C instead of FORTRAN, look at the file 'sample.c'.  It
  450. contains examples of how to easily read and write grid files
  451. using C structures and routines in stdio.
  452.  
  453.      To make your own topography files for use with the -
  454. topo option there is a maketopo.c program in the vis5d/src/
  455. directory.  It explains the format of the file and shows how
  456. to create such files.
  457.  
  458.