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

initial H1 PWI decoding #138

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

makrsmark
Copy link
Collaborator

No description provided.

@makrsmark
Copy link
Collaborator Author

I made this a draft to have a discussion regarding how we want to represent this data. There are 4 WD fields representing 4 altitudes and 6 waypoints - 24 total data points. I currently have 24 formatted results. We could also shove them into 4 results, so all 6 positions at each altitude. We could also shove it all in to one result.

current decoreResult looks like

{
      "decoded": true,
      "decoder": {
        "name": "label-h1-pwi",
        "type": "pattern-match",
        "decodeLevel": "partial"
      },
      "formatted": {
        "description": "Weather Report",
        "items": [
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL390: 258° at 70kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL390: 252° at 71kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL390: 250° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL390: 244° at 69kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL390: 234° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL390: 230° at 60kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL340: 256° at 73kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL340: 252° at 70kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL340: 244° at 59kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL340: 240° at 59kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL340: 232° at 56kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL340: 218° at 53kt, -40°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL300: 256° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL300: 254° at 62kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL300: 250° at 51kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL300: 248° at 50kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL300: 232° at 44kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL300: 222° at 47kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL240: 260° at 45kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL240: 258° at 48kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL240: 254° at 43kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL240: 256° at 41kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL240: 238° at 35kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL240: 226° at 34kt"
          },
          {
            "type": "message_checksum",
            "code": "CHECKSUM",
            "label": "Message Checksum",
            "value": "0x0338"
          }
        ]
      },
      "raw": {
        "wind_data": [
          {
            "waypoint": "COLZI",
            "flightLevel": 390,
            "windDirection": 258,
            "windSpeed": 70
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 390,
            "windDirection": 252,
            "windSpeed": 71
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 390,
            "windDirection": 250,
            "windSpeed": 65
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 390,
            "windDirection": 244,
            "windSpeed": 69
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 390,
            "windDirection": 234,
            "windSpeed": 65
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 390,
            "windDirection": 230,
            "windSpeed": 60
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 340,
            "windDirection": 256,
            "windSpeed": 73,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 340,
            "windDirection": 252,
            "windSpeed": 70,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 340,
            "windDirection": 244,
            "windSpeed": 59,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 340,
            "windDirection": 240,
            "windSpeed": 59,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 340,
            "windDirection": 232,
            "windSpeed": 56,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 340,
            "windDirection": 218,
            "windSpeed": 53,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -40
            }
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 300,
            "windDirection": 256,
            "windSpeed": 65
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 300,
            "windDirection": 254,
            "windSpeed": 62
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 300,
            "windDirection": 250,
            "windSpeed": 51
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 300,
            "windDirection": 248,
            "windSpeed": 50
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 300,
            "windDirection": 232,
            "windSpeed": 44
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 300,
            "windDirection": 222,
            "windSpeed": 47
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 240,
            "windDirection": 260,
            "windSpeed": 45
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 240,
            "windDirection": 258,
            "windSpeed": 48
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 240,
            "windDirection": 254,
            "windSpeed": 43
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 240,
            "windDirection": 256,
            "windSpeed": 41
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 240,
            "windDirection": 238,
            "windSpeed": 35
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 240,
            "windDirection": 226,
            "windSpeed": 34
          }
        ],
        "checksum": 824
      },
      "remaining": {
        "text": "/DD300214059.240214040.180236024.100250018:,,,,/CB300246040.240246017.180226015.100210008"
      },
      "message": {
        "text": "PWI/WD390,COLZI,258070.AWYAT,252071.IPTAY,250065.CHOPZ,244069.MGMRY,234065.CATLN,230060/WD340,COLZI,256073,340M41.AWYAT,252070,340M41.IPTAY,244059,340M41.CHOPZ,240059,340M41.MGMRY,232056,340M41.CATLN,218053,340M40/WD300,COLZI,256065.AWYAT,254062.IPTAY,250051.CHOPZ,248050.MGMRY,232044.CATLN,222047/WD240,COLZI,260045.AWYAT,258048.IPTAY,254043.CHOPZ,256041.MGMRY,238035.CATLN,226034/DD300214059.240214040.180236024.100250018:,,,,/CB300246040.240246017.180226015.1002100080338"
      }
    }
    ```


if (data.length === 3) {
const tempData = data[2];
const tempFlightLevel = Number(tempData.slice(0, 3));
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that this usually matches flightLevel, sometimes it does not

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When it isn't matching flight level, what is it? Or is that still a mystery?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought i found a message that had the temp at a lower flight level, but now i can't find it

@kevinelliott
Copy link
Contributor

I made this a draft to have a discussion regarding how we want to represent this data. There are 4 WD fields representing 4 altitudes and 6 waypoints - 24 total data points. I currently have 24 formatted results. We could also shove them into 4 results, so all 6 positions at each altitude. We could also shove it all in to one result.

current decoreResult looks like

{
      "decoded": true,
      "decoder": {
        "name": "label-h1-pwi",
        "type": "pattern-match",
        "decodeLevel": "partial"
      },
      "formatted": {
        "description": "Weather Report",
        "items": [
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL390: 258° at 70kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL390: 252° at 71kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL390: 250° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL390: 244° at 69kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL390: 234° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL390: 230° at 60kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL340: 256° at 73kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL340: 252° at 70kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL340: 244° at 59kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL340: 240° at 59kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL340: 232° at 56kt, -41°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL340: 218° at 53kt, -40°C at FL340"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL300: 256° at 65kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL300: 254° at 62kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL300: 250° at 51kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL300: 248° at 50kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL300: 232° at 44kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL300: 222° at 47kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "COLZI at FL240: 260° at 45kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "AWYAT at FL240: 258° at 48kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "IPTAY at FL240: 254° at 43kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CHOPZ at FL240: 256° at 41kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "MGMRY at FL240: 238° at 35kt"
          },
          {
            "type": "wind_data",
            "code": "WIND",
            "label": "Wind Data",
            "value": "CATLN at FL240: 226° at 34kt"
          },
          {
            "type": "message_checksum",
            "code": "CHECKSUM",
            "label": "Message Checksum",
            "value": "0x0338"
          }
        ]
      },
      "raw": {
        "wind_data": [
          {
            "waypoint": "COLZI",
            "flightLevel": 390,
            "windDirection": 258,
            "windSpeed": 70
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 390,
            "windDirection": 252,
            "windSpeed": 71
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 390,
            "windDirection": 250,
            "windSpeed": 65
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 390,
            "windDirection": 244,
            "windSpeed": 69
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 390,
            "windDirection": 234,
            "windSpeed": 65
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 390,
            "windDirection": 230,
            "windSpeed": 60
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 340,
            "windDirection": 256,
            "windSpeed": 73,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 340,
            "windDirection": 252,
            "windSpeed": 70,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 340,
            "windDirection": 244,
            "windSpeed": 59,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 340,
            "windDirection": 240,
            "windSpeed": 59,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 340,
            "windDirection": 232,
            "windSpeed": 56,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -41
            }
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 340,
            "windDirection": 218,
            "windSpeed": 53,
            "temperature": {
              "flightLevel": 340,
              "degreesC": -40
            }
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 300,
            "windDirection": 256,
            "windSpeed": 65
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 300,
            "windDirection": 254,
            "windSpeed": 62
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 300,
            "windDirection": 250,
            "windSpeed": 51
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 300,
            "windDirection": 248,
            "windSpeed": 50
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 300,
            "windDirection": 232,
            "windSpeed": 44
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 300,
            "windDirection": 222,
            "windSpeed": 47
          },
          {
            "waypoint": "COLZI",
            "flightLevel": 240,
            "windDirection": 260,
            "windSpeed": 45
          },
          {
            "waypoint": "AWYAT",
            "flightLevel": 240,
            "windDirection": 258,
            "windSpeed": 48
          },
          {
            "waypoint": "IPTAY",
            "flightLevel": 240,
            "windDirection": 254,
            "windSpeed": 43
          },
          {
            "waypoint": "CHOPZ",
            "flightLevel": 240,
            "windDirection": 256,
            "windSpeed": 41
          },
          {
            "waypoint": "MGMRY",
            "flightLevel": 240,
            "windDirection": 238,
            "windSpeed": 35
          },
          {
            "waypoint": "CATLN",
            "flightLevel": 240,
            "windDirection": 226,
            "windSpeed": 34
          }
        ],
        "checksum": 824
      },
      "remaining": {
        "text": "/DD300214059.240214040.180236024.100250018:,,,,/CB300246040.240246017.180226015.100210008"
      },
      "message": {
        "text": "PWI/WD390,COLZI,258070.AWYAT,252071.IPTAY,250065.CHOPZ,244069.MGMRY,234065.CATLN,230060/WD340,COLZI,256073,340M41.AWYAT,252070,340M41.IPTAY,244059,340M41.CHOPZ,240059,340M41.MGMRY,232056,340M41.CATLN,218053,340M40/WD300,COLZI,256065.AWYAT,254062.IPTAY,250051.CHOPZ,248050.MGMRY,232044.CATLN,222047/WD240,COLZI,260045.AWYAT,258048.IPTAY,254043.CHOPZ,256041.MGMRY,238035.CATLN,226034/DD300214059.240214040.180236024.100250018:,,,,/CB300246040.240246017.180226015.1002100080338"
      }
    }
    ```

I agree with your assessment to normalize the data a bit, making the raw data much more specific and concrete as individual nested values, rather than a single string representation. The format looks good to me, I think you've done a good pass there.

@makrsmark makrsmark marked this pull request as ready for review October 3, 2024 00:44
@makrsmark
Copy link
Collaborator Author

@fredclausen - adding you as a reviewer as Kevin and I can't decide how we want the formatted result to be for the wind reports. Each one separate? or shove them all (or some?) together?

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

Successfully merging this pull request may close these issues.

2 participants