GMS:Dataset Files: Difference between revisions

From XMS Wiki
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
==ASCII Data Set Files==
==ASCII Dataset Files==
Data sets can be stored to either ASCII or binary files. The default format is binary. Data sets can be saved in ASCII format by  right clicking on the data set in the [[GMS:The GMS Screen|Project Explorer]] and selecting the '''''Export''''' command from the pop up menu.  For both file formats, multiple data sets can be stored in a single file and  both scalar and vector data sets can be saved to the same file. The file format  is identical for 2D and 3D data sets.
Data sets 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 data set in the [[GMS:The GMS Screen|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 data set 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 data set 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.
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 Data Set file format is as follows:'''
'''The ASCII Data Set file format is as follows:'''
Line 9: Line 9:
<sub>DATASET        // File type identifier
<sub>DATASET        // File type identifier


OBJTYPE type    // Type of object  data set is associated with
OBJTYPE type    // Type of object  dataset is associated with


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


BEGSCL          // Beginning  of scalar data set
BEGSCL          // Beginning  of scalar dataset


OBJID id        // Object id
OBJID id        // Object id
Line 51: Line 51:
// Repeat TS card for each time  step
// Repeat TS card for each time  step


ENDDS          // End of data set
ENDDS          // End of dataset


BEGVEC          // Beginning of  vector dataset
BEGVEC          // Beginning of  vector dataset
Line 89: Line 89:
// Repeat TS card for each time  step
// Repeat TS card for each time  step


ENDDS          // End of data set
ENDDS          // End of dataset


// Repeat BEGSCL and BEGVEC  sequences for each data set</sub>
// Repeat BEGSCL and BEGVEC  sequences for each dataset</sub>


'''Sample ASCII Data Set File:'''
'''Sample ASCII Dataset File:'''


<sub>DATASET
<sub>DATASET
Line 193: Line 193:
ENDDS</sub>
ENDDS</sub>


If variograms have been defined for a data set or time step of a data set within GMS, the variograms are saved in the data set file. The variogram cards  are not documented.
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 data set file format are as follows:
The card types used in the scalar data set file format are as follows:
Line 211: Line 211:
|width="400pt"|'''OBJTYPE'''
|width="400pt"|'''OBJTYPE'''
|-
|-
|''Decription''||Identifies the type of objects  that the data sets in the file are associated with.
|''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 data sets would then be  assigned to the objects corresponding to the active module.
|''Required''||YES.  If card does not exist, the  file can only be read through the Data Browser.  The data sets would then be  assigned to the objects corresponding to the active module.
Line 247: Line 247:
|width="400pt"|'''REFTIME'''
|width="400pt"|'''REFTIME'''
|-
|-
|''Decription||A value corresponding to the  beginning date/time of the data set.
|''Decription||A value corresponding to the  beginning date/time of the dataset.
|-
|-
|''Required''||NO
|''Required''||NO
Line 261: Line 261:
|width="220pt"|''Description''
|width="220pt"|''Description''
|-
|-
|1||reftime||" +/- "||A value corresponding to the  beginning date/time of the data set.
|1||reftime||" +/- "||A value corresponding to the  beginning date/time of the dataset.
|}
|}


Line 269: Line 269:
|width="400pt"|'''BEGSCL'''
|width="400pt"|'''BEGSCL'''
|-
|-
|''Decription||Scalar data set file identifier.  Marks beginning of scalar data set.  No fields.  
|''Decription||Scalar dataset file identifier.  Marks beginning of scalar dataset.  No fields.  
|-
|-
|''Required''||YES
|''Required''||YES
Line 279: Line 279:
|width="400pt"|'''BEGVEC'''
|width="400pt"|'''BEGVEC'''
|-
|-
|''Decription||Vector data set file identifier.  Marks beginning of vector data set.  No fields.  
|''Decription||Vector dataset file identifier.  Marks beginning of vector dataset.  No fields.  
|-
|-
|''Required''||YES
|''Required''||YES
Line 289: Line 289:
|width="400pt"|'''ACTTS'''
|width="400pt"|'''ACTTS'''
|-
|-
|''Decription||Used to mark the active data set.  The card should be placed after the BEGSCL or BEGVEC card of the active data set and the active time step should be listed.  
|''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
|''Required''||NO
Line 303: Line 303:
|width="220pt|''Description''
|width="220pt|''Description''
|-
|-
|1||time||" +/- "||The time corresponding to the  active time step.  Use 0.0 for steady state data sets.
|1||time||" +/- "||The time corresponding to the  active time step.  Use 0.0 for steady state datasets.
|}
|}


Line 311: Line 311:
|width="400pt"|'''MAPTS'''
|width="400pt"|'''MAPTS'''
|-
|-
|''Decription||Used to mark the data set which is  mapped to the object elevations.  The card should be placed after the BEGSCL or  BEGVEC card of the mapped data set and the mapped time step should be  listed.
|''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
|''Required''||NO
Line 325: Line 325:
|width="220pt|''Description''
|width="220pt|''Description''
|-
|-
|1||time||" +/- "||The time corresponding to the mapped time step.  Use 0.0 for steady state data sets.
|1||time||" +/- "||The time corresponding to the mapped time step.  Use 0.0 for steady state datasets.
|}
|}


Line 335: Line 335:
|''Decription||The unique id of the object the  data set is associated with.
|''Decription||The unique id of the object the  data set is associated with.
|-
|-
|''Required''||This card is required for data  sets associated with TINs and scatter point sets.
|''Required''||This card is required for datasets associated with TINs and scatter point sets.
|-
|-
|''Format''||OBJID id
|''Format''||OBJID id
Line 422: Line 422:
|width="400pt"|'''NAME'''
|width="400pt"|'''NAME'''
|-
|-
|''Decription||The name of the data set
|''Decription||The name of the dataset
|-
|-
|''Required''||YES
|''Required''||YES
Line 436: Line 436:
|width="220pt|''Description''
|width="220pt|''Description''
|-
|-
|1||"name"||str||The name of the dataset in double quotes.  
|1||"name"||str||The name of the dataset in double quotes.  
|}
|}


Line 498: Line 498:
|''Cardtype''||''ENDDS''
|''Cardtype''||''ENDDS''
|-
|-
|''Description||Marks the end of a scalar opr vector data set.  No fields
|''Description||Marks the end of a scalar opr vector dataset.  No fields
|-
|-
|''Required''||YES
|''Required''||YES
Line 516: Line 516:
| version|| 4 byte integer|| The GMS binary data set file format version. value = 3000.
| version|| 4 byte integer|| The GMS binary data set file format version. value = 3000.
|-
|-
|100||object type||4 byte integer||Identifies the type of objects that the data sets in the file are associated with. Options are as follows:
|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
   1 TINs
   2 Boreholes
   2 Boreholes
Line 532: Line 532:
|130 or 140||BEGSCL or BEGVEC||  ||Marks the beginning of a set of cards defining a scalar or vector data set.
|130 or 140||BEGSCL or BEGVEC||  ||Marks the beginning of a set of cards defining a scalar or vector data set.
|-
|-
|220||ACTTS||SFLT real||Marks the active data set and time step
|220||ACTTS||SFLT real||Marks the active dataset and time step
|-
|-
|230||MAPTS||SFLT real||Marks the mapped data set 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 data set files, indicates whether the vectors will be applied at the nodes/gridnodes or the elements/cells.
|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.
|160||OBJID||4 byte integer||The id of the associated object. Value is ignored for grids and meshes.
Line 546: Line 546:
|190||NAME||40 bytes||The name of the dataset. Use one character per byte. Mark the end of the string with the '\0' character.
|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 data set.
|195||REFTIME||8 bytes||A value corresponding to the beginning date/time of the dataset.
|-
|-
|200||TS||  ||Marks the beginning of a time step.
|200||TS||  ||Marks the beginning of a time step.
Line 566: Line 566:
|...||  ||  ||
|...||  ||  ||
|-
|-
|  ||  ||  ||Repeat card 200 for each timestep in the data set.
|  ||  ||  ||Repeat card 200 for each timestep in the dataset.
|-
|-
|210||ENDDS||  ||Signal the end of a set of cards defining a data set.
|210||ENDDS||  ||Signal the end of a set of cards defining a dataset.
|}
|}


The cards in the binary data set file are as follows:
The cards in the binary dataset file are as follows:


{| border="1" cellpadding="2"
{| border="1" cellpadding="2"
Line 592: Line 592:
|''Description''||colspan="3"|Identifies the type of objects that the data sets in the file are associated with.
|''Description''||colspan="3"|Identifies the type of objects that the data sets in the file are associated with.
|-
|-
|''Required''||colspan="3"|YES.  If card does not exist, the file can only be read through the Data Browser.  The data sets would then be assigned to the objects corresponding to the active module.
|''Required''||colspan="3"|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.
|}
|}



Revision as of 19:47, 12 November 2012

ASCII Dataset Files

Data sets 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 data set 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 Data Set 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" // Data set 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" // Data set 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 data set 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 data sets 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 data set 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 Data Set Files

Data sets 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 data set 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 data set.
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 data sets 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