Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
UNESCO.cc File Reference

Example program to plot UNESCO sound velocity. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "TROOT.h"
#include "TFile.h"
#include "TH2D.h"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

double getVelocity (const double D, const double S, const double T)
 Get sound velocity. More...
 
int main (int argc, char **argv)
 

Detailed Description

Example program to plot UNESCO sound velocity.

Author
mdejong

Definition in file UNESCO.cc.

Function Documentation

double getVelocity ( const double  D,
const double  S,
const double  T 
)
inline

Get sound velocity.

Parameters
DDepth [m]
SSalinity [ppk]
TTemperature [C]
Returns
sound velocity [m/s]

Definition at line 20 of file UNESCO.cc.

21 {
22  return (1448.96
23  + 4.591 * T
24  - 5.304e-2 * T*T
25  + 2.374e-4 * T*T*T
26  + 1.340 * (S - 35)
27  + 1.630e-2 * D
28  + 1.675e-7 * D*D
29  - 1.025e-2 * T * (S - 35)
30  - 7.139e-13 * T*D*D*D);
31 }
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
do set_variable OUTPUT_DIRECTORY $WORKDIR T
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:56
int main ( int  argc,
char **  argv 
)

Definition at line 39 of file UNESCO.cc.

40 {
41  using namespace std;
42  using namespace JPP;
43 
44  string outputFile;
45  double D;
46  int debug;
47 
48  try {
49 
50  JParser<> zap("Example program to plot UNESCO sound velocity.");
51 
52  zap['o'] = make_field(outputFile);
53  zap['D'] = make_field(D, "Depth [m]");
54  zap['d'] = make_field(debug) = 2;
55 
56  zap(argc, argv);
57  }
58  catch(const exception &error) {
59  FATAL(error.what() << endl);
60  }
61 
62 
63  TFile out(outputFile.c_str(), "recreate");
64 
65  TH2D h2("h2", NULL, 1000, 10.0, 20.0, 1000, 25.0, 40.0);
66 
67  for (Int_t ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) {
68  for (Int_t iy = 1; iy <= h2.GetXaxis()->GetNbins(); ++iy) {
69 
70  const Double_t T = h2.GetXaxis()->GetBinCenter(ix);
71  const Double_t S = h2.GetYaxis()->GetBinCenter(iy);
72 
73  const double V = getVelocity(D, S, T);
74  const double vs = getVelocity(D, S, T) - getVelocity(D + 1, S, T);
75 
76  h2.SetBinContent(ix, iy, V);
77  }
78  }
79 
80  out.Write();
81  out.Close();
82 }
Utility class to parse command line options.
Definition: JParser.hh:1500
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
string outputFile
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
do set_variable OUTPUT_DIRECTORY $WORKDIR T
double getVelocity(const double D, const double S, const double T)
Get sound velocity.
Definition: UNESCO.cc:20
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
do set_variable SIGMA_NS set_variable OUTLIERS set_variable OUTPUT_FILE matrix[${ALPHA_DEG}\deg\] root $JPP JMatrixNZ a $DETECTOR f $INPUT_FILE o $OUTPUT_FILE S
Definition: JMatrixNZ.sh:56