Cup2rdb Examples

The program cup2rdb allows the user to easily strip out desired output from a Cupid output file. Cupid variables can be indexed by day, timestep, layer and/or angle class, so we want the flexibility to extract variables indexed in various ways. Cup2rdb provides that flexibility.

The general usage is

cup2rdb cupfile.rd cupid.out

where

(Both files can be named whatever you wish.)

Layer Output Extraction

Here is an example of a file cupfile.rd which requests variables output by layer:

# This is a comment line describing this file
3,1,1,0,1
"Depth",5,4,1,0,0
"Soil_water_pot",5,5,8,0,0
"Water_content",5,5,9,0,0

Let's look at this file line-by-line:

# This is a comment line describing this file
3,1,1,0,1
"Depth",5,4,1,0,0


We can execute this file, and strip down the output with this command line:

cup2rdb cupfile.rd cupid.out | row lyr ge 19 | column -v idx | grep -v N > cupout.strip

The pipes, respectively:

  1. strip out rows where the variable lyr has values greater than or equal to 19
  2. strip the column with header idx
  3. strip the second line which describes the format of the output in each column.

I don't want to see these, so let's just get rid of them. But cup2rdb would run just fine without any of these pipes.


Here's a piece of the stripped output file (these special profiles were printed by Cupid only for timesteps 12 and 24):

doy     ts      lyr     Depth   Soil_water_pot  Water_content
145     12      19      0.00    -0.92   46.31
145     12      20      -0.01   -0.89   46.53
145     12      21      -0.03   -0.79   47.34
145     12      22      -0.08   -0.46   51.18
145     12      23      -0.15   -0.29   33.81
145     12      24      -0.20   -0.06   21.16
145     12      25      -0.30   -0.04   23.95
145     12      26      -0.38   -0.04   23.80
145     12      27      -0.40   -0.04   31.09
145     12      28      -0.42   -0.04   38.91
145     12      29      -0.50   -0.04   39.32
145     12      30      -0.60   -0.03   39.61
145     12      31      -0.70   -0.03   39.63
145     12      32      -0.80   -0.04   39.34
145     12      33      -1.00   -0.05   37.35
145     12      34      -1.25   -0.06   36.01
145     12      35      -1.50   -0.07   35.74
145     12      36      -1.75   -0.07   35.70
145     12      37      -2.00   -0.07   35.70
145     24      19      0.00    -0.50   50.53
145     24      20      -0.01   -0.49   50.69
...

Here's what the stripped output would look like without any of the pipes:

idx     doy     ts      lyr     Depth   Soil_water_pot  Water_content
9       3N      2N      2N      7N      7N      7N
145120001       145     12      1       2.00    18.80   96.41
145120002       145     12      2       1.60    18.80   96.67
145120003       145     12      3       1.30    18.81   96.91
145120004       145     12      4       1.00    18.81   97.24
145120005       145     12      5       0.70    18.82   97.73
145120006       145     12      6       0.34    18.84   99.05
145120007       145     12      7       0.27    18.84   99.15
145120008       145     12      8       0.25    18.84   99.19
145120009       145     12      9       0.23    18.85   99.23
145120010       145     12      10      0.21    18.85   99.26
145120011       145     12      11      0.20    18.85   99.28
145120012       145     12      12      0.18    18.85   99.30
145120013       145     12      13      0.17    18.86   99.31
145120014       145     12      14      0.15    18.86   99.33
145120015       145     12      15      0.13    18.87   99.35
145120016       145     12      16      0.11    18.87   99.37
145120017       145     12      17      0.05    18.89   99.42
145120018       145     12      18      0.03    18.91   99.47
145120019       145     12      19      0.00    -0.92   46.31
145120020       145     12      20      -0.01   -0.89   46.53
145120020       145     12      20      -0.01   -0.89   46.53
145120021       145     12      21      -0.03   -0.79   47.34
145120022       145     12      22      -0.08   -0.46   51.18
145120023       145     12      23      -0.15   -0.29   33.81
145120024       145     12      24      -0.20   -0.06   21.16
145120025       145     12      25      -0.30   -0.04   23.95
145120026       145     12      26      -0.38   -0.04   23.80
145120027       145     12      27      -0.40   -0.04   31.09
145120028       145     12      28      -0.42   -0.04   38.91
145120029       145     12      29      -0.50   -0.04   39.32
145120030       145     12      30      -0.60   -0.03   39.61
145120031       145     12      31      -0.70   -0.03   39.63
145120032       145     12      32      -0.80   -0.04   39.34
145120033       145     12      33      -1.00   -0.05   37.35
145120034       145     12      34      -1.25   -0.06   36.01
145120035       145     12      35      -1.50   -0.07   35.74
145120036       145     12      36      -1.75   -0.07   35.70
145120037       145     12      37      -2.00   -0.07   35.70
145240001       145     24      1       2.00    19.00   62.92
145240002       145     24      2       1.60    19.15   62.52
145240003       145     24      3       1.30    19.29   62.13
145240004       145     24      4       1.00    19.48   61.62
145240005       145     24      5       0.70    19.76   60.86
...