Skip to content

Commit

Permalink
unused imports and build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hugopendlebury committed Feb 22, 2024
1 parent e20e5cc commit cd459c8
Show file tree
Hide file tree
Showing 12 changed files with 9 additions and 43 deletions.
3 changes: 2 additions & 1 deletion src/converter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class Converter


public:
double conversionValue;

std::function<arrow::Result<arrow::Datum>(arrow::Datum, arrow::Datum)> conversionFunc;
double conversionValue;

Converter(std::function<arrow::Result<arrow::Datum>(arrow::Datum, arrow::Datum)> conversionFunc, double conversionValue);

Expand Down
3 changes: 1 addition & 2 deletions src/gribmessage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class GribMessage
codes_handle* handle,
long message_id);

codes_handle* h;
long getGribMessageId();
double getLatitudeOfFirstPoint();
double getLongitudeOfFirstPoint();
Expand Down Expand Up @@ -78,9 +77,9 @@ class GribMessage
std::unique_ptr<GridArea> getGridArea();
std::vector<double> colToVector(std::shared_ptr<arrow::ChunkedArray> columnArray);
GribLocationData* getLocationData(std::unique_ptr<GridArea> gridArea);
codes_handle* h;
GribReader* _reader;
long _message_id;
long gridDefinitionTemplateNumber;

};

Expand Down
14 changes: 6 additions & 8 deletions src/gribreader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ GribReader::GribReader(string filepath) : filepath(filepath) {

GribReader GribReader::withLocations(std::shared_ptr<arrow::Table> locations) {
//TODO - add some validation
validateLocationFields(locations, " passed conversions via arrow");
validateLocationFields(locations, " passed locations via arrow");
locations = enrichLocationsWithSurrogateKey(locations);
locations = castTableFields(locations, " passed conversions via arrow", getLocationFieldDefinitions());
locations = castTableFields(locations, " passed locations via arrow", getLocationFieldDefinitions());
this->shared_locations = locations;
return *this;
}
Expand Down Expand Up @@ -79,19 +79,19 @@ std::shared_ptr<arrow::Table> GribReader::enrichLocationsWithSurrogateKey(std::s
//Append an additional column to the table called surrogate key

auto locationsTable = locations.get();
auto columns = locations.get()->ColumnNames();
auto columns = locationsTable->ColumnNames();
std::set<std::string> columnsSet(std::make_move_iterator(columns.begin()),
std::make_move_iterator(columns.end()));

const bool hasSurrogateKey = columnsSet.find("surrogate_key") != columnsSet.end();

if (!hasSurrogateKey) {
std::cout << "Enriching with surrogate_key field " << std::endl;
auto numberOfRows = locations.get()->num_rows();
auto numberOfRows = locationsTable->num_rows();
auto surrogate_columns = createSurrogateKeyCol(numberOfRows);
auto skField = arrow::field("surrogate_key", arrow::uint16());
auto chunkedArray = std::make_shared<arrow::ChunkedArray>(arrow::ChunkedArray(surrogate_columns.ValueOrDie()));
auto locationsResult = locations.get()->AddColumn(0, skField, chunkedArray);
auto locationsResult = locationsTable->AddColumn(0, skField, chunkedArray);
if (!locationsResult.ok()) {
std::string errDetails = "Error adding surrogate key "
" " + locationsResult.status().message();
Expand Down Expand Up @@ -255,7 +255,6 @@ GribReader GribReader::withConversions(std::string conversionsPath) {

GribReader GribReader::withConversions(std::shared_ptr<arrow::Table> conversions) {
cout << "Setting conversions" << endl;
auto conv = conversions.get();

//the table should contain 2 columns "lat" and "lon"
validateConversionFields(conversions, " passed conversions via arrow");
Expand Down Expand Up @@ -368,7 +367,6 @@ std::optional<GribLocationData*> GribReader::getLocationDataFromCache(std::uniqu

GribLocationData* GribReader::addLocationDataToCache(std::unique_ptr<GridArea>& area, GribLocationData* locationData) {

auto numberOfPoints = locationData->numberOfPoints;
auto a = *area.get();
location_cache.emplace(a, locationData);
return locationData;
Expand Down Expand Up @@ -429,7 +427,7 @@ std::shared_ptr<arrow::Table> GribReader::getLocations(std::unique_ptr<GridArea>

}

auto required_locations = locations_in_area.find(ga);
//auto required_locations = locations_in_area.find(ga);
auto matched = locations_in_area[ga];
return matched;
}
Expand Down
1 change: 0 additions & 1 deletion src/gribreader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class GribReader
bool isRepeatable = false;
bool isExhausted = false;
std::shared_ptr<arrow::Table> shared_locations;
arrow::Table* conversions = NULLPTR;
std::unordered_map<GridArea, std::shared_ptr<arrow::Table>> locations_in_area;
std::unordered_map<GridArea, GribLocationData*> location_cache;
std::unordered_map<int64_t, Converter*> conversion_funcs;
Expand Down
5 changes: 0 additions & 5 deletions tests/test_add_columns.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import polars as pl
import pytest
import os
import sys
import pyarrow


class TestColumns():
def test_column_addition_to_df(self, resource):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_area_filters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import polars as pl
import pytest
import os
import sys
import pyarrow

class TestLocations:
def test_find_nearest(self, resource):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_attributes.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import pytest
import os
import sys
import datetime
import pyarrow

class TestFilterMessageId:
def test_attributes(self, resource):
Expand Down
1 change: 0 additions & 1 deletion tests/test_conversions.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import polars as pl
import pytest
import os
import sys
import pyarrow as pa

class TestConversions:
Expand Down
2 changes: 0 additions & 2 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import polars as pl
import pytest
import os
import sys
import pyarrow

class TestExceptions:
def test_incorrect_grib_filePath(self, resource):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_filtering_message_id.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import polars as pl
import pytest
import os
import sys
import pyarrow

class TestFilterMessageId:
def test_filterByMessageId(self, resource):
Expand Down
7 changes: 0 additions & 7 deletions tests/test_iteration.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
import polars as pl
import pytest
import os
import sys
import pyarrow
from functools import reduce

class TestIteration:

def get_iterator_count(self, reader):
Expand Down
4 changes: 0 additions & 4 deletions tests/test_with_locations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import polars as pl
import pytest
import os
import sys
import pyarrow

class TestLocations:

Expand Down

0 comments on commit cd459c8

Please sign in to comment.