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

update speed calculation based on STL comparison #482

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

Conversation

thehanggit
Copy link
Contributor

Update the speed calculation based on speed comparison documentation. The current g-factor is detector based with 12 steps smoothing

@thehanggit thehanggit self-assigned this Nov 21, 2024
@jkarpen jkarpen linked an issue Nov 21, 2024 that may be closed by this pull request
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you! This is great. I will revise it.

Copy link
Contributor

Choose a reason for hiding this comment

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

If there are lane 7 and 8, I believe that your model will not be applicable, include the condition for lane 7 and 8 also, so that those lanes speed also can be imputed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great question! Do you have any idea which route has lane 7 and 8? I will double check and include them.

Copy link
Contributor

@mmmiah mmmiah Nov 22, 2024

Choose a reason for hiding this comment

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

Please consider add ymal or update ymal if already exists for this particular model

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! I will update the yaml file accordingly

@mmmiah
Copy link
Contributor

mmmiah commented Nov 22, 2024

@thehanggit , how did you handle extremly high speed greater than 120 mph?? I can see thousands of speed are extremely high ranges from 120 to 236,00
image

see the this snowflake work sheet: https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3#query

@thehanggit
Copy link
Contributor Author

@thehanggit , how did you handle extremly high speed greater than 120 mph?? I can see thousands of speed are extremely high ranges from 120 to 236,00 image

see the this snowflake work sheet: https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3#query

Hi, @mmmiah. These extreme values come from occupancy that has extreme value as denominators. For example, 0.001 could easily cause anomalies, which I believe happens a lot in the existing and modernized PeMS system. The g-factor speed model can not handle it intrinsically because it only has the function of smoothing instead of capping.

It is very simple to drop them, you just need to set up the lower and upper bounds, like what I did in the final query. The "imputed speed" considers this bound based on existing PeMS speed data. Taking lane 1 speed for SR91 on 10/04/2024, you can see the speed is bounded by [3, 86.5]
image
image

@mmmiah
Copy link
Contributor

mmmiah commented Nov 27, 2024

@thehanggit , still I can see 589 imputed speed is more than 100 mph. Could you please check again.
image
https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3/chart#query

I will say if any speed exceed more than 100 mph, just replace that with free flow speed. When vehicle occupancy is super small, vehicle will move at free flow speed or more, therefore we can easily fill that with free flow speed. Let me know when your PR is ready for final review! Thank you!

@thehanggit
Copy link
Contributor Author

@thehanggit , still I can see 589 imputed speed is more than 100 mph. Could you please check again. image https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3/chart#query

I will say if any speed exceed more than 100 mph, just replace that with free flow speed. When vehicle occupancy is super small, vehicle will move at free flow speed or more, therefore we can easily fill that with free flow speed. Let me know when your PR is ready for final review! Thank you!

Again, @mmmiah. The logic is already there. I'm not sure what's happening there but will double check once dbt is running normally.
image

@thehanggit
Copy link
Contributor Author

@thehanggit , still I can see 589 imputed speed is more than 100 mph. Could you please check again. image https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3/chart#query
I will say if any speed exceed more than 100 mph, just replace that with free flow speed. When vehicle occupancy is super small, vehicle will move at free flow speed or more, therefore we can easily fill that with free flow speed. Let me know when your PR is ready for final review! Thank you!

Again, @mmmiah. The logic is already there. I'm not sure what's happening there but will double check once dbt is running normally. image

Maybe it's due to lane 7 and lane 8 as segments have them. Will incorporate this part into the current logic and see what happens.

@mmmiah
Copy link
Contributor

mmmiah commented Nov 27, 2024

@thehanggit , still I can see 589 imputed speed is more than 100 mph. Could you please check again. image https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3/chart#query
I will say if any speed exceed more than 100 mph, just replace that with free flow speed. When vehicle occupancy is super small, vehicle will move at free flow speed or more, therefore we can easily fill that with free flow speed. Let me know when your PR is ready for final review! Thank you!

Again, @mmmiah. The logic is already there. I'm not sure what's happening there but will double check once dbt is running normally. image

Maybe it's due to lane 7 and lane 8 as segments have them. Will incorporate this part into the current logic and see what happens.

yes, include lane 7 and 8 that will solve the issue as you can see this coming from lane greater than 6
image

@thehanggit
Copy link
Contributor Author

@thehanggit , still I can see 589 imputed speed is more than 100 mph. Could you please check again. image https://app.snowflake.com/vsb79059/dse_caltrans_pems/w14xEbjZWdd3/chart#query
I will say if any speed exceed more than 100 mph, just replace that with free flow speed. When vehicle occupancy is super small, vehicle will move at free flow speed or more, therefore we can easily fill that with free flow speed. Let me know when your PR is ready for final review! Thank you!

Again, @mmmiah. The logic is already there. I'm not sure what's happening there but will double check once dbt is running normally. image

Maybe it's due to lane 7 and lane 8 as segments have them. Will incorporate this part into the current logic and see what happens.

yes, include lane 7 and 8 that will solve the issue as you can see this coming from lane greater than 6 image

Thanks a lot for investigation! I will fix the code once dbt is working and invite you for the review!

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.

G-factor Speed Calculation Model QC
2 participants