-
Notifications
You must be signed in to change notification settings - Fork 15
Feature/query cxx types ne aircraft altitude #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
srherbener
merged 275 commits into
develop
from
feature/query_cxx_types_NE_aircraftAltitude
Dec 7, 2022
Merged
Changes from all commits
Commits
Show all changes
275 commits
Select commit
Hold shift + click to select a range
b165236
Fixed strange issue that happened while applying filters. Removed som…
rmclaren 0051a0e
Updated a bunch of unit tests so that they would work with the latest…
rmclaren c655f4a
updated test output files to work with latest version of ioda
rmclaren 8644963
Added unit test and now time the runtime.
rmclaren 25982ab
Fixed a couple more unit tests.
rmclaren 2b81f86
Added .dump files to gitlfs
rmclaren 0dabeb8
removed uneeded file
rmclaren 9eb5f62
BUFR2IODA conversion for AMSU-A and MHS Radiance data (#713)
emilyhcliu 1679444
Update README.md
rmclaren ef43b58
Test and enhance two yaml files for adpsfc snow and sevcrs data (#736)
YoulongXia-NOAA 7dfe9ef
Reduce the size of test files for amsua, mhs and iasi. Update the co…
emilyhcliu 92aedb7
Merged in latest changes from develop.
rmclaren a48e36a
Removed uneeded files I missed during merge.
rmclaren aa1f4ff
Initial checkin of query classes with a lot of placeholder code
rmclaren a723efc
Got data collection mostly working.
rmclaren f655842
Starting to work end to end. Need to fix exportdims and revisit code …
rmclaren a815020
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren a9983fc
Fixed issue where targets and masks were being copied unecessarily.
rmclaren af1304a
Feature/adpupa prepbufr (#794)
PraveenKumar-NOAA 48f5189
Got a bunch of unit tests working.
rmclaren eebbf26
add aircft profiles to feature/query
nicholasesposito 81a63a1
Fixed non-working functional unit tests.
rmclaren 3432e9c
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren 6402f03
Merge branch 'feature/query' into feature/query_cxx
rmclaren 2159242
Added unit test for simple groupby example.
rmclaren ee81939
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren 69a2f72
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren 7378b39
Merge branch 'feature/query' into feature/query_cxx
rmclaren 598ebf6
Made simple groupby test work. Fixed related bugs.
rmclaren 2406042
Added unit test for bufr files with missing fields.
rmclaren d8240c0
Added unit test for sfcshp data
rmclaren 81931e3
accidentaly messed up the bufr-mhs test. this fixes it
rmclaren 430850c
Integrated latest bug fixes from the feature/query branch.
rmclaren f083af6
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren 85c1a3e
Merge branch 'feature/query' into feature/query_cxx
rmclaren d16bf12
Fixed bug were we weren't checking for empty sequence counts.
rmclaren 6e158c7
added adpupa tests
rmclaren 68bc140
Merge branch 'feature/query' of https://github.com/JCSDA-internal/iod…
rmclaren 6c9f1d6
Merge branch 'feature/query' into feature/query_cxx
rmclaren eeb0896
Fixed bugs that prevented adpupa from working.
rmclaren 552aceb
Getting much closer to having adpupa groupby example working.
rmclaren d74796c
fixed final bug to get adpupa groupby case to work the same way.
rmclaren 26ab396
Removed some uneeded code.
rmclaren 56a452c
Merged latest from develop, and made it work with the latest from NCE…
rmclaren b86c4da
Reduce the size of the ADPUPA test input furrther
emilyhcliu 9da4fb3
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren da9c483
Removed undesired include from legacy bufr code.
rmclaren 5153474
Removed undesired include from legacy bufr code.
rmclaren 8300c35
Removed undesired include from legacy bufr code.
rmclaren a052afb
Removed undesired include from legacy bufr code.
rmclaren 418b1f4
Removed undesired include from legacy bufr code.
rmclaren e83ff00
Removed undesired include from legacy bufr code. Fixed some copyright…
rmclaren 6a892fd
Changed the way data provider works (no longer a singleton). Minor cl…
rmclaren c683b4b
Added print_queries tool to the ioda-converter project.
rmclaren fb5f07f
Improved situation arrising from missing string fields.
rmclaren 067390d
Improved detection of string fields.
rmclaren efa2763
Moved table logic out of the print_quiries function. Fixed bug were i…
rmclaren 0a79cb3
Merge branch 'develop' into feature/query_cxx
rmclaren ccbbeb6
Replace nlocs with Location, reduce the size of ADPUPA.prepbufr and ……
emilyhcliu f09a98c
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren d403b75
Reverted ADPUPA bufr file to smaller one.
rmclaren dff7251
Fixed compiler warnings
rmclaren eca2524
Fixed code style (norm) issues.
rmclaren d723ac0
Added doc strings to query code.
rmclaren 20eb76b
Feature/query cxx praveen (#893)
PraveenKumar-NOAA 6fe7e43
Added white space
rmclaren 664c2bf
Change dimension name to following unified IODA naming convention (#…
emilyhcliu 394ae09
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren b5d4cdc
Fixed bug when there were more than one subset in the file. Added abi…
rmclaren b55c75d
Updated print queries so it no longer uses colors but prints the dime…
rmclaren b98c09d
Chenged some maps to unordered_maps as they are better performance wise.
rmclaren 3122f9a
Feature/query cxx as (#914)
AshleyStanfield-NOAA da75624
Modify unit attribute in BUFR2IODA converter and bug fix for satellit…
emilyhcliu 24d6a3e
Fixed issue where non-existing query with index would cause a crash. …
rmclaren 68e94ec
Fixed some norm test failures.
rmclaren 6a5043e
Fixed all the unit tests
rmclaren 724b104
Made change so that there is always one group_by field whcih applies …
rmclaren 9657fb2
Removed uneeded test
rmclaren 107376f
Merge branch 'develop' into feature/query_cxx
emilyhcliu f76dbc8
Improved some of the code to do with finding the data object to group…
rmclaren bcda337
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren c80d02c
Fixed bug in print queries were fixed repeats were being missed.
rmclaren 29a65b3
update two yaml files via query_cxx (#906)
YoulongXia-NOAA 9325c5b
Feature/query cxx mhs (#960)
emilyhcliu a0dd8e1
Feature/query cxx amsua (#958)
emilyhcliu 4bd2e8c
Feature/query cxx iasi (#966)
emilyhcliu ac14e75
Feature/query cxx nick e adpsfc (#904)
nicholasesposito f611e3a
Feature/query cxx atovs (#963)
emilyhcliu 4adeaef
Added code for automated type selection.
rmclaren afbcb8f
Merge branch 'develop' into feature/query_cxx
srherbener a518afe
Removed check for unit type mismatch.
rmclaren 9bba0bf
Fixed bug with string fields.
rmclaren b8165a7
Missing values now depend directly on the types (always max value for…
rmclaren 297b19a
Updated DatetimeVariable.cpp code for optional value of Minute (#949)
PraveenKumar-NOAA b4a32e4
Automatic type selection based on NCEPLIB-bufr refernece, scale and u…
rmclaren 65ffefb
Added target.h and updated cmakelists.txt
rmclaren 3aecf36
updated mhs test file
rmclaren 53b6e41
Merge branch 'feature/query_cxx' into feature/query_cxx_types
rmclaren 92e46f3
Added way to manually override the type.
rmclaren 230ad33
Print queries now displays type information.
rmclaren bf8606e
Fixed issue with discovering if field is an integer.
rmclaren c2fc683
Added some doc strings. Fixed readme.
rmclaren a6e38a2
Improved the handling of data types when doing transforms.
rmclaren 2bd39d0
Fixed issue where transforms were being applied to missing value values.
rmclaren 8de9b84
Got it kinda working.
rmclaren a92d54b
slight improvemetn
rmclaren b1d0647
slight improvement
rmclaren 2be7961
Merged latest from develop branch
rmclaren 36419c6
Added support for the latest changes to NCEPLIB bufr
rmclaren d7d3f91
Merge branch 'develop' into feature/query_cxx
srherbener 3ec5043
Updated calls to NCEPLIB-bufr
rmclaren aafc721
Now uses OOPS logging.
rmclaren df7d5c8
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren 4fb7bae
merged from feature/query_cxx
rmclaren 22c73b6
Changed things back to using a NCEPLIB function to get table b data i…
rmclaren 27a670a
Updated for latest NCEPLIB-bufr enhancements branch. It removed get_t…
rmclaren a53f0e1
Fixed some comments
rmclaren 03bbffd
cast time to seconds instead of dividing by 1000
rmclaren dccf5a4
fixed norm test failure
rmclaren a76894e
made exit into exception
rmclaren dfc55d7
using back inserter to append to sequence path
rmclaren fbadda3
fixed error message.
rmclaren 703b087
fixed error message.
rmclaren 482f684
added prepbufr to git lfs
rmclaren aff8124
removed line continuation characters.
rmclaren bdd5c9b
replaced 10e10 with missing value
rmclaren f3fe27e
accidentally deleted line of code. added it back
rmclaren adf9c7e
changed print time function back tot he original.
rmclaren a2f7e65
using gsl::narrow instead of simpoe static cast
rmclaren 39bfe36
Enhanced vector product function
rmclaren ec02de9
Pulled out missing value into a Constants.h file to avoid duplication.
rmclaren d4905fe
fixed some comments
rmclaren 509af0f
fixed file permissions
rmclaren 03dadc4
Added try catch statements to main functions. Fixed warning.
rmclaren 06fb678
pre reserve some memory
rmclaren 79ad913
removed unused test from CMakeLists.txt file.
rmclaren 1360fd9
fixed norm check issues
rmclaren 8dff03a
Added include of unordered map as some compilers were not finding it.
rmclaren 950e3c9
Additions from previous branch
nicholasesposito d823c86
merged latest from develop
rmclaren a5a1b1b
Reverted unintended changes to files in ncar-bufr2nc-fortran and lib-…
rmclaren 4c43af3
Fixed bug that invovled parsing the bufr table data incorrectly. Basi…
rmclaren f4477bf
Fixed bug in print queries as it was not trimming subset trims proper…
rmclaren 37c0e49
merged latest from query_cxx. fixed issue in print queries where it w…
rmclaren 71f2046
Fixed some warnings and errors that happen with the CLANG compiler.
rmclaren 5281c18
Merge branch 'develop' into feature/query_cxx
srherbener ba1b34b
Enable the C++14 standard for C++ compiles. (#1036)
srherbener 2cf589b
Fixed some code review issues that Cory Martin broght up.
rmclaren e49879a
Merge branch 'feature/query_cxx' of https://github.com/JCSDA-internal…
rmclaren 71d2c26
updated docs for DataObject::print function
rmclaren c78b93e
commented in line that was accidentally commented out
rmclaren 6c29f1f
Revert "commented in line that was accidentally commented out"
rmclaren f92e4e5
Added back missing tests from the develop branch.
rmclaren cdecff3
Moved test_iodaconv_generic_gnssro_bufr back to where it was before (…
rmclaren 0327d35
merged latest from feature/query_cxx
rmclaren 25b31d9
Merge branch 'develop' into feature/query_cxx
CoryMartin-NOAA 66ee993
Fixed failing unit tests
rmclaren f396537
updated mhs unit test with dimension source to test this feature.
rmclaren 6a563eb
Moved applicable create dimension functions to be private scope.
rmclaren cb80b94
Update unit tests files and fixed some bugs so everything passes now.
rmclaren 09c01c7
Fixed issue caused by code review comment fix that caused bufr2ioda.x…
rmclaren 4e14eb9
Fixed exception handler in print_queries.x.
rmclaren 8d5d8e4
Merged latest from feature/query_cxx
rmclaren 5367711
Updated readme with a type example.
rmclaren 12e8ab8
got the latest from feature/query_cxx
rmclaren 10bf033
newest updates. aircar works, aircft doesnt
nicholasesposito eccc632
Merge branch 'feature/query_cxx_types' into feature/query_labeled_dims
rmclaren bc048c4
fixed test
rmclaren 2f7d0c6
Updated code to take advantage of types branch
rmclaren 905bd44
Updated docs strings for createDimension functions
rmclaren 4d1e6be
Updated a unit test to check that dimesnion sourcing code is working.
rmclaren 411e74b
Works except adds datetime -1
nicholasesposito 01f2e1f
Added some doc strings to ioda encoder.
rmclaren db27ad3
Pushing files onto git-lfs
rmclaren 9c65f78
Removed support for unsigned types as Fortran does not support them.
rmclaren a3c82a3
pushing files into lfs
rmclaren 09064f7
Updated with latest from feature/query_cxx_types
rmclaren a36a577
Added some validation for the dimension source fields.
rmclaren 3cf0f98
Enhanced some doc strings
rmclaren 96b30cc
Fixed norm test issue
rmclaren 663a2ce
Updated the readme.
rmclaren e65cc3e
Fixed some bugs with the datetime object. Added some validation.
rmclaren c183def
Made modifications so that the the messages would be filtered based o…
rmclaren eb3c877
Added configuration parameter called subsets to explicitly limit the …
rmclaren 8b37ae5
Improved the implemention a little.
rmclaren 202676d
Fixed coding norm issues
rmclaren 09d4b8b
Renamed query function to accumulate.
rmclaren 3317006
Added some yaml files for testing purposes (still need to make the te…
rmclaren 5ae5209
resolved merge conflicts
rmclaren be80e19
Merge branch 'feature/query_cxx_types' into feature/query_labeled_dims
rmclaren 0565659
Merge branch 'feature/query_labeled_dims' into feature/query_datetime…
rmclaren 40f0516
Updated adpsfc types (#1034)
nicholasesposito 0966327
Added unit tests
rmclaren 93e9894
most recent update
nicholasesposito 2818ec7
updated readme
rmclaren ea8126e
added getAsFloat back.
rmclaren 8f1e3fb
Merge branch 'develop' into feature/query_cxx_types
rmclaren 598b003
Merge branch 'feature/query_cxx_types' into feature/query_labeled_dims
rmclaren 0d4f5f3
Merge branch 'feature/query_labeled_dims' into feature/query_datetime…
rmclaren 81390ce
Merge branch 'develop' into feature/query_datetime_subset_fix
nicholasesposito f88e35f
Merge branch 'feature/query_datetime_subset_fix' into feature/query_c…
nicholasesposito 5d02287
Final Edits 20220927
nicholasesposito cd2c3a0
Update in/out/yamls and CMakelists
nicholasesposito ea3d27d
update CMakelists
nicholasesposito 2616525
update outputs
nicholasesposito e54a265
update acft pro output
nicholasesposito b98a982
update cmake
nicholasesposito 23885b5
update bufr_specifying_subsets.nc
nicholasesposito a2a85ec
update apro with aircraftFlightPhase
nicholasesposito c5340e2
update noAMDAR yaml with qualityInformation group
nicholasesposito 42f2d7d
percentConfidence info update
nicholasesposito af2d807
QualityIndicator -> QualityInformation
nicholasesposito 279429f
update noamdar
nicholasesposito 728fc25
merge develop and fix conflicts
nicholasesposito cd451b8
conflicts re-fixed
nicholasesposito 5c16e96
update output
nicholasesposito 8027e91
update intput
nicholasesposito 04ebd15
update bufr_specifying_subsets.nc
nicholasesposito 2b8f5ea
2020 -> 2022, add std atm comment
nicholasesposito 5453120
remove fort.20
nicholasesposito 6621d9a
update yamls/outputs so vars are clearer
nicholasesposito a15e13c
Added isMissing method to dataObject
rmclaren e5f1b46
most recent updates AA
nicholasesposito 52a5536
Merge branch 'feature/query_cxx_types_NE_aircraftAltitude' of https:/…
nicholasesposito 58978fc
Major updates
nicholasesposito 54d0859
Clean up
nicholasesposito ec1c863
AA.h get rid of Lat
nicholasesposito 8927fde
Add validation / check for dims size
nicholasesposito d38f081
2020 -> 2022 in yamls
nicholasesposito 40485ff
Merge branch 'develop' into feature/query_cxx_types_NE_aircraftAltitude
BenjaminRuston d23d416
newest yamls
nicholasesposito 78b1151
Merge branch 'feature/query_cxx_types_NE_aircraftAltitude' of https:/…
nicholasesposito fd1c588
update yaml no lat
nicholasesposito 12ed5d3
Refactored AircraftAltitudeVariable a little.
rmclaren c212011
Fixed bug. AircAircraftIndicatedAltitude only used with Pressure.
rmclaren b29bc00
update yaml outs
nicholasesposito bb167a2
Norm test fixes
rmclaren 846f15d
Merge branch 'feature/query_cxx_types_NE_aircraftAltitude' of https:/…
nicholasesposito 00aff4a
update with Metadata/rhpccf
nicholasesposito f4363aa
update testoutput name
nicholasesposito 8c594ee
RH
nicholasesposito 7b921ae
rm old aircft profiles yaml,bufr,outputnc
nicholasesposito 3f20c99
Merge branch 'develop' into feature/query_cxx_types_NE_aircraftAltitude
nicholasesposito baf90b1
fix {
nicholasesposito 6732c6f
Merge branch 'develop' into feature/query_cxx_types_NE_aircraftAltitude
srherbener 8131875
AircraftAltitudeVariable.cpp numbers dot f
nicholasesposito ef4d09d
fieldValues updates
518d9f9
update noamdar
nicholasesposito 107da96
coding norms
nicholasesposito 7a0830c
fixed comment on isMissing function
rmclaren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
208 changes: 208 additions & 0 deletions
208
src/bufr/BufrParser/Exports/Variables/AircraftAltitudeVariable.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,208 @@ | ||
| /* | ||
| * (C) Copyright 2022 NOAA/NWS/NCEP/EMC | ||
| * | ||
| * This software is licensed under the terms of the Apache Licence Version 2.0 | ||
| * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
| */ | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <ostream> | ||
| #include <time.h> | ||
| #include <vector> | ||
|
|
||
| #include "eckit/exception/Exceptions.h" | ||
|
|
||
| #include "DataObject.h" | ||
| #include "AircraftAltitudeVariable.h" | ||
|
|
||
|
|
||
| namespace | ||
| { | ||
| namespace ConfKeys | ||
| { | ||
| const char* Pressure = "pressure"; | ||
| const char* AircraftIndicatedAltitude = "aircraftIndicatedAltitude"; | ||
| const char* PressureAltitudeRelativeToMeanSeaLevel = | ||
| "pressureAltitudeRelativeToMeanSeaLevel"; | ||
| const char* FlightLevel = "flightLevel"; | ||
| const char* Height = "height"; | ||
| const char* HeightOrAltitude = "heightOrAltitude"; | ||
| const char* FlightLevelST = "flightLevelST"; | ||
| } // namespace ConfKeys | ||
|
|
||
| const std::vector<std::string> FieldNames = {ConfKeys::Pressure, | ||
| ConfKeys::AircraftIndicatedAltitude, | ||
| ConfKeys::PressureAltitudeRelativeToMeanSeaLevel, | ||
| ConfKeys::FlightLevel, | ||
| ConfKeys::Height, | ||
| ConfKeys::HeightOrAltitude, | ||
| ConfKeys::FlightLevelST}; | ||
| } // namespace | ||
|
|
||
|
|
||
| namespace Ingester | ||
| { | ||
| AircraftAltitudeVariable::AircraftAltitudeVariable(const std::string& exportName, | ||
| const std::string& groupByField, | ||
| const eckit::LocalConfiguration &conf) : | ||
| Variable(exportName), | ||
| groupByField_(groupByField), | ||
| conf_(conf) | ||
| { | ||
| initQueryMap(); | ||
| } | ||
|
|
||
| std::shared_ptr<DataObjectBase> AircraftAltitudeVariable::exportData(const BufrDataMap& map) | ||
| { | ||
| checkKeys(map); | ||
|
|
||
| std::unordered_map<std::string, std::shared_ptr<DataObjectBase>> includedFieldMap; | ||
| std::vector<std::string> includedFields; | ||
|
|
||
| std::shared_ptr<DataObjectBase> referenceObj = nullptr; | ||
| for (const auto& fieldName : FieldNames) | ||
| { | ||
| if (conf_.has(fieldName)) | ||
| { | ||
| includedFieldMap.insert({fieldName, map.at(getExportKey(fieldName))}); | ||
| includedFields.push_back(fieldName); | ||
| } | ||
| } | ||
|
|
||
| referenceObj = (*includedFieldMap.begin()).second; | ||
|
|
||
| // Validation: make sure the dimensions are consistent | ||
| auto path = referenceObj->getPath(); | ||
| for (const auto& fieldName : FieldNames) | ||
| { | ||
| if (includedFieldMap.find(fieldName) != includedFieldMap.end() && | ||
| includedFieldMap[fieldName]->getPath() != path) | ||
| { | ||
| std::ostringstream errStr; | ||
| errStr << "Inconsistent dimensions found in source data."; | ||
| throw eckit::BadParameter(errStr.str()); | ||
| } | ||
| } | ||
|
|
||
| std::vector<float> aircraftAlts; | ||
| aircraftAlts.resize(referenceObj->size(), DataObject<float>::missingValue()); | ||
|
|
||
| for (size_t idx = 0; idx < referenceObj->size(); idx++) | ||
| { | ||
| std::cout << "idx = " << idx << std::endl; | ||
| for (auto nameIt = includedFields.rbegin(); nameIt != includedFields.rend(); ++nameIt) | ||
| { | ||
| const auto& fieldName = *nameIt; | ||
| const auto& fieldValues = includedFieldMap.at(fieldName); | ||
| if (fieldName == ConfKeys::Pressure) | ||
| { | ||
| if (!fieldValues->isMissing(idx)) | ||
| { | ||
| auto value = fieldValues->getAsFloat(idx); | ||
| if (value < 22630.0f) | ||
| { | ||
| aircraftAlts[idx] = | ||
| 11000.0f - (std::log1p(value / 22630.0f) / 0.0001576106f); | ||
| std::cout << "section 1" << std::endl; | ||
| } | ||
| else | ||
| { | ||
| aircraftAlts[idx] = | ||
| (1.0f - powf((value / 101325.0f), | ||
| (1.0f / 5.256f))) * (288.15f / 0.0065f); | ||
| std::cout << "section 2" << std::endl; | ||
| } | ||
| } | ||
| else if (includedFieldMap.find(ConfKeys::AircraftIndicatedAltitude) | ||
| != includedFieldMap.end()) | ||
| { | ||
| if (!includedFieldMap[ConfKeys::AircraftIndicatedAltitude]->isMissing(idx)) | ||
| { | ||
| aircraftAlts[idx] = | ||
| includedFieldMap[ConfKeys::AircraftIndicatedAltitude]->getAsFloat(idx); | ||
| std::cout << "section 3" << std::endl; | ||
| } | ||
| } | ||
| } | ||
| else if (fieldName == ConfKeys::AircraftIndicatedAltitude) | ||
| { | ||
| // This variable is only used in conjunction with pressure. | ||
| continue; | ||
| std::cout << "section 4" << std::endl; | ||
| } | ||
| else if (!fieldValues->isMissing(idx)) | ||
| { | ||
| std::cout << " fieldValues = " << fieldValues << std::endl; | ||
| aircraftAlts[idx] = fieldValues->getAsFloat(idx); | ||
| std::cout << "section 5" << std::endl; | ||
| } | ||
| } | ||
| std::cout << "AA = " << aircraftAlts[idx] << std::endl; | ||
| } | ||
|
|
||
| return std::make_shared<DataObject<float>>(aircraftAlts, | ||
| getExportName(), | ||
| groupByField_, | ||
| referenceObj->getDims(), | ||
| referenceObj->getPath(), | ||
| referenceObj->getDimPaths()); | ||
| } | ||
|
|
||
| void AircraftAltitudeVariable::checkKeys(const BufrDataMap& map) | ||
| { | ||
| std::vector<std::string> requiredKeys; | ||
| for (const auto& fieldName : FieldNames) | ||
| { | ||
| if (conf_.has(fieldName)) | ||
| { | ||
| requiredKeys.push_back(getExportKey(fieldName)); | ||
| } | ||
| } | ||
|
|
||
| std::stringstream errStr; | ||
| errStr << "Query "; | ||
|
|
||
| bool isKeyMissing = false; | ||
| for (const auto& key : requiredKeys) | ||
| { | ||
| if (map.find(key) == map.end()) | ||
| { | ||
| isKeyMissing = true; | ||
| errStr << key; | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| errStr << " could not be found during export of AircraftAltitude object."; | ||
|
|
||
| if (isKeyMissing) | ||
| { | ||
| throw eckit::BadParameter(errStr.str()); | ||
| } | ||
| } | ||
|
|
||
| QueryList AircraftAltitudeVariable::makeQueryList() const | ||
| { | ||
| auto queries = QueryList(); | ||
|
|
||
| for (const auto& fieldName : FieldNames) | ||
| { | ||
| if (conf_.has(fieldName)) | ||
| { | ||
| QueryInfo info; | ||
| info.name = getExportKey(fieldName); | ||
| info.query = conf_.getString(fieldName); | ||
| info.groupByField = groupByField_; | ||
| queries.push_back(info); | ||
| } | ||
| } | ||
|
|
||
| return queries; | ||
| } | ||
|
|
||
| std::string AircraftAltitudeVariable::getExportKey(const std::string& name) const | ||
| { | ||
| return getExportName() + "_" + name; | ||
| } | ||
| } // namespace Ingester |
52 changes: 52 additions & 0 deletions
52
src/bufr/BufrParser/Exports/Variables/AircraftAltitudeVariable.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * (C) Copyright 2022 NOAA/NWS/NCEP/EMC | ||
| * | ||
| * This software is licensed under the terms of the Apache Licence Version 2.0 | ||
| * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
| #include <memory> | ||
|
|
||
| #include "eckit/config/LocalConfiguration.h" | ||
|
|
||
| #include "Variable.h" | ||
|
|
||
|
|
||
| namespace Ingester | ||
| { | ||
| /// \brief Exports parsed data as aircraftAltitudes using specified Mnemonics | ||
| class AircraftAltitudeVariable final : public Variable | ||
| { | ||
| public: | ||
| AircraftAltitudeVariable() = delete; | ||
| AircraftAltitudeVariable(const std::string& exportName, | ||
| const std::string& groupByField, | ||
| const eckit::LocalConfiguration& conf); | ||
|
|
||
| ~AircraftAltitudeVariable() final = default; | ||
|
|
||
| /// \brief Get the configured mnemonics and turn them into AircraftAltitude | ||
| /// \param map BufrDataMap that contains the parsed data for each mnemonic | ||
| std::shared_ptr<DataObjectBase> exportData(const BufrDataMap& map) final; | ||
|
|
||
| /// \brief Get a list of queries for this variable | ||
| QueryList makeQueryList() const final; | ||
|
|
||
| private: | ||
| /// \brief For field | ||
| std::string groupByField_; | ||
|
|
||
| /// \brief The configuration | ||
| const eckit::LocalConfiguration conf_; | ||
|
|
||
| /// \brief makes sure the bufr data map has all the required keys. | ||
| void checkKeys(const BufrDataMap& map); | ||
|
|
||
| /// \brief get the export key string | ||
| std::string getExportKey(const std::string& name) const; | ||
| }; | ||
| } // namespace Ingester |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 4 new tests for this? seems excessive but I'm not sure...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's one for each yaml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you all if you want to keep them. There are slight differences that I think are important but I don't know enough about other non-aircraft yamls to know if they're important to keep in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the unit level testing it's more about code coverage. So if you think that having the four tests will hit more of the "if" branches in your code, then it might be worth keeping all these. The tradeoff of course is that we want the tier1 ctests to run as fast as possible so tiny test cases are best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests take a fraction of a second each. I think we should keep them, as they also test different portions of aircraftAltitude.