ncd2ts
USAGE:
(1)
ncd2ts [options]
+[<d>] [tslist-options] <d> [options]
<ncdfile> <label> [<label>
...]
(2)
ncd2ts [as
above] -c <label> [-c <label>
... ] <ncdfile> [<ncdfile> ...]
(3)
ncd2ts <ncdfile>
-query
PURPOSE:
Convert GWR A1*,
A2* or G1* netCDF-files to BIN-ts or BIN-mc
or ASCII-file;
or inspect a file
(1) One or more
columns to indvidual files
(auto outfile names will contain the column label)
or to labeled BIN-mc files.
(2) One or more
columns from a concatenated set of ncdfiles
(3) Shows the
available columns and quits
These files can
be created with
~/bin/tsf2nc
-> /home/marcin/fortran/tsf2nc
Distinguish
options to this scripts from options to tslist:
Enclose the
latter within `+´ and `-´ or, for better clarity,
within +<d>
and <d> as shown here: +% -qqq -023. -UEn93600 %
Since mc-labels
cannot be longer than 16 characters, specify only that part
of the string
that uniquely matches the ncd-column names.
In writing
labels into BIN-mc we might like to enforce upper-case.
In this case,
prepend the label with `:´ and specify a label in
upper-case.
Auto-generated
output file names under -w or -o :
Note `<pre>+´
below; i.e. adds the label before the type extension,
e.g. -o
abc/def+
i.e. <pre>
= abc/def+ and label = GRAV, => abc/def_GRAV.ts
Another method
is by place-holder in `<file>´ There, a @@@-triplet
is
replaced with
the label (three `@´ , no more, no less!)
e.g. -o
abc/d@@@-xyz.uv
=> abc/dGRAV-xyz.uv
OPTIONS:
-T
- Show the tslist command, don't execute it.
-s
- Removes the -I option in tslist to mute terminal output
of the time series.
-w[a] <file> - ASCII
output. File may include a path; or
-w <pre>+
- auto-created file name appended to string <pre>
Extension will be .tsf
Note that -wa appends to ASCII file; therefore an auto-
generated filename will probably be missing its target.
-o {<file> |<pre>+}
- ... equivalently for BIN-ts output
-O {<file> |<pre>+}
- ... for labeled BIN-mc. If more than one
column is specified, a pre-existent file will be removed.
-OA {<file> |<pre>+}
- ... for labeled BIN-mc. Expressly
append to a pre-existent file. If the label
already exists, it will not be overwritten; instead
a suggestion is printed to create a new file without
the old label, cowardly. See option -cmd
-ON {<file> |<pre>+}
- ... for labeled BIN-mc.
Append to a pre-existent file only if label is new.
-L <labext> - Significant
under -O | -OA | -ON
BIN-mc label extension, default = VAL, alt:
-L-
no label extension.
Some time in the future we may put the metric unit here.
-c <column> - Switches
to method (2) (input more than one nc-file)
The maximum data length is 10M for single-column
processing, else 1M.
-UC
- Rescale gravity to nm/s²
-cmd <file> - to collect
the suggestions issued upon exceptions
as they occur under -OA . The file may have to be
removed manually; this script may be called from
within a loop. If the -cmd option is not given,
this script will exit; anyway, the suggested command
will be printed on the terminal.
EXAMPLES:
Concatenate to retrieve one day and one hour
before and after:
(1) With auto-filename out:
ncd2ts +% -qqq
-023. -UEn93600 % -c G1-Mode -o d/+ N/A212010[1-3].054.nc
=> tslist -ncdG1-Mode
N/A2120101.054.nc N/A2120102.054.nc N/A2120103.054.nc \
-I -qqq -023. -UEn93600 -o d/A2120101.054_G1-Mode.ts
(2) With specific filename out:
ncd2ts +% -qqq -C3
-023. -UEn93600 -o d/A2120102.054_G1-Mode.ts % \
-c G1-Mode N/A212010[1-3].054.nc
=> tslist -ncdG1-Mode
N/A2120101.054.nc N/A2120102.054.nc N/A2120103.054.nc \
-I -qqq -C3 -023. -UEn93600 -o d/A2120102.054_G1-Mode.ts
(3) Three G1-files, convert from
G1<ymd>.054 to tmp/G1<ymd>-1s.ts:
#
cd ~/TD
set file1 =
`nextfile -GWR -a -1 RAW_o054/G1$ymd.054`
set ncds = (
)
foreach f (
`nextfiles I 2 $file1 -GWR` )
set of = N/`basename $f`.nc
tsf2nc $f $of
if ( -r $of ) set ncds = ( $ncds $of )
end
ncd2ts +%
-qqq -C3 -023. -UEn93600 -o tmp/G1$ymd-1s.ts % -c Grav-1 $ncds
#
Before the delimiter `%´ , you can add
tslist-options, e.g. to filter (and decimate)
and crop the output.
(4.1) In script ncd2gb1h:
$ncds contains three
file names. The series is low-pass filtered and decimated with
ncd2ts $tst -UC +%
-qqq -C3 -022. -UEn100800 -E deci.tse,SPF1H % -o tmp/@@@_$ymd.ts
\
-c :GRAV -c :BARO $ncds
(4.2) To create yesterday's G1_garb_yymmdd-1s.mc :
set
yday=`date "+%y%m%d" | jdc -i -C -FS -fs -A-1 -m`
set tday=`date "+%y%m%d"`
scpb -R -O tmp/d/ G1$tday.054
ncd2ts +% -022. -UEn100800 % -c Grav-1 -c Baro-1 -O
tmp/d/G1_garb_$yday-1s.mc \
`nextfile -GWR -a -1 N/G1$yday.054.nc` N/G1$yday.054.nc
tmp/d/G1$tday.054.nc
Now you can renew the
~/Ttide/SCG/dn/G090615-OPNEND-1h.ts file
using tsf2ts-1h
(prefer: include recent 59 days of 60s-files!)
set early=`jdc -C -FS -fs -A-59 $yday`
tsf2ts-1h -all $early -until $yday
and tslist-app
will just add the last 24 samples