Board index FlightGear Development Weather

Weather from own (weather) server

Everything related to weather simulation, visuals should be discussed in the shader subforum.

Weather from own (weather) server

Postby chek » Mon Dec 21, 2015 3:28 pm

Hello guys, again me.
Now I need a hint about METAR data (yep, I'm only need weather near ground for certain airport).
Let's say, I have a weather modelling server. It can give me weather in METAR (that's what I need).
What's the rigth way to give this data to FG, so I can see it?

I've read wiki, forum, looked in Property Tree, and I can't understand, how to reach this goal.
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby Thorsten » Mon Dec 21, 2015 4:57 pm

If you look into the way the weather GUI is organized, you'll see that you can enter a string by hand. That field feeds into a property node - whatever you write into that property node and however you do it is going to be treated as the current METAR - i.e. the system will try to parse it and make the result available for the weather systems to be picked up.

So what you want to do is have your server hand over the string, then you want to write it and trigger the parse command. I guess you can do all of this from Nasal, but there's for sure other ways as well.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Weather from own (weather) server

Postby chek » Mon Dec 21, 2015 5:19 pm

Thanx, I thought about it, but I don't understand how this property applied. Where I can read about it?
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby Hooray » Mon Dec 21, 2015 5:20 pm

You don't need to know how this works internally, you only need to set/modify the property, e.g. using the property tree browser, Nasal scripts, or an arbitrary I/O protocol (think httpd or telnet/props).

For starters, you could check the "telnet" article on the wiki.
It would take roughly 20 lines of Python code to update the property accordingly
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Weather from own (weather) server

Postby chek » Mon Dec 21, 2015 5:53 pm

Good news.
So, you tell, that there's a trigger somewhere in the Tree, which I missed, which says to FG, that there's new data in METAR property, right?
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby Torsten » Mon Dec 21, 2015 6:13 pm

You can set a user-defined metar with the command line argument "--metar=your metar string here" on startup (mind the double quotes to pass you blanks to the arg).
At runtime, setting /environment/metar/data to a new valid metar string should change your weather accordingly, including all interpolations
This used to work for basic weather a while ago and should also do with advanced weather in METAR mode.

We have several protocols to access the properties: telnet, http, websocket. I'd probably use HTTP GET for a single property.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 648
Joined: Fri Feb 01, 2008 10:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Weather from own (weather) server

Postby chek » Mon Dec 21, 2015 6:45 pm

Hm, I tried this, but value in /environment/metar/data changed to value, previously set through command line --metar, after time-to-live turned to zero.
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby Torsten » Mon Dec 21, 2015 8:03 pm

Probably the realwx controller is messing with your data. I don't have the time to look deeper into this.
If you like you can dig a bit into the relevant source code. Most of it should be in flightgear/src/Environment, metar_properties.cxx and realwx_ctrl.cxx doing most of the work.
There is also an old script here: http://sourceforge.net/p/flightgear/fli ... etarproxy/ that might be worth investigating.

Torsten
flightgear.org - where development happens.
User avatar
Torsten
 
Posts: 648
Joined: Fri Feb 01, 2008 10:22 pm
Location: near Hamburg, Germany
Callsign: offline
Version: next
OS: Linux

Re: Weather from own (weather) server

Postby chek » Mon Dec 21, 2015 8:07 pm

Thanx, that's what I'm going to do.
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby chek » Wed Dec 23, 2015 9:18 am

Finally, my problem was with metar string - it was wrong.
Strange thing is that I took that string from noaa, but, anyway, everything is working as it should.
Jfyi, if you start FG like
Code: Select all
fgfs --metar=UIII 221300Z 08002...
it turns on "Fetch real weather" and ignore metar parameter.
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby Hooray » Wed Dec 23, 2015 9:23 am

obviously, you would need to enclose the whole thing in quotation marks, otherwise fgfs would treat the whole thing as a whitespace separated list of separate (invalid) arguments

see --help --verbose
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Weather from own (weather) server

Postby chek » Wed Dec 23, 2015 9:25 am

Yep, I'm not about quotation, but about --disable-real-weather-fetch flag
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS

Re: Weather from own (weather) server

Postby chek » Wed Dec 23, 2015 9:30 am

O, I understand you now.

All right, I can explain more:

I've downloaded http://weather.noaa.gov/pub/data/observ ... es/07Z.TXT, forund UIII and took the string, put in quotation marks, but FG started with standard weather.
Then I turn on "Fetch real weather", wait for several hours and took weather from log. The string was a bit different, and it worked
User avatar
chek
 
Posts: 38
Joined: Mon Sep 15, 2014 10:44 am
Location: ru, msk
Version: 2016.1.1
OS: Kubuntu 14.04 LTS


Return to Weather

Who is online

Users browsing this forum: No registered users and 1 guest