GMS:Dataset Files

From XMS Wiki
(Redirected from GMS:ASCII Data Set Files)
Jump to navigationJump to search

ASCII Dataset Files

Datasets can be stored to either ASCII or binary files. The default format is binary. Datasets can be saved in ASCII format by right clicking on the dataset in the Project Explorer and selecting the Export command from the pop up menu. For both file formats, multiple datasets can be stored in a single file and both scalar and vector datasets can be saved to the same file. The file format is identical for 2D and 3D datasets.

For scalar dataset files, one value is listed per vertex, cell, node, or scatter point. The points are listed sequentially in ascending order according to the ids of the nodes, points, vertices, or cells. For vector dataset files, one set of XYZ vector components is listed per vertex, cell, node, or scatter point. If necessary, a set of status flags can be included in the file. If the status flag is false (0), the corresponding item (node, cell, etc.) is inactive. If status flags are not included in the file, it is assumed that all items are active.

The ASCII Dataset file format is as follows:

DATASET         // File type identifier

OBJTYPE type    // Type of object  dataset is associated with

REFTIME reftime // A value corresponding to  beginning date/time of dataset

BEGSCL          // Beginning  of scalar dataset

OBJID id        // Object id

ND numdata      // Number  of data values

NC numcells     // Number of cells or elements

NAME "name"      // Dataset name

ACTTS time      // Marks the active time step

MAPTS  time      // Marks the time step which is mapped as elevations

TS istat time    // Time step of the following data

stat1           // Status  flags

stat2

.

.

statnumcells

val1            // Scalar data  values

val2

.

.

valnumdata

// Repeat TS card for each time  step

ENDDS           // End of dataset

BEGVEC          // Beginning of  vector dataset

VECTYPE type    // Vector at node/gridnode or  element/cell

OBJID id        // Object id

ND numdata      // Number of  data values

NC numcells     // Number of cells or elements

NAME "name"      // Dataset name

TS istat time   // Time step of the following  data

stat1           // Status  flags

stat2

.

.

statnumcells

vx1 vy1 vz1

vx2 vy2  vz2

.

.

vnumdata vnumdata vnumdata

// Repeat TS card for each time  step

ENDDS           // End of dataset

// Repeat BEGSCL and BEGVEC  sequences for each dataset

Sample ASCII Dataset File:

DATASET

OBJTYPE grid2d

REFTIME 945.348729

BEGSCL

ACTTS 1.00000000e+00

ND 8

NC 8

NAME  "trichloroethylene"

TS 1  1.00000000e+00

0

0

0

1

1

1

1

0

0.00000000e+00

0.00000000e+00

0.00000000e+00

3.24000000e+00

4.39000000e+00

2.96000000e+00

7.48000000e+00

0.00000000e+00

ENDDS

BEGVEC

VECTYPE  0

ND 8

NC 8

NAME "velocity"

TS 1  5.00000000e+00

0

0

0

1

1

1

1

0

1.60000000e+01  1.60000000e+01 3.20000000e+01

6.40000000e+01 6.40000000e+01  1.28000000e+02

1.44000000e+02 1.44000000e+02 2.88000000e+02

1.96000000e+02  1.96000000e+02 3.92000000e+02

2.25000000e+02 2.25000000e+02  4.50000000e+02

9.21600000e+03 9.21600000e+03 1.84320000e+04

9.60400000e+03  9.60400000e+03 1.92080000e+04

9.80100000e+03 9.80100000e+03  1.96020000e+04

ENDDS

If variograms have been defined for a dataset or time step of a dataset within GMS, the variograms are saved in the dataset file. The variogram cards are not documented.

The card types used in the scalar dataset file format are as follows:

Card Type DATASET
Decription File type identifier. Must be on first line of file. No fields.
Required YES


Card Type OBJTYPE
Decription Identifies the type of objects that the datasets in the file are associated with.
Required YES. If card does not exist, the file can only be read through the Data Browser. The datasets would then be assigned to the objects corresponding to the active module.
Format OBJTYPE type
Sample OBJTYPE tin


