Skip to content

Commit

Permalink
ingest/AcData2Spdb - handling option in IWG1 data to remove the start…
Browse files Browse the repository at this point in the history
…ing token
  • Loading branch information
mike-dixon committed Jan 9, 2020
1 parent 8733530 commit 07a46b2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 27 deletions.
26 changes: 16 additions & 10 deletions codebase/apps/ingest/src/AcData2Spdb/AcData2Spdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,12 @@ int AcData2Spdb::_decodeNoaaShip(const char *line,
if (toks.size() < 6) {
return -1;
}

// remove IWG1 token if present at start of message

if (toks[0] == "IWG1") {
toks.erase(toks.begin(), toks.begin());
}

if (sscanf(toks[0].c_str(), "%4d%2d%2d",
&year, &month, &day) != 3) {
Expand Down Expand Up @@ -1175,10 +1181,10 @@ int AcData2Spdb::_decodeIWG1(const char *line,
dewptC = atof(toks[20].c_str());
}

double rh = -9999.0;
if (tempC > -9990.0 && dewptC > -9990.0) {
rh = PHYrelh(tempC, dewptC);
}
// double rh = -9999.0;
// if (tempC > -9990.0 && dewptC > -9990.0) {
// rh = PHYrelh(tempC, dewptC);
// }

// wind

Expand All @@ -1196,13 +1202,13 @@ int AcData2Spdb::_decodeIWG1(const char *line,
windDirnDegT = atof(toks[26].c_str());
}

double uu = -9999.0;
double vv = -9999.0;
// double uu = -9999.0;
// double vv = -9999.0;

if (windSpeedMps > -9990.0 && windDirnDegT > -9990.0) {
uu = PHYwind_u(windSpeedMps, windDirnDegT);
vv = PHYwind_v(windSpeedMps, windDirnDegT);
}
// if (windSpeedMps > -9990.0 && windDirnDegT > -9990.0) {
// uu = PHYwind_u(windSpeedMps, windDirnDegT);
// vv = PHYwind_v(windSpeedMps, windDirnDegT);
// }

// load struct

Expand Down
2 changes: 1 addition & 1 deletion codebase/apps/ingest/src/AcData2Spdb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TARGET_FILE = AcData2Spdb
LOC_INCLUDES = $(NETCDF4_INCS)

LOC_LIBS = -lSpdb -ldsserver -ldidss -lrapformats \
-lrapmath -lphysics -ltoolsa -ldataport \
-lrapmath -leuclid -lphysics -ltoolsa -ldataport \
-ltdrp $(NETCDF4_LIBS) -lbz2 -lz \
-lpthread

Expand Down
31 changes: 23 additions & 8 deletions codebase/apps/ingest/src/AcData2Spdb/Params.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
// ** Copyright UCAR (c) 1992 - 2019
// ** University Corporation for Atmospheric Research(UCAR)
// ** National Center for Atmospheric Research(NCAR)
// ** Boulder, Colorado, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
/* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */
/* ** Copyright UCAR */
/* ** University Corporation for Atmospheric Research (UCAR) */
/* ** National Center for Atmospheric Research (NCAR) */
/* ** Boulder, Colorado, USA */
/* ** BSD licence applies - redistribution and use in source and binary */
/* ** forms, with or without modification, are permitted provided that */
/* ** the following conditions are met: */
/* ** 1) If the software is modified to produce derivative works, */
/* ** such modified software should be clearly marked, so as not */
/* ** to confuse it with the version available from UCAR. */
/* ** 2) Redistributions of source code must retain the above copyright */
/* ** notice, this list of conditions and the following disclaimer. */
/* ** 3) Redistributions in binary form must reproduce the above copyright */
/* ** notice, this list of conditions and the following disclaimer in the */
/* ** documentation and/or other materials provided with the distribution. */
/* ** 4) Neither the name of UCAR nor the names of its contributors, */
/* ** if any, may be used to endorse or promote products derived from */
/* ** this software without specific prior written permission. */
/* ** DISCLAIMER: THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESS */
/* ** OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
/* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */
////////////////////////////////////////////
// Params.cc
//
Expand Down Expand Up @@ -33,8 +50,6 @@
* @author Automatically generated
*
*/
using namespace std;

#include "Params.hh"
#include <cstring>

Expand Down
33 changes: 25 additions & 8 deletions codebase/apps/ingest/src/AcData2Spdb/Params.hh
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
// ** Copyright UCAR (c) 1992 - 2019
// ** University Corporation for Atmospheric Research(UCAR)
// ** National Center for Atmospheric Research(NCAR)
// ** Boulder, Colorado, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
/* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */
/* ** Copyright UCAR */
/* ** University Corporation for Atmospheric Research (UCAR) */
/* ** National Center for Atmospheric Research (NCAR) */
/* ** Boulder, Colorado, USA */
/* ** BSD licence applies - redistribution and use in source and binary */
/* ** forms, with or without modification, are permitted provided that */
/* ** the following conditions are met: */
/* ** 1) If the software is modified to produce derivative works, */
/* ** such modified software should be clearly marked, so as not */
/* ** to confuse it with the version available from UCAR. */
/* ** 2) Redistributions of source code must retain the above copyright */
/* ** notice, this list of conditions and the following disclaimer. */
/* ** 3) Redistributions in binary form must reproduce the above copyright */
/* ** notice, this list of conditions and the following disclaimer in the */
/* ** documentation and/or other materials provided with the distribution. */
/* ** 4) Neither the name of UCAR nor the names of its contributors, */
/* ** if any, may be used to endorse or promote products derived from */
/* ** this software without specific prior written permission. */
/* ** DISCLAIMER: THIS SOFTWARE IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESS */
/* ** OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
/* ** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
/* *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* */
////////////////////////////////////////////
// Params.hh
//
Expand Down Expand Up @@ -32,8 +49,6 @@
#ifndef Params_hh
#define Params_hh

using namespace std;

#include <tdrp/tdrp.h>
#include <iostream>
#include <cstdio>
Expand All @@ -42,6 +57,8 @@ using namespace std;
#include <climits>
#include <cfloat>

using namespace std;

// Class definition

class Params {
Expand Down

0 comments on commit 07a46b2

Please sign in to comment.