# include "odm.h"
inline void Usage ( const MString & arg0 )
{
message ( arg0 + " (<key>=<value>...) " ) ;
message ( " Keys are: " ) ;
message ( " action. What the program should do. May be: info, tsc, uv. Default: tsc. " ) ;
message ( " Keys for action=info. Print some information about dataset. " ) ;
message ( " source. Required. May be: NEMO, HYCOM, AVISO " ) ;
message ( " Keys for source=NEMO " ) ;
message ( " dataset. Can be DT, NRT or NRT6. Default: DT " ) ;
message ( " Keys for source=HYCOM " ) ;
message ( " dataset. Can be Forecast, Hindcast or Reanalysis. Default: Forecast " ) ;
message ( " Keys for source=AVISO " ) ;
message ( " dataset. Can be DT, NRT, EckmanDT or EckmanNRT. Default: DT " ) ;
message ( " Keys for action=tsc. Get temperature, salinity, chlorofill from dataset. " ) ;
message ( " source. Required. May be: NEMO, HYCOM, AVISO " ) ;
message ( " var. Required. May be: U, U2, u, v, temp, ptemp, pdens, sal, chl, mld, ssh or w. " ) ;
message ( " time. Time moment or regular expression. If present, timeb and timee must be absent " ) ;
message ( " timeb, timee. Time interval. If present, time must be absent " ) ;
message ( " lonb, lone, latb, late. Required. Region of interest " ) ;
message ( " out. Output file. Default: out.bin " ) ;
message ( " Keys for source=NEMO " ) ;
message ( " dataset. Can be DT, NRT or NRT6. Default: DT " ) ;
message ( " layer and/or depth. Layer or depth of NEMO dataset. If depth is specified, layer is ignored. Both ignored, if var=mld or var=ssh. Default: layer=0 " ) ;
message ( " Keys for source=HYCOM " ) ;
message ( " dataset. Can be Forecast, Hindcast or Reanalysis. Default: Forecast " ) ;
message ( " layer and/or depth. Layer or depth of HYCOM dataset. If depth is specified, layer is ignored. Both ignored, if var=mld or var=ssh. Default: layer=0 " ) ;
message ( " Keys for source=AVISO " ) ;
message ( " dataset. Can be DT, NRT, EckmanDT or EckmanNRT. Default: DT " ) ;
message ( " layer and/or depth. Layer or depth of AVISO dataset. If depth is specified, layer is ignored. Both ignored for datasets DT and NRT. Default: layer=0 " ) ;
message ( " Keys for action=uv. Get velocity field and its derivatives. " ) ;
message ( " source. Required. May be: NEMO, HYCOM, AVISO " ) ;
message ( " time. Time moment or regular expression. If present, timeb and timee must be absent " ) ;
message ( " timeb, timee. Time interval. If present, time must be absent " ) ;
message ( " out. Output file for components of velocity field, divergency, rotor and Okubo-Weiss parameter. If absent, this data not calculated. " ) ;
message ( " velout. Output file for sparse velocity field. If present, parameters shiftx, shifty, skipx, skipy controls the sparsing. " ) ;
message ( " shiftx, shifty. Shift of the sparsed grid. Used only if velout parameter is present. Default: 0 " ) ;
message ( " skipx, skipy. How many poinst skipped in the sparsed grid. Used only if velout parameter is present. Default: 1, output each point " ) ;
message ( " stpout. Output file for stationary points. If absent, this data not calculated. " ) ;
message ( " Keys for specific sources see in the section action=tsc. " ) ;
}
int main ( int argc , char * * argv )
{
if ( argc = = 1 )
{
Usage ( argv [ 0 ] ) ;
return 2 ;
}
auto args = ParseArgs ( argc , argv ) ;
MString action = args . contains ( " action " ) ? args [ " action " ] : " tsc " ;
Data data ;
{
auto ret = data . Init ( args ) ;
if ( ret . Exist ( ) )
{
errmessage ( ret ) ;
return 1 ;
}
}
MString ret ;
if ( action = = " info " )
ret = data . ActionInfo ( args ) ;
else if ( action = = " tsc " )
ret = data . ActionTsc ( args ) ;
else if ( action = = " uv " )
{
args [ " var " ] = " U " ;
ret = data . ActionUV ( args ) ;
}
else
{
errmessage ( " Unknown action " + action ) ;
return 1 ;
}
if ( ret . Exist ( ) )
{
errmessage ( ret ) ;
return 1 ;
}
return 0 ;
}