Wind direction files rotation using CONNECTIONTYPE uvraster

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Wind direction files rotation using CONNECTIONTYPE uvraster

Rousseau Lambert2, Louis-Philippe (EC)

Hi all,

What I'm trying to do:

  • I want to display wind arrows using 2 files: wind direction and wind speed. I am using the "CONNECTIONTYPE uvraster" feature to display our arrows. Because we don't have U and V wind vectors in the North-South direction for some models, we use the WIND and WDIR files which are respectively wind speed and wind direction (in the North-South direction, or Earth relative). So as input for my layer in MapServer I have a VRT where band 1 is the wind direction (from 0 to 360 degres) and band 2 is the wind speed. Instead of letting MapServer calculates the resulting arrows speed and direction I'm using the raw value of u ([u]) as wind direction and the raw value of v ([v]) as my wind speed. So far so good.

My problem is:

  • The arrow rotation is done using the ANGLE keyword and [u] (wind direction). But the ANGLE rotates the arrows in the counter clockwise direction while the wind direction files increase in a clockwise direction... Because we are using wind direction and wind speed files (raw values of [u] and [v]) we can't use the [uv_minus_angle] and I know that MapServer docs says that no processing can be done on the ANGLE feature. I know that I would have to do some pre-processing (like 360-[u]) and that would solve the problem. But I would have to do this for hundreds of file per day and I'm trying to avoid as much as possible pre-processing.

Can you guys think of a solution that would not require pre-processing? I tried playing with the arrow position and other little things but I could not make it work correctly and I'm pretty much out of ideas...

Thanks

LP


_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Wind direction files rotation using CONNECTIONTYPE uvraster

Eichner, Andreas - SID-NLKM
Hi,

since you're using GDAL VRT have you tried the "Scale" and "Offset" child elements for a VRTRasterBand?
I'd guess, using

<VRTRasterBand band="1">
  <Scale>-1.0</Scale>
  <Offset>360.0</Offset>
  ...
</VRTRasterBand>

might work for you.


Regards,
Andreas

> -----Original Message-----
> From: mapserver-users [mailto:[hidden email]]
> On Behalf Of Rousseau Lambert2, Louis-Philippe (EC)
> Sent: Monday, March 05, 2018 2:46 PM
> To: [hidden email]
> Subject: [mapserver-users] Wind direction files rotation using
> CONNECTIONTYPE uvraster
>
> Hi all,
>
> What I'm trying to do:
>
> * I want to display wind arrows using 2 files: wind direction and
> wind speed. I am using the "CONNECTIONTYPE uvraster" feature to display
> our arrows. Because we don't have U and V wind vectors in the North-
> South direction for some models, we use the WIND and WDIR files which
> are respectively wind speed and wind direction (in the North-South
> direction, or Earth relative). So as input for my layer in MapServer I
> have a VRT where band 1 is the wind direction (from 0 to 360 degres) and
> band 2 is the wind speed. Instead of letting MapServer calculates the
> resulting arrows speed and direction I'm using the raw value of u ([u])
> as wind direction and the raw value of v ([v]) as my wind speed. So far
> so good.
>
>
> My problem is:
>
> * The arrow rotation is done using the ANGLE keyword and [u] (wind
> direction). But the ANGLE rotates the arrows in the counter clockwise
> direction while the wind direction files increase in a clockwise
> direction... Because we are using wind direction and wind speed files
> (raw values of [u] and [v]) we can't use the [uv_minus_angle] and I know
> that MapServer docs says that no processing can be done on the ANGLE
> feature. I know that I would have to do some pre-processing (like 360-
> [u]) and that would solve the problem. But I would have to do this for
> hundreds of file per day and I'm trying to avoid as much as possible
> pre-processing.
>
> Can you guys think of a solution that would not require pre-processing?
> I tried playing with the arrow position and other little things but I
> could not make it work correctly and I'm pretty much out of ideas...
>
>
> Thanks
>
> LP
>

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users
Reply | Threaded
Open this post in threaded view
|

Re: Wind direction files rotation using CONNECTIONTYPE uvraster

Rousseau Lambert2, Louis-Philippe (EC)
Hi Andreas,

Thanks for the fix.

I tried with your solution <Scale> and <Offset> with a simple source but
it didn't change anything in the arrow direction...

But Using the complex Source with <ScaleOffset> and <ScaleRatio> worked
fine for me.

Thanks again!

LP

On 03/05/2018 02:15 PM, Eichner, Andreas - SID wrote:

> Hi,
>
> since you're using GDAL VRT have you tried the "Scale" and "Offset" child elements for a VRTRasterBand?
> I'd guess, using
>
> <VRTRasterBand band="1">
>   <Scale>-1.0</Scale>
>   <Offset>360.0</Offset>
>   ...
> </VRTRasterBand>
>
> might work for you.
>
>
> Regards,
> Andreas
>
>> -----Original Message-----
>> From: mapserver-users [mailto:[hidden email]]
>> On Behalf Of Rousseau Lambert2, Louis-Philippe (EC)
>> Sent: Monday, March 05, 2018 2:46 PM
>> To: [hidden email]
>> Subject: [mapserver-users] Wind direction files rotation using
>> CONNECTIONTYPE uvraster
>>
>> Hi all,
>>
>> What I'm trying to do:
>>
>> * I want to display wind arrows using 2 files: wind direction and
>> wind speed. I am using the "CONNECTIONTYPE uvraster" feature to display
>> our arrows. Because we don't have U and V wind vectors in the North-
>> South direction for some models, we use the WIND and WDIR files which
>> are respectively wind speed and wind direction (in the North-South
>> direction, or Earth relative). So as input for my layer in MapServer I
>> have a VRT where band 1 is the wind direction (from 0 to 360 degres) and
>> band 2 is the wind speed. Instead of letting MapServer calculates the
>> resulting arrows speed and direction I'm using the raw value of u ([u])
>> as wind direction and the raw value of v ([v]) as my wind speed. So far
>> so good.
>>
>>
>> My problem is:
>>
>> * The arrow rotation is done using the ANGLE keyword and [u] (wind
>> direction). But the ANGLE rotates the arrows in the counter clockwise
>> direction while the wind direction files increase in a clockwise
>> direction... Because we are using wind direction and wind speed files
>> (raw values of [u] and [v]) we can't use the [uv_minus_angle] and I know
>> that MapServer docs says that no processing can be done on the ANGLE
>> feature. I know that I would have to do some pre-processing (like 360-
>> [u]) and that would solve the problem. But I would have to do this for
>> hundreds of file per day and I'm trying to avoid as much as possible
>> pre-processing.
>>
>> Can you guys think of a solution that would not require pre-processing?
>> I tried playing with the arrow position and other little things but I
>> could not make it work correctly and I'm pretty much out of ideas...
>>
>>
>> Thanks
>>
>> LP
>>
>


--
Louis-Philippe Rousseau Lambert, B.Sc.
Géomaticien / Geomatician
Section des Données, Performances et Standards
Data, Performance and Standards Section
Service Météorologique du Canada
Meteorological Service of Canada
Environnement et Changement Climatique Canada
Environment and Climate Change Canada
[hidden email]
(514) 421-5045

_______________________________________________
mapserver-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapserver-users