[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[THREDDS #CUW-775110]: How to Parse Upper air Soundings in c++



Hello,

I'm unfamiliar with smfl, and it doesn't appear that you're working with any 
netCDF data, so I'm afraid there isn't I can do for you.  I might suggest 
trying the appropriate stack overflow community resource.

Sorry this isn't more immediately useful, but I'm afraid I would need to solve 
this issue myself before I was able to provide you any guidance.

-Ward


> I have this basic window that draws two lines a red line for temperature
> and a blue line for dewpoint
> 
> #include "Soundings.h"
> 
> Soundings::Soundings()
> : m_window(sf::VideoMode(800, 600), "Soundings")
> {
> }
> 
> void Soundings::run()
> {
> sf::RectangleShape Skewt(sf::Vector2f(600, 510));
> Skewt.setPosition(72, 50);
> Skewt.setFillColor(sf::Color::Black);
> 
> // create a red line for temperature
> sf::VertexArray temperatureLine(sf::Lines, 2);
> temperatureLine[0].position = sf::Vector2f(Skewt.getPosition().x +
> Skewt.getSize().x / 4, Skewt.getPosition().y);
> temperatureLine[0].color = sf::Color::Red;
> temperatureLine[1].position = sf::Vector2f(Skewt.getPosition().x +
> Skewt.getSize().x / 4, Skewt.getPosition().y + Skewt.getSize().y);
> temperatureLine[1].color = sf::Color::Red;
> 
> // create a blue line for dew point
> sf::VertexArray dewPointLine(sf::Lines, 2);
> dewPointLine[0].position = sf::Vector2f(Skewt.getPosition().x +
> Skewt.getSize().x * 3 / 4, Skewt.getPosition().y);
> dewPointLine[0].color = sf::Color::Blue;
> dewPointLine[1].position = sf::Vector2f(Skewt.getPosition().x +
> Skewt.getSize().x * 3 / 4, Skewt.getPosition().y + Skewt.getSize().y);
> dewPointLine[1].color = sf::Color::Blue;
> 
> std::ifstream
> dataFile("C:/Users/----/Desktop/BOLTgui/BOLT/upper_air_20230305_0000.txt");
> if (!dataFile.is_open())
> {
> std::cout << "Error opening file" << std::endl;
> return;
> }
> 
> std::vector<std::pair<float, float>> temperatureData;
> std::vector<std::pair<float, float>> dewPointData;
> 
> float temperature, dewPoint;
> while (dataFile >> temperature >> dewPoint)
> {
> temperatureData.push_back(std::make_pair(temperature, dewPoint));
> dewPointData.push_back(std::make_pair(dewPoint, temperature));
> }
> 
> dataFile.close();
> 
> while (m_window.isOpen())
> {
> sf::Event event;
> while (m_window.pollEvent(event))
> {
> if (event.type == sf::Event::Closed)
> m_window.close();
> }
> 
> m_window.clear(sf::Color(45, 45, 45));
> m_window.draw(Skewt);
> m_window.draw(temperatureLine);
> m_window.draw(dewPointLine);
> m_window.display();
> }
> }
> 
> how can i parse the upper air soundings and manipulate the lines from the
> txt file
> here is what the ui looks like im using sfml
> 
> 


Ticket Details
===================
Ticket ID: CUW-775110
Department: Support netCDF
Priority: High
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.