Code Monkey home page Code Monkey logo

metarmap's People

Contributors

moisedo avatar prueker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

metarmap's Issues

NameError: name 'false' is not defined

New setup running on Pi Zero W 1 on Bullseye. Getting the error "NameError: name 'false' is not defined" when trying to execute metar.py. I've scoured metar.py and I don't see any capitalization issue with "false" instead of "False" so not sure what is causing this.

Random changing LED Colors

I've followed the directions several times, using bullseye and bookworm, how ever even using your code without touching any options, once the pi connects and get the METAR data, the screen does as it should, but the LEDs light up then change to random colors every 1 second.

Type Error

When running the metar script I'm getting the following response:

File "metar.py.txt", line 215, in
+ str(lightning))
TypeError: can only concatenate str (not "NoneType") to str

I never changed anything with the file so not sure why this is coming up now. Any help would be appreciated

NameError: name 'lightningConditions' is not defined

Hi,
Tried your updated scripts on a new pi following your instructions on what packages to use etc and copied the files over to /home/pi/ (all default except LED_Count = 35 and my airports file - UK Metar sites).
I get the following error;
Traceback (most recent call last):
File "metar.py", line 110, in
print("Setting LED " + str(i) + " for " + airportcode + " to " + ("lightning " if lightningConditions else "") + ("windy " if windy else "") + (conditions["flightCategory"] if conditions != None else "None") + " " + str(color))
NameError: name 'lightningConditions' is not defined

I can see where in metar.py it falls over;
print("Setting LED " + str(i) + " for " + airportcode + " to " + ("lightning " if lightningConditions else "") + ("windy " if windy else "") + (conditions["flightCategory"] if conditions != None else "None") + " " + str(color)) and if I remark that line out if falls over on line 111 with;
Traceback (most recent call last):
File "metar.py", line 111, in
pixels[i] = color
File "/usr/local/lib/python3.7/dist-packages/adafruit_pypixelbuf.py", line 298, in setitem
self._set_item(index, r, g, b, w)
File "/usr/local/lib/python3.7/dist-packages/adafruit_pypixelbuf.py", line 264, in _set_item
raise IndexError
IndexError

any idea's ?

Regards
D

Handling NoneType Error in stationId and Missing <flight_category> Element

1. Handling NoneType Error in stationId Concatenation:
The script crashed due to attempting to concatenate a None value with a string. This was addressed by checking if stationId obtained from the XML was None and handling it appropriately before usage.

2. Handling Missing <flight_category> Element:
Some METAR data entries lacked the <flight_category> element, which led to errors when the script tried to access its text. Introduced a check for the presence of this element and provided a default value when missing.

Proposed solution:

  1. Check for None in stationId:
    Before using stationId in operations that assume it is a string, verify it isn't None. If it is, skip processing the current METAR data.
for metar in root.iter('METAR'):
    stationId = metar.find('station_id').text if metar.find('station_id') is not None else None
    if stationId is None:
        print("Missing or malformed station ID, skipping METAR element:")
        print(ET.tostring(metar, encoding='unicode'))
        continue
  • Handling None for stationId ensures the script does not crash when data is missing, improving its robustness.
  1. Default Value for Missing <flight_category>:
    Check if the <flight_category> element exists and provide a default value if it doesn't. This prevents attempts to access attributes of a None object.
flight_category_element = metar.find('flight_category')
if flight_category_element is None or flight_category_element.text is None:
    flightCategory = "Unknown"
    print(f"Flight category missing for {stationId}, using default: {flightCategory}")
else:
    flightCategory = flight_category_element.text
  • Providing defaults for missing <flight_category> ensures the script can handle incomplete METAR data gracefully without breaking.

Submitting PR for this fix.

Brightness doesn't change

No matter what value I set LED_BRIGHTNESS to there seems to be no change. Everything else is working flawlessly! Thanks!

Wind Blinking kills updating

I have cron running every 5 minutes, and I have the blink duration set for 300 seconds. It seems to blink correctly for the first 5 minute window, then freezes and stops updating. Any thoughts?

Syntax Errors after updating for Calm Winds

I'm getting some syntax errors in this file now. See <<<< notes below.

