We are using ImageryLayers with AnimatedFlow vectors and a RasterStretchRenderer for color control in a GroupLayer (winds and wind speed) along with another ImageryLayers with AnimatedFlow vectors (waves) to be displayed at different times.
We use a button to toggle the two layers. The winds are the default layer.
When waves are activated, the winds layer group is removed and the waves layer is added (windWaveSwitch.JPG).
Toggling to waves works as expected/intended, but toggling to winds triggers an error (windWaveError.JPG). Toggling the waves back on displays the waves and toggling back to the wind causes the error again.
The initial map.add happens when the layers are established (windWaveCode.JPG). The windWave variable is string value of 'Wave' at that point in the code.