# 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. Default: tsc. " ) ;
message ( " Keys for action=info. Print some information about dataset. " ) ;
message ( " source. Required. May be: NEMO, HYCOM " ) ;
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 action=tsc. Get temperature, salinity, chlorofill from dataset. " ) ;
message ( " source. Required. May be: NEMO " ) ;
message ( " var. Required. May be: 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 ( " 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 ( " lonb, lone, latb, late. Required. Region of interest " ) ;
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 ( " lonb, lone, latb, late. Required. Region of interest " ) ;
}
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
{
errmessage ( " Unknown action " + action ) ;
return 1 ;
}
if ( ret . Exist ( ) )
{
errmessage ( ret ) ;
return 1 ;
}
return 0 ;
}