W routines

All GAMAP Routines

List routines by category:
Atmospheric Sciences | Benchmarking | Color | Date/Time | Doc | File & I/O | BPCH Format | Scientific Data Formats | GAMAP Examples | GAMAP Internals | GAMAP Utilities | GAMAP Data Manipulation | GAMAP Models & Grids | GAMAP Plotting | General | Graphics | Math & Units | Plotting | Regridding | Strings | Structures | Time Series

List routines by alphabetical order:
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z

Last modified: Tue Apr 4 10:50:27 2017.


List of Routines


Routine Descriptions

WRITEDATA

[Next Routine] [List of Routines]
 NAME:
        WRITEDATA

 PURPOSE:
        write a 2 dimensional data array and header information to a file

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        WRITEDATA,FILENAME,DATA [,HEADER,UNITS,CFACT,MCODE] [,keywords]

 INPUTS:
        FILENAME --> the name of the output file. If the output file
            exists, the user will be prompted for a new name unless
            keyword NO_WARN is set.

        DATA --> The data array to be written.

        HEADER --> An optional string array containing variable names.
            These will be composed to a string using the DELIM delimiter.
            Note that the HEADER information can also be passed in the
            pre-formatted COMMENTS keyword parameter.

        UNITS, CFACT, MCODE --> string arrays that will be added to the
            file header concatenated with blank delimiters. These parameters
            are optional and merely there to facilitate creating chem1d
            model input files.

 KEYWORD PARAMETERS:
        TITLE --> A title string that will be the first header line.
            It is also possible to pass a string array here, although for
            more complicate file headers it is recommended to pre-format
            the file header and pass it in the COMMENTS keyword.

        DELIM --> A delimiter character for the HEADER (variable name)
            items. Default is a blank ' '.

        COMMENTS --> A string array containing all the lines of the file
            header. Note that COMMENTS overrules the input of HEADER, UNITS,
            CFACT, and MCODE as well as TITLE.

        /NO_WARN --> Suppress warning message and user prompt for a new
            filename if the file already exists.

 OUTPUTS:
        A file containing a file header and the data array written
        line by line.

 SUBROUTINES:
        None

 REQUIREMENTS:
        None

 NOTES:
        None

 EXAMPLE:
        DATA = findgen(3,10)
        HEADER = ['A','B','C']
        writedata,'test.out',DATA,HEADER,TITLE='test file',DELIM=';'

        This will create a file like:
            test file
            A;B;C
                  0.00000      1.00000      2.00000
                  3.00000      4.00000      5.00000
            ...

 MODIFICATION HISTORY:
        mgs, 25 Nov 1997: VERSION 1.00
        mgs, 05 Apr 1999: - now uses formatted write statement
                 (looks like a bug in IDL for windows: sometimes no space
                  is printed between numbers if you simply print,data)
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10

(See /n/home09/ryantosca/IDL/gamap2/file_io/writedata.pro)


WRITE_BDT0001

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
        WRITE_BDT0001

 PURPOSE:
        Write a binary data file with size information and
        variable names and units

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        WRITE_BDT0001,filename,data,vardesc[,keywords]

 INPUTS:
        FILENAME -> Name of the file to write or a file mask
            which will be used in the PICKFILE dialog. If the 
            filemask is a named variable, it will return the 
            actual filename.

        DATA -> a 2D data array with dimensions LINES,VARIABLES

        VARDESC -> A variable descriptor structure array (see 
            GTE_VARDESC). This array must contain one structure 
            for each variable and the structure must have the 
            tags NAME and UNIT. Alternatively, you can use the
            NAMES and UNITS keywords to pass string arrays.

 KEYWORD PARAMETERS:
        NAMES -> A string array containing variable names. This 
            will only be used if no VARDESC structure array is 
            given.
 
        UNITS -> A string array with physical units for each 
            variable. (see NAMES)

        COMMENTS -> A string (or string array) with comment lines.
            Only the first 80 characters of each line will be stored.

        SELECTION -> An index array to select only a subset of
            variables from the data set. Indices are truncated 
            to lie in the range 0..n_elements(names), which can
            lead to multiple output of the same variable!

        _EXTRA keywords are passed on to OPEN_FILE

        Flags to determine the data type:
        Default is to store the data in its current type. Use the
        TYPE keyword to convert it to any other (numeric) type
        or use one of the following keywords. The type information
        is saved in the file, so READ_BDT0001 can automatically 
        read the data regardless of the format.

        /BYTE -> convert data to byte format
        /INT -> convert data to (2 byte) integer format
        /LONG -> convert data to (4 byte) integer format
        /FLOAT -> convert data to (4 byte) real format
        /DOUBLE -> convert data to (8 byte) double prec. real format
        /COMPLEX -> convert data to (8 byte) complex
        /DCOMPLEX -> convert data to (16 byte) double complex

 OUTPUTS:
        None

 SUBROUTINES:
        Uses OPEN_FILE, STR2BYTE

 REQUIREMENTS:
        None

 NOTES:
        Format specification:
        file_ID  :      80 byte character string
        NVARS, NLINES, NCOMMENTS, TYPE : 4 byte integer (long)
        NAMES :         NVARS*40 byte character string
        UNITS :         NVARS*40 byte character string
        COMMENTS :      NCOMMENTS records with 80 characters each
        DATA  :         8 byte float (double) array NLINES*NVARS

 EXAMPLE:
        WRITE_BDT0001,'~/tmp/*.bdt',data,vardesc

 MODIFICATION HISTORY:
        mgs, 24 Aug 1998: VERSION 1.00
        mgs, 28 Aug 1998: - changed specs to allow comments
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Now write data as big-endian

(See /n/home09/ryantosca/IDL/gamap2/file_io/write_bdt0001.pro)


WRITE_BIN

[Previous Routine] [List of Routines]
 NAME:
        WRITE_BIN

 PURPOSE:
        Save a 2-D data array into a binary file together with
        its size info. Use read_bin.pro to read it.;

 CATEGORY:
        File & I/O

 CALLING SEQUENCE:
        WRITE_BIN, data, filename, _EXTRA=e

 INPUTS:
        DATA -> Array to save to binary file format.

        FILENAME -> Name of the output binary file.

 KEYWORD PARAMETERS:
        _EXTRA=e -> Passes extra keywords to OPEN_FILE

 OUTPUTS:
        None

 SUBROUTINES:
        External Subroutines Required:
        ===============================
        OPEN_FILE

 REQUIREMENTS:
        None

 NOTES:
        Use READ_BIN to read the data file.

 EXAMPLES:
        (1)
        WRITE_BIN, DIST(20,20), 'myfile.bin'

             ; Writes a data array to a binary file.

        (2)
        WRITE_BIN, DIST(20,20), 'myfile.bin', /SWAP_ENDIAN

             ; Writes a data array to a binary file
             ; converts to BIG-ENDIAN (i.e. use this if
             ; you are running IDL on a PC.)

 MODIFICATION HISTORY:
  bmy & phs, 13 Jul 2007: GAMAP VERSION 2.10
        bmy, 02 Apr 2008: GAMAP VERSION 2.12
                          - Now write data as big-endian

(See /n/home09/ryantosca/IDL/gamap2/file_io/write_bin.pro)