if condition["windSpeed"] == 0:
draw.text((x, top + 15), "Calm", font=fontSmall, fill=255)
else:
draw.text((x, top + 15), condition["windDir"] + "@" + str(condition["windSpeed"]) + ("G" + str(condition["windGust$ <<<< This ends abruptly should it be: str(condition["windGust"]) ????

draw.text((x + 64, top + 15), str(condition["vis"]) + "SM " + condition["obs"], font=fontSmall, fill=255) <<<< I think the 'str' command is missing for "obs". This line should be: draw.text((x + 64, top + 15), str(condition["vis"]) + "SM " + str(condition["obs"]), font=fontSmall, fill=255)

Data not being sent as light output

I have used the software for a while but I just rebooted my pi and code no longer works. The code will run through my airports (Michigan Airports) and give out a true false statement....
KMTC:VFR:12:True:False
KJXN:VFR:10:True:False
KBAX:VFR:11:True:False
KCFS:VFR:7:False:False
KMGN:VFR:5:False:False

But code ends with....
Traceback (most recent call last):
File "metar.py", line 110, in
print("Setting LED " + str(i) + " for " + airportcode + " to " + ("lightning " if lightningConditions else "") + ("windy " if windy else "") + (conditions["flightCategory"] if conditions != None else "None") + " " + str(color))
NameError: name 'lightningConditions' is not defined

I updated and reinstalled all download files. When I run python3 code for all lights to come on in one color it works (in all the colors). This strictly seems like a code pushing information to the board or to python error. I am not fluent with python so any help would be awesome.

Full code list of command run....(no lights on)
pi@raspberrypi:~ $ sudo python3 metar.py
https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=5&mostRecentForEachStation=true&stationString=KADG,,KARB,KYIP,KDTW,,KMTC,,KPTK,,KFNT,KRNP,,KCFS,,KBAX,,,KMBS,,KAMN,KMOP,,,Y31,,KOSC,,KAPN,KPZQ,,KSLH,,KDRM,,KCIU,,KERY,,KISQ,,KSJX,,KMGN,KCVX,KACB,KGLR,KGOV,KHTL,,KCAD,,KTVC,,KFKS,KMBL,KLDA,,KRQB,,KFFX,KMKG,,KBIV,,8D4,KGRR,Y70,KLAN,KTEW,KJXN,KJYM,KOEB,,KBTL,KAZO,,KLWA,,KSBN
KISQ:VFR:4:False:False
KGOV:MVFR:6:False:False
KMBL:VFR:7:False:False
KCIU:MVFR:4:False:False
KMTC:VFR:12:True:False
KJXN:VFR:10:True:False
KBAX:VFR:11:True:False
KCFS:VFR:7:False:False
KMGN:VFR:5:False:False
KERY:VFR:4:False:False
KLWA:VFR:7:False:False
KOEB:VFR:4:False:False
KRQB:VFR:3:False:False
KCAD:MVFR:7:False:False
KJYM:VFR:7:False:False
KRNP:VFR:7:False:False
KFKS:VFR:5:False:False
KOSC:VFR:13:True:False
KPZQ:MVFR:8:False:False
KFFX:VFR:3:False:False
KSJX:VFR:5:False:False
KACB:VFR:4:False:False
KCVX:VFR:8:False:False
KTEW:VFR:6:False:False
KMOP:VFR:6:False:False
KMKG:VFR:5:False:False
KAMN:VFR:6:False:False
KDRM:VFR:5:False:False
KSBN:VFR:6:False:False
KAPN:VFR:12:True:False
KARB:VFR:10:True:False
KYIP:VFR:11:False:False
KBIV:VFR:4:False:False
KPTK:VFR:14:True:False
KGRR:VFR:5:False:False
KTVC:VFR:6:False:False
KBTL:VFR:5:False:False
KAZO:VFR:6:False:False
KLAN:VFR:8:False:False
KDTW:VFR:17:True:False
KFNT:VFR:12:True:False
KMBS:VFR:9:False:False
Missing flight condition, skipping.
KHTL:VFR:11:True:False
KGLR:VFR:5:True:False
KSLH:VFR:11:True:False
Traceback (most recent call last):
File "metar.py", line 110, in
print("Setting LED " + str(i) + " for " + airportcode + " to " + ("lightning " if lightningConditions else "") + ("windy " if windy else "") + (conditions["flightCategory"] if conditions != None else "None") + " " + str(color))
NameError: name 'lightningConditions' is not defined

Refresh.sh not consistently acting

Hi,

Please bear with me as I am very inexperienced with Linux and Raspberry Pi. I'm amazed I've gotten as far as I have. It wasnt until today I realized you updated the metar script to factor in wind. I've updated my metar and refresh script with what you currently have published however periodically when it refreshes I'll notice that it stops factoring wind when it should be there. When i run the metar script manually it seems to put it back on track.

Do you think you could give me any pointers on where to begin to try and diagnose this issue?

Thanks so much for the fantastic work you have put into this. I have significantly enjoyed analyzing my own built Metar Map

Update to metar.py?

I've been trying to follow the discussion on adding a yellow led for windgusts and can't quite seem to make it all work. I'm not sure where to edit the code to include the features mentioned in the comments.

Possible enhancements:

  1. HIGH_WINDS_THRESHOLD - addition of yellow led to display for windspeeds & windgusts at or above the WIND_BLINK_THRESHOLD
  2. Lightning Feature enhancements mentioned in the discussion

Any idea when the metar.py file can/will be updated to include this and other functionality mentioned in the comments and discussion on the original article?

Thanks again. Just finished with my project and will post pics.

Index Error

Hi! I updated the airports list and the metar.py file but get this error at the end:

Setting LED 53 for KBFL to VFR (255, 0, 0) Setting LED 60 for KMMH to VFR (255, 0, 0) Traceback (most recent call last): File "metar.py", line 111, in <module> pixels[i] = color File "/usr/local/lib/python3.7/dist-packages/adafruit_pypixelbuf.py", line 298, in __setitem__ self._set_item(index, r, g, b, w) File "/usr/local/lib/python3.7/dist-packages/adafruit_pypixelbuf.py", line 264, in _set_item raise IndexError IndexError

startup.sh not working

Can't seem to get the startup.sh routine to work. If I just run the .py straight from rc.local it works fine. Also running the .py from crontab works to keep it updating. Any reason I should debug further and get the .sh working??

Coversion to Libre PC - AML-S905X-CC

I have this project running currently on a Raspberry Pi 3B and everything works as expected.

Given the price and availability of Pi's these days, I found what appeared to be a near suitable replacement (Libre PC - M# AML-S905X-CC) I picked up a couple of these from Amazon for $35/each. Anyways, I was able to load Bullseye Lite and get follow most of the steps to recreate this project. However, I can't figure out the GPIO Interface for the PWM Output and the "Overlays" I guess for the I2C for the small display.

Has anyone tried to get this project working on a Libre PC Le Potato? This is my 2nd project building the Metar Map and wanted to gift it to my Flight Instructor since I recently became a Private Pilot.

This is what I get when I try to run the project running on the AML-S905X-CC:


metar@raspberrypi:~ $ python3 metar.py
Traceback (most recent call last):
File "/home/metar/metar.py", line 6, in
import neopixel
File "/usr/local/lib/python3.9/dist-packages/neopixel.py", line 18, in
from neopixel_write import neopixel_write
File "/usr/local/lib/python3.9/dist-packages/neopixel_write.py", line 36, in
raise NotImplementedError("Board not supported")
NotImplementedError: Board not supported
metar@raspberrypi:~ $

Setting the LED Status loops

I made 2 board, and everything is working perfectly, except for the fact that it keep looping while setting the status of each LED.

It finishes setting the status, then does it again and again. This goes on for about 4 minutes before it finally 'finalises'. Everything else works, the cronjob keeps the leds updated every 2 minutes.

The side effect of the loop seems to be that when the wind is higher than what is defined it does not fade, but either just indicate the METAR code for the airport, or bugs around.

I assume the issue with with the airports file, because if I set only one LED then it works fine.

Setting LED 0 for KALW to VFR (255, 0, 0)
Setting LED 1 for KPSC to VFR (255, 0, 0)
Setting LED 2 for KLWS to VFR (255, 0, 0)
Setting LED 3 for KPUW to VFR (255, 0, 0)
Setting LED 4 for KGEG to VFR (255, 0, 0)
Setting LED 5 for KSFF to VFR (255, 0, 0)
Setting LED 6 for KDEW to VFR (255, 0, 0)
Setting LED 7 for KCOE to VFR (255, 0, 0)
Setting LED 8 for KSZT to VFR (255, 0, 0)
Setting LED 9 for K65S to VFR (255, 0, 0)

Setting LED 0 for KALW to VFR (255, 0, 0)
Setting LED 1 for KPSC to VFR (255, 0, 0)
Setting LED 2 for KLWS to VFR (255, 0, 0)
Setting LED 3 for KPUW to VFR (255, 0, 0)
Setting LED 4 for KGEG to VFR (255, 0, 0)
Setting LED 5 for KSFF to VFR (255, 0, 0)
Setting LED 6 for KDEW to VFR (255, 0, 0)
Setting LED 7 for KCOE to VFR (255, 0, 0)
Setting LED 8 for KSZT to VFR (255, 0, 0)
Setting LED 9 for K65S to VFR (255, 0, 0)

Setting LED 0 for KALW to VFR (255, 0, 0)
Setting LED 1 for KPSC to VFR (255, 0, 0)
Setting LED 2 for KLWS to VFR (255, 0, 0)
Setting LED 3 for KPUW to VFR (255, 0, 0)
Setting LED 4 for KGEG to VFR (255, 0, 0)
Setting LED 5 for KSFF to VFR (255, 0, 0)
Setting LED 6 for KDEW to VFR (255, 0, 0)
Setting LED 7 for KCOE to VFR (255, 0, 0)
Setting LED 8 for KSZT to VFR (255, 0, 0)
Setting LED 9 for K65S to VFR (255, 0, 0)

(4 MINUTES LATER)

Done

Pico W

Have you tried this out with a Pico W?

I honestly think this project would be great with a Pico W as the computing power of the Zero is total overkill for this project.

I'd love to give it a go, but I lack in the coding department.

Startup?

The original file list had a Startup.sh file. Is this file not needed anymore?

Update aviationweather api endpoint

aviation weather changed their api format.

Update to this in ym own proj:
url = "https://aviationweather.gov/cgi-bin/data/dataserver.php?requestType=retrieve&dataSource=metars&format=xml&hoursBeforeNow=5&mostRecentForEachStation=true&stationString=" + ",".join([item for item in list(airport_dict.keys()) if "NULL" not in item])

Also, the line pulling visibility will have to change to just pull the value and not float it due to return being "10+" for most vfr results.

here's the new docs for context:
https://aviationweather.gov/data/api/#/Dataserver/dataserverMetars

refresh not running

Philip, great project here, and the instructions are relatively simple, even for a noob like me. I'm having one issue with the refresh. I've kept the interval at five minutes, but it runs metar.py for 300 seconds and does not refresh. On boot, refresh.sh runs from crontab and I get the metarpid.pid, however, it does not overwrite when I manually push using ./refresh.sh. Instead, I get 'metarpid.pid'$'\r'. In turn, both lightsoff.sh and refresh.sh have an error "pkill: pidfile not valid"

Any ideas or recommendations on fix?

Dim for Windy Conditions without Blinking

Is there an easy way to change the code so there is Wind Animation without the blinking? What I would like it to do is just keep the lights constantly dim, at the Fade brightness levels, for any airports that are windy. Maybe the code could select this option when it sees the Blinking Speed = 0.0 and the Activate_Windcondition_Animation = True?

Airport List issue/Aviation weather issue?

How do I verify that there isn't an issue with the website where the data is being pulled from. my map stopped working on 1/16/24. Find attached the result of your airport list (which works) and when I add my airport list and run. The first error seems to point to the website. I will attach my airport list to issue
pic of github airport list
pic of my airport list
user airport and pics.zip
pi@raspberrypi:~ $ sudo python3 metar.py
Running metar.py at 18/01/2024 19:17
Wind animation:False
Lightning animation:False
Daytime Dimming:False
External Display:False
Rotating through all airports on LED display
https://aviationweather.gov/cgi-bin/data/dataserver.php?requestType=retrieve&dataSource=metars&stationString=KCMX,KIMT,KMNM,KSUE,KOCQ,KGRB,KMTW,KSBM,KETB,KUES,KMKE,KENW,KUGN,KORD,KRPI,KRFD,KJUL,KRYV,KMSN,KUNU,KFLD,KOSH,KATW,KCLI,KEZS,KAIG,KRHI,KLNL,KAUW,KCWA,KSTE,KISW,KYS0,KDLL,KPUB,KDBQ,KPDC,KLSE,KCMY,KPBH,KIWD,KASX,KDYT,KOLG,KRCO,KEAU,KMSP,KGRB,KATW,KOSH&hoursBeforeNow=5&format=xml&mostRecent=true&mostRecentForEachStation=constraint
Traceback (most recent call last):
File "/home/pi/metar.py", line 156, in
content = urllib.request.urlopen(req).read()
File "/usr/lib/python3.9/urllib/request.py", line 214, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.9/urllib/request.py", line 523, in open
response = meth(req, response)
File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
response = self.parent.error(
File "/usr/lib/python3.9/urllib/request.py", line 561, in error
return self._call_chain(*args)
File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
result = func(*args)
File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error

Astra error.

After running: sudo pip3 install astral
I got: Successfully installed astral-2.2 pytz-2020.4

I updated: metar.py with new code, then ran metar.py and got this:

Traceback (most recent call last):
File "metar.py", line 67, in
ast = astral.Astral()
AttributeError: module 'astral' has no attribute 'Astral'

As coded:

Figure out sunrise/sunset times if astral is being used if astral is not None and USE_SUNRISE_SUNSET:

ast = astral.Astral()
try:
	city = ast[LOCATION]
except KeyError:
	print("Location not recognized, please check list of supported cities and reconfigure")
else:
	print(city)
	sun = city.sun(date = datetime.datetime.now().date(), local = True)
	BRIGHT_TIME_START = sun['sunrise'].time()
	DIM_TIME_START = sun['sunset'].time()
	print("Sunrise:" + BRIGHT_TIME_START.strftime('%H:%M') + " Sunset:" + DIM_TIME_START.strftime('%H:%M'))

----- Daytime dimming of LEDs based on time of day or Sunset/Sunrise -----

ACTIVATE_DAYTIME_DIMMING = True # Set to True if you want to dim the map after a certain time of day
LED_BRIGHTNESS_DIM = 0.1 # Float from 0.0 (min) to 1.0 (max)

BRIGHT_TIME_START = datetime.time(7,0) # Time of day to run at LED_BRIGHTNESS in hours and minutes
DIM_TIME_START = datetime.time(21,0) # Time of day to run at LED_BRIGHTNESS_DIM in hours and minutes

USE_SUNRISE_SUNSET = True # Set to True if instead of fixed times for bright/dimming, you want to use local sunrise/sunset
LOCATION = "Seattle" # Nearby city for Sunset/Sunrise timing, refer to https://astral.readthedocs.io/en/latest/#cities for list of cities supported

Why the error?

Modify for Raspberry Pi Pico?

Is there a chance this project could be modified to work for the Raspberry Pi Pico? I don't really see why not (unless there's some missing feature of micro python that I'm not aware of). Mostly seems like a few concepts based on a "regular" raspberry pi & a linux system would have to be changed.

LED's Not showing correct colors

After making the latest code changes, the LED's are all mixed up with colors. I've reverted back to original code. Only a couple of the LED's show correctly. Even if I turn False, all the automation, winds, lightning, the colors are not correct. Do you have a test script that will check each LED through the various used colors one at a time so we can determine if the LED string has bad addresses?

airports carriage returns error

Extra carriage returns at end of airports file causes failure. Maybe just my code. I'll seee if I can find a fix. Took me a while to find that issue

Lightning in vicinity of...

Came home to my entire map flashing white despite no TS or LT displaying on the METAR display. Maybe I just hadn't noticed it before but METARS include distant lightning in the remarks i.e. LTG DSNT NE AND SW. Anyway to ignore distant lightning and focus on the local area?

Display Fonts - "ttf-dejavu" name change

04/26/23
FYI,

install additional libraries needed to fill the display

sudo apt-get install ttf-dejavu

Running this statement returns the following error:

E: Unable to locate package ttf-dejavu

The name has changed.... Run this command instead:

sudo apt-get install fonts-dejavu

Airports file not found

When running “sudo python3 metar.py” from the METARMap directory, it says ‘/home/pi/airports’ can’t be found...

The airports file is listed when you input “ls” into the METARMap directory along with the other files, “crontab, license, lightsoff.sh” etc...

Is this where the airport list should be? Thanks again for your help.

Board 'hangs' with no status updates (Out of Memory)

FIgured this was the best way to let you know of an issue I have seen twice. about 7 days of running 24/7 and eventually the board never updates. With a clean boot and all working, running refresh.sh works perfectly. However when it is 'hung' and I attempt the same shell script, I see the following and only a reboot fixes it.

Traceback (most recent call last):
  File "/home/pi/metar.py", line 272, in <module>
    pixels.show()
  File "/usr/local/lib/python3.7/dist-packages/adafruit_pixelbuf.py", line 197, in show
    return self._transmit(self._post_brightness_buffer)
  File "/usr/local/lib/python3.7/dist-packages/neopixel.py", line 164, in _transmit
    neopixel_write(self.pin, buffer)
  File "/usr/local/lib/python3.7/dist-packages/neopixel_write.py", line 34, in neopixel_write
    return _neopixel.neopixel_write(gpio, buf)
  File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/bcm283x/neopixel.py", line 80, in neopixel_write
    "ws2811_init failed with code {0} ({1})".format(resp, message)
RuntimeError: ws2811_init failed with code -2 (Out of memory)
swig/python detected a memory leak of type 'ws2811_t *', no destructor found.

Displayairports

I've added the displayairports file to the root directory with a truncated list of airports I want to show on the mini-display. However, I got this error when running metar.py:
.
.
.
Setting LED 47 for KS52 to VFR (255, 0, 0)
Traceback (most recent call last):
File "metar.py", line 248, in
displaymetar.outputMetar(disp, stationList[displayAirportCounter], conditionDict.get(stationList[displayAirportCounter], None))
IndexError: list index out of range

Does 1.4.3 not include code for the truncated displayairports list?

Blinking kills updating

I have cron running every 5 minutes, and I have the blink duration set for 300 seconds. It seems to blink correctly for the first 5 minute window, then freezes and stops updating. Any thoughts?

Pixelsoff in documentation

This isn't really an issue in the code but for the documentation, nothing mentions needing to adjust the pixelsoff.py script to match the lights you have. I had 61 LEDs so the 50 scripted in the original document needed change. It was easy enough for me to find and fix, maybe not so much for new folks.

metar.py error

running the new metar.py prints out an error:

Traceback (most recent call last):
File "metar.py", line 109, in
pixels[i] = color
File "/usr/local/lib/python3.7/dist-packages/neopixel.py", line 176, in setitem
self._set_item(index, val)
File "/usr/local/lib/python3.7/dist-packages/neopixel.py", line 131, in _set_item
raise IndexError
IndexError

And, when running refresh, I get a pkill error, as follows:
pi@METAR-MAP:~ $ ./refresh.sh
pkill: pidfile not valid
Try `pkill --help' for more information.
pi@METAR-MAP:~ $ https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=5&mostRecentForEachStation=true&stationString=KALW,KPSC,KLWS,KPUW,KGEG,KSFF,KDEW,KCOE,KSZT,K65S,CYCG,CYLW,CYYF,CYDC,CYHE,CWAE,CYPW,CYCD,CYVR,CYXX,KBLI,KORS,KFHR,CYYJ,KUIL,KCLM,K0S9,KBVS,KAWO,KPAE,KBFI,KRNT,KBWT,KSHN,KTIW,KPLU,KOLM,KCLS,KHQM,KAST,K1S5,KYKM,KELN,KEAT,KSMP,KEPH,KOMK,KS52
Missing flight condition, skipping.
Missing Wind speed, skipping.
Setting LED 0 for KALW to VFR (255, 0, 0)
Setting LED 1 for KPSC to VFR (255, 0, 0)
Setting LED 2 for KLWS to VFR (255, 0, 0)
Setting LED 3 for KPUW to VFR (255, 0, 0)
Setting LED 4 for KGEG to VFR (255, 0, 0)
Setting LED 5 for KSFF to VFR (255, 0, 0)
Setting LED 6 for KDEW to VFR (255, 0, 0)
Setting LED 7 for KCOE to VFR (255, 0, 0)
Setting LED 8 for KSZT to VFR (255, 0, 0)
Setting LED 9 for K65S to VFR (255, 0, 0)
Setting LED 10 for CYCG to VFR (255, 0, 0)
Setting LED 11 for CYLW to VFR (255, 0, 0)
Setting LED 12 for CYYF to VFR (255, 0, 0)
Setting LED 13 for CYDC to VFR (255, 0, 0)
Setting LED 14 for CYHE to VFR (255, 0, 0)
Setting LED 15 for CWAE to VFR (255, 0, 0)
Setting LED 16 for CYPW to VFR (255, 0, 0)
Setting LED 17 for CYCD to VFR (255, 0, 0)
Setting LED 18 for CYVR to VFR (255, 0, 0)
Setting LED 19 for CYXX to VFR (255, 0, 0)
Setting LED 20 for KBLI to VFR (255, 0, 0)
Setting LED 21 for KORS to VFR (255, 0, 0)
Setting LED 22 for KFHR to VFR (255, 0, 0)
Setting LED 23 for CYYJ to VFR (255, 0, 0)
Setting LED 24 for KUIL to VFR (255, 0, 0)
Setting LED 25 for KCLM to VFR (255, 0, 0)
Setting LED 26 for K0S9 to None (0, 0, 0)
Setting LED 27 for KBVS to VFR (255, 0, 0)
Setting LED 28 for KAWO to VFR (255, 0, 0)
Setting LED 29 for KPAE to VFR (255, 0, 0)
Setting LED 30 for KBFI to VFR (255, 0, 0)
Setting LED 31 for KRNT to VFR (255, 0, 0)
Setting LED 32 for KBWT to None (0, 0, 0)
Setting LED 33 for KSHN to VFR (255, 0, 0)
Setting LED 34 for KTIW to VFR (255, 0, 0)
Setting LED 35 for KPLU to VFR (255, 0, 0)
Setting LED 36 for KOLM to VFR (255, 0, 0)
Setting LED 37 for KCLS to VFR (255, 0, 0)
Setting LED 38 for KHQM to VFR (255, 0, 0)
Setting LED 39 for KAST to VFR (255, 0, 0)
Setting LED 40 for K1S5 to None (0, 0, 0)
Setting LED 41 for KYKM to VFR (255, 0, 0)
Setting LED 42 for KELN to VFR (255, 0, 0)
Setting LED 43 for KEAT to VFR (255, 0, 0)
Setting LED 44 for KSMP to VFR (255, 0, 0)
Setting LED 45 for KEPH to VFR (255, 0, 0)
Setting LED 46 for KOMK to VFR (255, 0, 0)
Setting LED 47 for KS52 to VFR (255, 0, 0)
Traceback (most recent call last):
File "/home/pi/metar.py", line 109, in
pixels[i] = color
File "/usr/local/lib/python3.7/dist-packages/neopixel.py", line 176, in setitem
self._set_item(index, val)
File "/usr/local/lib/python3.7/dist-packages/neopixel.py", line 131, in _set_item
raise IndexError
IndexError

403 Forbidden when running

I am getting the following error today after starting up my raspberry pi

https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&hoursBeforeNow=5&mostRecentForEachStation=true&stationString=KSAC,KMHR,KMCC,KSMF,KDWA,KEDU,KVCB,KSUU,KLHM,KAUN,KBAB,KPVF,KMYV,KOVE,KCIC,KRBL,KRDD,KBLU,KGOO,KTRK,KRNO,KTVL,KJAQ,KO22,KSCK,KMOD,KTCY,KC83,KLVK,KHWD,KOAK,KSFO,KSQL,KPAO,KSJC,KRHV,KWVI,KCVH,KSNS,KMRY,KHAF,KAPC,KSTS,KO69,KCCR,KMCE,KMER,KFAT,KMAE,KHJO
Traceback (most recent call last):
File "metar.py", line 60, in
content = urllib.request.urlopen(url).read()
File "/usr/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.7/urllib/request.py", line 531, in open
response = meth(req, response)
File "/usr/lib/python3.7/urllib/request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.7/urllib/request.py", line 569, in error
return self._call_chain(*args)
File "/usr/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/lib/python3.7/urllib/request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

No changes since it was working fine just yesterday.

When i got to the URL from a separate browser, it returns the correct information.

Mini Display Additional Library - liblcms1-dev - Package has no installation candidate

04/26/23

Just finishing off building my 2nd Metar Map. This time, I'm using a Raspberry Pi Zero W (First one was with a Pi 3 Variant). During the installation of the additional libraries for the Mini Display, one of them presents the following error. Also happened on the 1st map install as well.


metar@metar-map:~ $ sudo apt-get install liblcms1-dev -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package liblcms1-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'liblcms1-dev' has no installation candidate


FWIW, it doesn't seem to effect anything yet by not having it installed. I'm not a guru by any means on these things, so I don't know what it's purpose is.

Digging a bit further, going to madison and looking up this library, I see that it is not factored for the armhf board that this Pi Zero is.
https://qa.debian.org/madison.php?package=liblcms1-dev&table=all&a=&c=&s=#

However, you will find that the 2nd version of this library is available (armhf - Bullseye). Again, I didn't install it, and its working fine so far as-is.
https://qa.debian.org/madison.php?package=liblcms2-dev&table=all&a=&c=&s=#

METAR Map shows all LEDs as blue occasionally

Occasionally I catch the metar map showing all blue LEDs, it appears to be hung.

If I manually initiate the refresh.sh it will fix the issue. It seems to happen more often if I lower the crontab file to refresh every 5 minutes vs 15-20 minutes.

I am using a Raspberry Pi Zero 2 W, has anyone experienced this?

Changes to the API dataserver effective today

Look like they finally did the changeover on aviationweather.gov and the dataserver has changed addresses. Which means the maps won't work. I was messing with it and trying to adapt the new dataserver to the code but we're medivac so of course I get a call right in the middle of it. If someone has already adapted the code please message me the new dataserver url string and save me a couple hours trying to figure it out lol

Dimming at night instead of off

Have you thought about changing code to dim the LEDs during the evening hours. Find local sunset and sunrise times
https://stackoverflow.com/questions/38986527/sunrise-and-sunset-time-in-python/38986561

I know just about nothing about programming. Only a tiny bit from crappy javascript skills, but I may give it a shot.

You could also keep the shutoff times too. My LEDs are stupid bright and need to be dimmed to .4 during day and .1 at night. Full brightness lights up the hangar.

Thanks for everything, this has been a fun learning experience.

Airport count - index error

I seem to run into this with 0 being a number or I miscount LEDs. Is there anyway to count the airports in the file first? i++ or something. I know I'm so green at this stuff. Just an idea.

Thanks for making the FAA change and winds fix so quickly.

aviation weather gov new API

Hello - aviationweather.gov had an overhaul, including its API. I have fixed my METAR map for the overhaul. Let me know if you want it and I can send you a pull request! :) Thanks!

Cheap Weekend Trip Opportunity

As a user who is a pilot, I would like the metar map to graphically let me know of a cheap weekend trip opportunity in which I would get a tailwinds in both directions. The software would take input of users home airport and several airports of interest. The software would check winds aloft forecast each Wednesday/Thursday for Friday and Sunday and, if forecast results in tailwinds on Friday AND tailwinds on Sunday, let user know of any available cheap weekend trip opportunity.

AttributeError and NameError in metar.py when updating for Sunrise/Sunset Delta time

I posted in comments. This is probably the better place.
Need some help with this one:

pi@METAR-MAP:~ $ sudo python3 metar.py
Running metar.py at 31/01/2022 15:00
LocationInfo(name='Seattle', region='USA', timezone='US/Pacific', latitude=47.6, longitude=-122.31666666666666)

Traceback (most recent call last):
File "metar.py", line 83, in
ast = astral.Astral()
AttributeError: module 'astral' has no attribute 'Astral'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "metar.py", line 105, in
BRIGHT_TIME_START = (sun['sunrise'] + timedelta(minutes=DIM_OFFSET_TIME)).time()
NameError: name 'timedelta' is not defined

-----astral was loaded already--------
Requirement already satisfied: astral in /usr/local/lib/python3.7/dist-packages (2.2)
Requirement already satisfied: pytz in /usr/local/lib/python3.7/dist-packages (from astral) (2020.4)

Any help would be appreciated. Thanks!

Change the intensity of specific LEDs

I have a 300 LED project, that is already setup, epoxied, and..done..

But one string in the middle is maybe 20% brighter than the rest..FML...

Can you introduce an update that will let you define chunks of led brightness as the base for daytime/nighttime settings

0-199 .8
200-249 .6
250-299 .8

TY

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.