Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
danovaro committed Jun 21, 2024
1 parent cb08170 commit 63309c1
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 35 deletions.
1 change: 0 additions & 1 deletion src/fdb5/database/Catalogue.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "fdb5/database/Field.h"
#include "fdb5/database/FieldLocation.h"
#include "fdb5/database/Key.h"
#include "fdb5/database/Key.h"
#include "fdb5/database/Index.h"
#include "fdb5/api/helpers/ControlIterator.h"
#include "fdb5/database/PurgeVisitor.h"
Expand Down
8 changes: 4 additions & 4 deletions src/fdb5/database/Index.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ class IndexBase : public eckit::Counted {
std::string type_;

/// @note Order of members is important here ...
IndexAxis axes_; ///< This Index spans along these axis
Key key_; ///< key that selected this index
time_t timestamp_; ///< timestamp when this Index was flushed
IndexAxis axes_; ///< This Index spans along these axis
Key key_; ///< key that selected this index
time_t timestamp_; ///< timestamp when this Index was flushed

Indexer indexer_;
Indexer indexer_;

friend std::ostream& operator<<(std::ostream& s, const IndexBase& o) {
o.print(s); return s;
Expand Down
5 changes: 1 addition & 4 deletions src/fdb5/database/Key.cc
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,8 @@ Key Key::parseString(const std::string& s) {
return Key{keys};
}

void TypedKey::validateKeys(const BaseKey& other, bool checkAlsoValues) const
{
void TypedKey::validateKeys(const BaseKey& other, bool checkAlsoValues) const {

// std::cout << "validateKeys " << (*this) << std::endl
// << " " << other << std::endl;
eckit::StringSet missing;
eckit::StringSet mismatch;

Expand Down
10 changes: 0 additions & 10 deletions src/fdb5/database/Key.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,6 @@ class BaseKey {

public: // methods

// explicit BaseKey(const std::shared_ptr<TypesRegistry> reg = nullptr, bool canonical = false);
// explicit BaseKey(eckit::Stream &, const std::shared_ptr<TypesRegistry> reg = nullptr);
// explicit BaseKey(const std::string &keys, const Rule* rule);
// explicit BaseKey(const eckit::StringDict &keys, const std::shared_ptr<TypesRegistry> reg=nullptr);
// BaseKey(std::initializer_list<std::pair<const std::string, std::string>>, const std::shared_ptr<TypesRegistry> reg=nullptr);

BaseKey() : keys_(), names_() {}
BaseKey(const BaseKey &key) : keys_(key.keys_), names_(key.names_) {}

Expand Down Expand Up @@ -170,7 +164,6 @@ class Key : public BaseKey {

explicit Key();
explicit Key(eckit::Stream &);
// explicit Key(const std::string &keys);
explicit Key(const eckit::StringDict &keys);
Key(std::initializer_list<std::pair<const std::string, std::string>>);

Expand All @@ -183,7 +176,6 @@ class Key : public BaseKey {

private: // members

//TODO add unit test for each type
std::string canonicalise(const std::string& keyword, const std::string& value) const override;
std::string type(const std::string& keyword) const override;

Expand All @@ -195,15 +187,13 @@ class TypedKey : public BaseKey {

public: // methods

// explicit TypedKey(const Key& key);
explicit TypedKey(const Key& key, const std::shared_ptr<TypesRegistry> reg);
explicit TypedKey(const std::shared_ptr<TypesRegistry> reg);
explicit TypedKey(eckit::Stream &, const std::shared_ptr<TypesRegistry> reg);
explicit TypedKey(const std::string &keys, const Rule* rule);
explicit TypedKey(const eckit::StringDict &keys, const std::shared_ptr<TypesRegistry> reg);
TypedKey(std::initializer_list<std::pair<const std::string, std::string>>, const std::shared_ptr<TypesRegistry> reg);

/// @todo - this functionality should not be supported any more.
static TypedKey parseString(const std::string&, const std::shared_ptr<TypesRegistry> reg);

Key canonical() const;
Expand Down
1 change: 0 additions & 1 deletion src/fdb5/rules/Rule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ void Rule::expandFirstLevel(const metkit::mars::MarsRequest& request, TypedKey&

void Rule::matchFirstLevel( const Key& dbKey, std::vector<Predicate *>::const_iterator cur, Key& tmp, std::set<Key>& result, const char* missing) const {

// std::cout << "Rule::matchFirstLevel dbKey " << dbKey << " tmp " << tmp << " result.size() " << result.size() << std::endl;
if (cur == predicates_.end()) {
if (tmp.match(dbKey)) {
result.insert(tmp);
Expand Down
7 changes: 0 additions & 7 deletions src/fdb5/tools/fdb-copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ static std::vector<metkit::mars::MarsRequest> readRequest(const CmdArgs& args) {

for (size_t i = 0; i < args.count(); ++i) {

// std::cout << "Reading " << args(i) << std::endl;

std::ifstream in(args(i).c_str());
if (in.bad()) {
std::ostringstream msg;
Expand Down Expand Up @@ -98,12 +96,7 @@ void FDBCopy::execute(const CmdArgs& args) {

std::vector<metkit::mars::MarsRequest> requests = readRequest(args);

// std::cout << "REQUESTS: " << std::endl;
// for (auto r : requests)
// std::cout << r << std::endl;

// Evaluate the requests to obtain data handles

const bool sort = args.getBool("sort", false);
fdb5::HandleGatherer handles(sort);

Expand Down
1 change: 0 additions & 1 deletion src/fdb5/types/TypeClimateDaily.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void TypeClimateDaily::getValues(const metkit::mars::MarsRequest &request,
bool TypeClimateDaily::match(const std::string&,
const std::string& value1,
const std::string& value2) const {
// std::cout << value1 << " vs. " << value2 << " are " << (month(value1) == month(value2)) << std::endl;

return month(value1) == month(value2);
}
Expand Down
2 changes: 0 additions & 2 deletions tests/fdb/test_fdb5_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@ CASE ( "test_fdb_stepunit_archive" ) {
{
metkit::mars::MarsExpension expand{false};

std::cout << req << endl;
metkit::mars::MarsRequest expandedRequests = expand.expand(req);
std::cout << expandedRequests << endl;
fdb5::FDBToolRequest r(expandedRequests);
fdb5::ListIterator iter = fdb.list(r, true);
fdb5::ListElement el;
Expand Down
5 changes: 0 additions & 5 deletions tests/fdb/type/test_toKey.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,6 @@ CASE( "Step & ClimateDaily - expansion" ) {
EXPECT(key.canonicalValue("date") == "0427");
EXPECT(key.canonicalValue("time") == "0000");

std::cout << key.valuesToString() << std::endl;

EXPECT(key.valuesToString() == "0427:dacl:0000:ei:7799:g:pb:pl:2-12:99:100:50:129.128");

key.set("step", "00");
Expand Down Expand Up @@ -220,7 +218,6 @@ CASE( "Levelist" ) {
// this works (probably shouldn't), simply becasue to_string uses the same precision as printf %f (default 6)
/// @note don't use to_string when canonicalising Keys
key.set("levelist", std::to_string(double(1./3.)));
// std::cout << key.canonicalValue("levelist") << std::endl;
EXPECT(key.canonicalValue("levelist") == "0.333333");
EXPECT(key.match("levelist", values));
}
Expand Down Expand Up @@ -258,8 +255,6 @@ CASE( "ClimateMonthly - string ctor - expansion" ) {
config.schema().expand(key.canonical(), visitor);
key.registry(visitor.rule()->registry());

std::cout << key.valuesToString() << std::endl;
std::cout << key.canonicalValue("date");
EXPECT(key.canonicalValue("date") == "4");
EXPECT(key.valuesToString() == "op:0001:mnth:g:cl:pl:4:0000:50:129.128");

Expand Down

0 comments on commit 63309c1

Please sign in to comment.