Skip to Content

Data Formats

Raster data has been categorized for Cuencas in two groups: Topography (DEMs) and Hydrology. The second one encompasses all the spatial fields and it is general enough to include temporal variability of the data, even spatial data that needs to be represented by categories, rather than by numeric values can be included here. Some sample code, to create these files, is also included.

TOPOGRAPHY (Digital Elevation Models)

A topography data file is actually determined by two files with the same name: a metafile (with extension *.metaDEM) and a binary (XDR) data file (with extension *.dem). The metafile is an ASCII file that contains all the information necessary to read the data in the binary data file. Currently there are 12 tags, which are detailed detail here:

  1. [Name]: A string of ascii characters it can be any name for the variable. We recommend to keep it short, since additional information about the variable can be given under the [Information] tag.
  2. [Southernmost Latitude]: Given in the deg:min:sec format (e.g. 39:33:49.50 N)
  3. [Westernmost Longitude]: Same format as above.
  4. [Longitudinal Resolution (ArcSec)]: A float numeric value given in seconds.
  5. [Latitudinal Resolution (ArcSec)]: A float numeric value given in seconds.
  6. [# Columns]: The number of columns for the data array
  7. [# Rows]: The number of rows for the data array
  8. [Format]: A string indicating the data format. It can be either Byte, Integer, Float, or Double
  9. [Missing]: A value for missing value
  10. [Temporal Resolution]: For DEMs this field is always set to “Fix”
  11. [Units]: use the STN units system
  12. [Information]: All the relevant information about this DEM.

A typical metafile can be found here.

The binary file is written in the External Data Representation Standard (XDR). This is the native format for Java.

I have written a small program to import a DEM form the BIL format into Cuencas format. Download it.

Note: Once a DEM is processed by Cuencas, a set of files with the same name as the DEM file will be created (*.ap, *.horton, *.log, *.slope, *.areas, *.dir, *.lcp, *.ltc, *.point, *.stream, *.corrDEM, *.dtopo, *.link, *.magn, and *.redRas).

HYDROLOGY (Hydroclimatic Variables)

A hydrology data file is actually a group of two or more files with the same name: there will always be a metafile (with extension *.metaVHC) and a group of binary (XDR) data files (with extension *.[hhmmss].[dd].[month].[yyyy].vhc).

The metafile is an ASCII file that contains all the information necessary to read the data in the binary data file. Currently there are twelve tags, which are detailed here:

  1. [Name]: A string of ascii characters it can be any name for the variable. We recommend to keep it short, since additional information about the variable can be given under the [Information] tag.
  2. [Southernmost Latitude]: Given in the deg:min:sec format (e.g. 39:33:49.50 N)
  3. [Westernmost Longitude]: Same format as above.
  4. [Longitudinal Resolution (ArcSec)]: A float numeric value given in seconds.
  5. [Latitudinal Resolution (ArcSec)]: A float numeric value given in seconds.
  6. [# Columns]: The number of columns for the data array
  7. [# Rows]: The number of rows for the data array
  8. [Format]: A string indicating the data format. It can be either Byte, Integer, Float, or Double
  9. [Missing]: A value for missing value
  10. [Temporal Resolution]: A number and a string (e.g. 5-minutes)
  11. [Units]: use the STN units system
  12. [Information]: All the relevant information about this DEM.

A typical metafile can be found here.

The group of companion binary file should have the same format, number of columns and rows, and the same spatial coverage. The extension holds the key to understand the time variability of the data, and it has to be consistent with the tag [Temporal Resolution] in the metafile.

The extension of a vhc file looks like this: *.[hhmmss].[dd].[month].[yyyy].vhc and it can be manipulated to get almost any kind of time variability on your data. It will be illustrated by examples to avoid long explanations.

  1. Annual Average
    In this case there will only be a single companion file for the metafile. The file extension should look like this: varname.average.vhc
  2. Annual Data
    In this case there can be as many companion files as necessary. The file extension should look like this: name.yyyy.vhc. As an example assume you have annual accumulated precipitation values, the group of files would look like this:

    precip.1986.vhc
    precip.1987.vhc
    precip.1988.vhc
    precip.1989.vhc
    precip.1990.vhc
    precip.1991.vhc
    precip.1992.vhc

  3. Monthly Averages
    In this case there will be 12 companion files for the metafile. The file extension should look like this: name.month.average.vhc. As an example assume you have evaporation monthly means, the group of files would look like this:

    evap.January.average.vhc
    evap.February
    .average.vhc
    evap.March.average.vhc

    evap.October.average.vhc
    evap.November.average.vhc
    evap.December.average.vhc

  4. Monthly Data
    In this case there can be as many companion files as necessary. The file extension should look like this: name.month.yyyy.vhc. As an example assume you have monthly temperature values, the group of files would look like this:
    temp.January.2002.vhc
    temp.February
    .2002.vhc
    temp.March.2002.vhc

    temp.October.2002.vhc
    temp.November.2002.vhc
    temp.December.2002.vhc
    temp.January.2003.vhc
    temp.February.2003.vhc
    temp.March.2003.vhc

    temp.Octover.2004.vhc
    temp.November.2004.vhc
    temp.December.2004.vhc
  5. Daily Averages
    In this case there will be 365/6 companion files for the metafile. The file extension should look like this: name.dd.month.average.vhc. As an example assume you have radiation daily means, the group of files would look like this:
    radiation.01.January.average.vhc
    radiation.02.January.average.vhc
    radiation.03.January.average.vhc

    radiation.01.February.average.vhc
    radiation.02.February.average.vhc

    radiation.30.December.average.vhc
    radiation.31.December.average.vhc

  6. Daily Data
    In this case there can be as many companion files as necessary. The file extension should look like this: name.dd.month.yyyy.vhc. As an example assume you have daily wind speed values, the group of files would look like this:
    radiation.01.January.1999.vhc
    radiation.02.January.1999.vhc
    radiation.03.January.1999.vhc

    radiation.01.February.1999.vhc
    radiation.02.February.1999.vhc

    radiation.30.December.1999.vhc
    radiation.31.December.1999.vhc

    radiation.01.January.2000.vhc
    radiation.02.January.2000.vhc
    radiation.03.January.2000.vhc

    radiation.01.February.2000.vhc
    radiation.02.February.2000.vhc

    radiation.30.December.2000.vhc
    radiation.31.December.2000.vhc

  7. Hourly, Per-Minute or Per-Second Data
    In this case there can be as many companion files as necessary. The file extension should look like this: name.hhmmss.month.yyyy.vhc. As an example assume you have precipitation values every 5 minutes, the group of files would look like this:
    prec.044000.10.September.1964.vhc
    prec.044500.10.September.1964.vhc
    prec.045000.10.September.1964.vhc
    prec.045500.10.September.1964.vhc

    prec.211500.09.September.1964.vhc
    prec.222500.09.September.1964.vhc
    prec.223000.09.September.1964.vhc
    prec.223500.09.September.1964.vhc
    prec.224000.09.September.1964.vhc
    Notice how there is no need of a data file for each and every moment of time. Applications in Cuencas, such as the rainfall-runoff module, will assume every non existent file as either 0’s or missing data.Also, it is recommended to create an appropriate directories structure to group the data as much as possible. This will avoid long processing times when reading the data files names.
SAMPLE CODE TO CREATE CUENCAS FILES

There are 3 computer languages I use to manipulate my data. They are IDL™, R and Java™. Here is a list of sample programs for these languages that can be used to create or transform data into the format described above.

  1. IDL™
    • createUniformField.pro : Illustrates the use of the XDR keyword to write files
  2. R
    • createFields.r : Illustrates the use of the writeBin() function.
  3. Java™
    • NetCDFtoHSJ :
Last modified on January 18th, 2013
Posted on January 18th, 2013