#include "common.h"
#include "ocean.h"

#if PROTOTYPE_ALLOWED
void main(int argc, char *argv[])
#else
void main(argc, argv)
int argc;
char *argv[];
#endif
{
   float T[2], S[2], Z[2];      /* input */
   double L;
   float P[2];                  /* intermediate */
   float B[2];                  /* output */

   if (argc != 8)
   {
      printf("\n USAGE: bvfreq <Z1> <T1> <S1> <Z2> <T2> <S2> <Lat>");
      printf("\n NOTE: Z2 must be deeper than Z1\n\n");
      exit(0);
   }
   else
   {
      Z[0] = atof(argv[1]);
      T[0] = atof(argv[2]);
      S[0] = atof(argv[3]);
      Z[1] = atof(argv[4]);
      T[1] = atof(argv[5]);
      S[1] = atof(argv[6]);
      L    = atof(argv[7]);
   }
   P[0] = PRESS(fabs(Z[0]));
   P[1] = PRESS(fabs(Z[1]));
   BVFREQ(Z, S, T, P, L, 2, B);
   printf("\n BVF  = %e /s",  B[0]);
   printf("\n BVF2 = %e /s",  bvf2(Z[0], T[0], S[0], Z[1], T[1], S[1], L));
   printf("\n for S1 = %g ppt, T1 = %g C, Z1 = %g m (%g dbar),", 
      S[0], T[0], Z[0], P[0]);
   printf("\n     S2 = %g ppt, T2 = %g C, Z2 = %g m (%g dbar),", S[1], T[1], Z[1], P[1]);
   printf("\n at %g degrees latitude\n\n", L);
}