Field Variable Value Description
1 type tin TINs
mesh2d 2D meshes
grid2d 2D grids
scat2d 2D scatter points
mesh3d 3D meshes
grid3d 3D grids
scat3d 3D scatter points


Card Type REFTIME
Decription A value corresponding to the beginning date/time of the dataset.
Required NO
Format REFTIME reftime
Sample REFTIME 3982.897459
Field Variable Value Description
1 reftime " +/- " A value corresponding to the beginning date/time of the dataset.


Card Type BEGSCL
Decription Scalar dataset file identifier. Marks beginning of scalar dataset. No fields.
Required YES


Card Type BEGVEC
Decription Vector dataset file identifier. Marks beginning of vector dataset. No fields.
Required YES


Card Type ACTTS
Decription Used to mark the active dataset. The card should be placed after the BEGSCL or BEGVEC card of the active dataset and the active time step should be listed.
Required NO
Format ACTTS time
Sample ACTTS 0.00
Field Variable Value Description
1 time " +/- " The time corresponding to the active time step. Use 0.0 for steady state datasets.


Card Type MAPTS
Decription Used to mark the dataset which is mapped to the object elevations. The card should be placed after the BEGSCL or BEGVEC card of the mapped dataset and the mapped time step should be listed.
Required NO
Format MAPTS time
Sample MAPTS 0.00
Field Variable Value Description
1 time " +/- " The time corresponding to the mapped time step. Use 0.0 for steady state datasets.


Card Type OBJID
Decription The unique id of the object the dataset is associated with.
Required This card is required for datasets associated with TINs and scatter point sets.
Format OBJID id
Sample OBJID 2383
Field Variable Value Description
1 id " + " The unique id of the object.


Card Type VECTYPE
Decription Identifies the type of vector data that will be read and where to apply it.
Required This card is only required if the vector data is associated with elements/cells. If this card is not present, it is assumed that the data are associated with nodes/gridnodes.
Format VECTYPE tpye
Sample VECTYPE 0
Field Variable Value Description
1 type " 0,1 " 0 = The vectors will be applied to the nodes/gridnodes. 1 = The vectors will be applied to the elements/cells


Card Type ND
Decription The number of data values that will be listed per time step. This number should correspond to the total number of vertices, nodes, cells centers (cell-centered grid), cell corners (mesh-centered grid), maximum node id (meshes) or scatter points.
Required YES
Format ND numdata
Sample ND 10098
Field Variable Value Description
1 numdata " + " The number of items. At each time step, numdata values are printed.


Card Type NC
Decription This number should correspond to the maximum element id (meshes) or the number of cells (grids).
Required YES
Format NC numcells
Sample NC 3982
Field Variable Value Description
1 numcells " + " The number of elements or cells


Card Type NAME
Decription The name of the dataset
Required YES
Format NAME "name"
Sample NAME "Total head"
Field Variable Value Description
1 "name" str The name of the dataset in double quotes.


Card Type TS
Decription Marks the beginning of a new time step, indicates if stat flags are given, and defines the time step value, status flags, and scalar data values for each item.
Required YES
Format

TS istat time stat1 stat2 . . stat numcells val1 val2 . . valnumdata

Sample

TS 1 12.5 0 1 1 1 34.5 74.3 58.4 72.9

Field Variable Value Description
1 istat 0,1 -
2 time + The time step value. If only one time step exists, the time is not required
3 - (nd+2) stat 0,1 The status of each item. If active, stat=1. If inactive stat=0. Omitted if i=0 on STAT card.
(nd+2) - (2nd+2) val " +/- " The scalar data values of each item


Cardtype ENDDS
Description Marks the end of a scalar opr vector dataset. No fields
Required YES

Binary Dataset Files

