nextstrain / forecasts-ncov

SARS-CoV-2 variant growth rates and frequency forecasts
https://nextstrain.org/sars-cov-2/forecasts/
7 stars 2 forks source link

Unify colour & display name setting for all models #67

Closed jameshadfield closed 11 months ago

jameshadfield commented 11 months ago

Over time setting the clade colours & display names separately to the lineage colour definitions resulted in the two falling out of sync. This work unifies the approach so that the same script (using a unified configuration) modifies each JSON respectively.

Including the colour and display name data within the clades JSON is a big improvement as it allows simple retrospective analysis of old datasets.

Tested locally with no observed changes to the resulting colours.

trvrb commented 11 months ago

Another observation (that I don't know where to thread really)... if I take the resulting file 2023-10-24_results.json and drag-n-drop to https://nextstrain.github.io/forecasts-viz/ the resulting display is the generic color ramp rather than the hex values encoded in the JSON.

jameshadfield commented 11 months ago

I've updated this PR to generate colour ranges from the provided clade colour (see commentary in the code of that function - I don't think the colours are better than using cmaps, but they are certainly much easier to maintain!) and also shifted the clade definitions into the config.

image

Another observation (that I don't know where to thread really)... if I take the resulting file 2023-10-24_results.json and drag-n-drop to https://nextstrain.github.io/forecasts-viz/ the resulting display is the generic color ramp rather than the hex values encoded in the JSON.

Oh! How annoying. ~The viz app must not be up-to-date. I'll update it.~ I've updated the viz app and it's now working.

jameshadfield commented 11 months ago

I'm going to merge this now - any colour fixes (etc) can be easily applied by subsequent PRs if needed.

trvrb commented 11 months ago

Thanks so much for the changes here James (and sorry that I forget to follow up). I really appreciate this. It should make things much more maintainable going forward.