Skip to content
Snippets Groups Projects
v5d.c 82.6 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
       for (i=0;i<MAXVARS;i++) {
          varnl[i] = *nl;
       }
    
       compressmode = 1;
    
       projection = 1;
       projarg[0] = *northlat;
       projarg[1] = *westlon;
       projarg[2] = *latinc;
       projarg[3] = *loninc;
    
       vertical = 1;
       vertarg[0] = *bottomhgt;
       vertarg[1] = *hgtinc;
    
    #ifdef UNDERSCORE
       return v5dcreate_
    #else
    #  ifdef _CRAY
       return V5DCREATE
    #  else
    
       return v5dcreate
    #  endif
    #endif
                       ( name, numtimes, numvars, nr, nc, varnl,
                         varname, timestamp, datestamp, &compressmode,
                         &projection, projarg, &vertical, vertarg );
    }
    
    
    
    /*
     * Set lowest levels for each variable (other than default of 0).
     * Input: lowlev - array [NumVars] of ints
     * Return:  1 = ok, 0 = error
     */
    #ifdef UNDERSCORE
       int v5dsetlowlev_
    #else
    #  ifdef _CRAY
         int V5DSETLOWLEV
    #  else
         int v5dsetlowlev
    #  endif
    #endif
              ( int *lowlev )
    {
       return v5dSetLowLev(lowlev);
    }
    
    
    
    /*
     * Set the units for a variable.
     * Input: var - variable number in [1,NumVars]
     *        units - a character string
     * Return:  1 = ok, 0 = error
     */
    #ifdef UNDERSCORE
       int v5dsetunits_
    #else
    #  ifdef _CRAY
         int V5DSETUNITS
    #  else
         int v5dsetunits
    #  endif
    #endif
              ( int *var, char *name )
    {
       return v5dSetUnits( *var, name );
    }
    
    
    
    /*
     * Write a grid of data to the file.
     * Input:  time - timestep in [1,NumTimes]
     *         var - timestep in [1,NumVars]
     *         data - array [nr*nc*nl] of floats
     * Return:  1 = ok, 0 = error
     */
    #ifdef UNDERSCORE
       int v5dwrite_
    #else
    #  ifdef _CRAY
         int V5DWRITE
    #  else
         int v5dwrite
    #  endif
    #endif
              ( const int *time, const int *var, const FLOAT *data )
    {
       return v5dWrite( *time, *var, data );
    }
    
    
    
    /*
     * Specify the McIDAS GR3D file number and grid number which correspond
     * to the grid specified by time and var.
     * Input:  time, var - timestep and variable of grid (starting at 1)
     *         mcfile, mcgrid - McIDAS grid file number and grid number
     * Return:  1 = ok, 0 = errror (bad time or var)
     */
    #ifdef UNDERSCORE
       int v5dmcfile_
    #else
    #  ifdef _CRAY
         int V5DMCFILE
    #  else
         int v5dmcfile
    #  endif
    #endif
             ( const int *time, const int *var,
               const int *mcfile, const int *mcgrid )
    {
       if (*time<1 || *time>Simple->NumTimes) {
          printf("Bad time argument to v5dSetMcIDASgrid: %d\n", *time );
          return 0;
       }
       if (*var<1 || *var>Simple->NumVars) {
          printf("Bad var argument to v5dSetMcIDASgrid: %d\n", *var );
          return 0;
       }
    
       Simple->McFile[*time-1][*var-1] = (short) *mcfile;
       Simple->McGrid[*time-1][*var-1] = (short) *mcgrid;
       return 1;
    }
    
    
    
    /*
     * Close a simple v5d file.
     */
    #ifdef UNDERSCORE
       int v5dclose_( void )
    #else
    #  ifdef _CRAY
         int V5DCLOSE( void )
    #  else
         int v5dclose( void )
    #  endif
    #endif
    {
       return v5dClose();
    }