Datasets saved with a GMS project are saved in the binary format. The binary format is patterned after the ASCII format in that the data are grouped into "cards". However, the cards are identified by a number rather than a card title. The card ids are four byte integers. The binary format is as follows:

Card Item Size Description
version 4 byte integer The GMS binary dataset file format version. value = 3000.
100 object type 4 byte integer Identifies the type of objects that the datasets in the file are associated with. Options are as follows:
 1 TINs
 2 Boreholes
 3 2D meshes
 4 2D grids
 5 2D scatter points
 6 3D meshes
 7 3D grids
 8 3D scatter points
110 SFLT 4 byte integer The number of bytes that will be used in the remainder of the file for each floating point value (4, 8, or 16).
120 SFLG 4 byte integer The number of bytes that will be used in the remainder of the file for status flags.
130 or 140 BEGSCL or BEGVEC Marks the beginning of a set of cards defining a scalar or vector dataset.
220 ACTTS SFLT real Marks the active dataset and time step
230 MAPTS SFLT real Marks the mapped dataset and time step
150 VECTYPE 4 byte integer (0 or 1) In the case of vector dataset files, indicates whether the vectors will be applied at the nodes/gridnodes or the elements/cells.
160 OBJID 4 byte integer The id of the associated object. Value is ignored for grids and meshes.
170 NUMDATA 4 byte integer The number of data values that will be listed per time step. This number should correspond to the number of vertices, nodes, cell centers (cell-centered grid), cell corners (mesh-centered grid) or scatter points.
180 NUMCELLS 4 byte integer This number should correspond to the number of elements (meshes) or the number of cells (mesh-centered grids). Value is ignored for other object types.
190 NAME 40 bytes The name of the dataset. Use one character per byte. Mark the end of the string with the '\0' character.
195 REFTIME 8 bytes A value corresponding to the beginning date/time of the dataset.
200 TS Marks the beginning of a time step.
ISTAT SFLG integer (0 or 1) Indicates whether or not status flags will be included in the file.
TIME SFLT real Time corresponding to the time step.
statflag1 SFLG integer Status flag (0 or 1) for node 1
statflag2 SFLG integer Status flag (0 or 1) for node 2
...
val1 SFLT real Scalar value for item 1
val2 SFLT real Scalar value for item 2
...
Repeat card 200 for each timestep in the dataset.
210 ENDDS Signal the end of a set of cards defining a dataset.

The cards in the binary dataset file are as follows:

Card Type Version
Card Id 3000
Description File type identifier. No fields.
Required Yes
Card Type ObjType
Card Id 100
Description Identifies the type of objects that the datasets in the file are associated with.
Required YES. If card does not exist, the file can only be read through the Data Browser. The datasets would then be assigned to the objects corresponding to the active module.
Feild Variable Size Value Description
1 id 4 byte int 1,2,3,4,5,6,7,8, TINs, Boreholes, 2D meshes, 2D grids, 2D scatter points, 3D meshes, 3D grids, 3D scatter points

Using Vector and Scalar Data with Grids

For meshes, TINs, and scatter point sets, the order that the values are listed in the file is simply the sequential order of the node, TIN, or scatter point ids. However, vector and scalar data can also be associated with the nodes or cells of a 2D or 3D grid. T For 2D grids, data values are ordered using a row-column (I-J) priority. For 3D grids, data values are ordered using a layer-row-column (K-I-J) priority.

The following C source code examples illustrate how a 2D or 3D array of scalar values corresponding to the nodes of a grid would be written to the main portion of an ASCII scalar file.

2D Grid Example:

for(i=0; i<nrow; i++){

for(j=0; j<ncol; j++){

fprintf(fp, "%f\n", scalar[i][j]);

}

}

3D Grid Example:

for(k=0; k<nlay; k++){

for(i=0; i<nrow; i++){

for(j=0; j<ncol; j++){

fprintf(fp, "%f\n", scalar[k][i][j]); 

}

}

}

Related Links