Skip to content
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

"wpgt" does not populate. #125

Open
saltymaverick opened this issue Apr 4, 2023 · 4 comments
Open

"wpgt" does not populate. #125

saltymaverick opened this issue Apr 4, 2023 · 4 comments

Comments

@saltymaverick
Copy link

saltymaverick commented Apr 4, 2023

Hello world,

All of the values are returned except for "wpgt"... the one variable I need. Here is a working code. I'm stumped, hoping to receive some pointers.

Import meteostat:
from meteostat import Stations, Daily, Point

Find nearby stations:
stations = Stations()
stations = stations.nearby(lat, lon, radius)
stations = stations.fetch(num_stations)

Fetch daily data for each station:
data_list = pd.DataFrame(columns=["station", "time", "tavg", "tmin","tmax","prcp","wdir","wspd","wpgt","pres",])

loop over each row in this set of data, add station, for each row for index, row in data.iterrows():
station_info = {
"station": [station_id],
"staion name": [station_name],
"time": [index.strftime("%Y-%m-%d")],
"tavg": [(row.tavg * 9/5) + 32],
"tmin": [(row.tmin * 9/5) + 32],
"tmax": [(row.tmax* 9/5) + 32],
"prcp": [row.prcp * 0.0393701],
"wdir": [row.wdir],
"wspd": [row.wspd * 0.621371192],
"wpgt": [row.wpgt * 0.621371192],
"pres": [round(row.pres* 0.0145037738)]}

output_file_path = "FILE_NAME"
output_file_path = "PATH"
data_list.to_excel(output_file_path, index=False)

@clampr
Copy link
Member

clampr commented Apr 5, 2023

Hi,

What's your value for lat, lon and radius? It might well be that the weather stations in this area don't provide wpgt data.

@saltymaverick
Copy link
Author

saltymaverick commented Apr 6, 2023

 from meteostat import Stations, Daily, Point
 def get_latitude_longitude(address):
     geolocator = Nominatim(user_agent="geoapiExercises")
     try:
        location = geolocator.geocode(address)
        if location:
            return location.latitude, location.longitude
        else:
            return None, None
    except GeocoderTimedOut:
        return get_latitude_longitude(address)

if __name__ == "__main__":
    address = input("Enter the address: ")
    latitude, longitude = get_latitude_longitude(address)
    if latitude and longitude:
        print(f"Latitude: {latitude}, Longitude: {longitude}")
    else:
        print("Location not found.")

lat = latitude
lon = longitude
radius = 100000  # meters
num_stations = 5
start = datetime(2022, 9, 11)
end = datetime(2022, 11, 9)

for index, station in stations.iterrows():
    station_id = station['icao'] 
    station_name = station['name']
    station_lat = station['latitude']
    station_lon = station['longitude']
    station_ele = station.elevation

point = Point(station_lat, station_lon, station_ele)
data = Daily(point, start, end)
data = data.fetch()

for index, row in data.iterrows():
    station_info = {
        "station": [station_id],
        "staion name": [station_name],
        "time": [index.strftime("%Y-%m-%d")],
        "tavg": [(row.tavg * 9/5 + 32)],
        "tmin": [(row.tmin * 9/5 + 32)],
        "tmax": [(row.tmax* 9/5 + 32)],
        "prcp": [row.prcp * 0.0393701],
        "wdir": [row.wdir],
        "wspd": [row.wspd * 0.621371192],
        "wpgt": [row.wpgt * 0.621371192],
        "pres": [round(row.pres* 0.0145037738)],
        "distance": [haversine(lat, lon, station_lat, station_lon)]
    }

@clampr
Copy link
Member

clampr commented Apr 6, 2023

Can you share the result of print(f"Latitude: {latitude}, Longitude: {longitude}") or the address?

@saltymaverick
Copy link
Author

saltymaverick commented Apr 18, 2023

-lat/lon of structure;
structure_lat = 27.929571
structure_lon = -82.747118

-for the date range, September 9, 2022 thru September 27, 2022;
start = datetime(2022, 9, 27)
end = datetime(2022, 9, 29)

-This brings up weather stations;
KCLW, KPIE, KTPA, KSPG, KMCF

However, it is not localized to only this lat/lon, all wpgt value for any station for any date range does not return values. When I use the UI on meteostat, the results also do not return wind gust as a visible output. Do you experience the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants