Jump to content
The simFlight Network Forums

extract altitude values from metar string


mer

Recommended Posts

Hello,

How do we obtain Upper Altitude, Lower Altitude and Deviation values for clouds from the metar string? I need these to compare against the values FSUIPC reads

Sample cloud sub-strings 

2CU058&CU001FNMN000N

6CI394&CI001FNMN000N

FSUIPC displays Lower cloud upper Altitude as 2987 and Lower Alt as 1768 with zero deviation.

For  Middle cloud, the values are 12070 and 12009.

Thank you

Link to comment
Share on other sites

See the FSX METAR string definition (but note that it isn't complete: upper winds and air temperatures are encoded separately after the @@@. Also there are subtle differences when WRITING the METAR strings. It was a nightmare trying to sort it out back in the day -- something I hope never to have to delve into again!).

SKY CONDITIONS (has an extension)	
Note cloud heights are coded: If NNN is 999 the level is 100,000 feet, otherwise it is 100 x NNN in feet.

CCCNNN

Where NNN is the coded height, and CCC is one of::

CLR or SKC - sky clear
FEW - few clouds
SCT - scattered clouds
BKN - broken clouds
OVC - overcast
NTT - N/8ths cloud coverage of type TT, which is one of:
CI Cirrus
CS Cirro-stratus (maps to CI) 
CC Cirro-cumulus (maps to CI) 
AS Alto-stratus (maps to ST) 
AC Alto-cumulus (maps to CU) 
SC Strato-cumulus (maps to CU) 
NS Nimbo-stratus (maps to ST) 
ST Stratus
CU Cumulus
CB Cumulo-nimbus

Note that not all of these cloud types are supported within Flight Simulator, so a number are mapped to those which are. This does mean that a write followed by a read of Metar data might not give identical strings.

Flight Simulator extension:

&TT000FTPQBBBI
where:
TT - Cloud type, one of: the list above (for example, CI or CB). If this entry is different from the NNN entry above, this entry will take priority.

000 - Unused. 
F - Top of cloud, one of: F (flat), R (round), A (anvil) 
T - Turbulence, one of: N - None (default), O - Light, L - Light, M - Moderate, H - Heavy, S - Severe
P - Precipitation, one of: V (very light), L (light), M (moderate), H (heavy) D (dense) 
Q - Type of precipitation, one of: N (none), R (rain), F (freezing rain), H (hail), S (snow) 
BBB - Coded base height, the precipitation ends at this height, set to 0 for it to land on the ground 
I - icing rate, one of: N (none), T (trace), L (light), M (moderate), S (severe) 

You'll note that there's no place for cloud depth. FSUIPC has to use estimates based on cloud type. Even so, I'm not convinced your post shows related values:

2 hours ago, mer said:

Sample cloud sub-strings 

2CU058&CU001FNMN000N

6CI394&CI001FNMN000N

FSUIPC displays Lower cloud upper Altitude as 2987 and Lower Alt as 1768 with zero deviation.

For  Middle cloud, the values are 12070 and 12009.

To compare properly, please enable some logging:  In the FSUIPC INI file [General] section add these lines:

LogWeather=Yes
Debug=Please
LogExtras=x80

Run the sim, find the log file, and show here a suitable extract. The log shows both the METAR and the decode into offsets etc. Here's an example of what you should show:

   807289 Weather Read request (Nr Station) to area 5: Lat=51.47, Lon=-0.49, Alt=0.0, Req=1
   807305 Weather Received (type 5 request, Nearest): "EGLL&A24 000000Z 30110KT&D900NG 300V302 30125KT&A1001LG 295V307 80KM&B-448&D3048 6CI328&CI001FNMN000L 20/12 15/12&A1001 Q1010 @@@ 34 15 301 25 | "
   807305 WX Received in (16 mSecs), WX request type 5, Lat=51.4709, Lon=-0.4858, Alt=0.0m
   809333 Weather Read request (At Aircrft) to area 4: Lat=51.47, Lon=-0.49, Alt=28.2, Req=2
   809349 Weather Received (type 4 request, Interpolated): "????&A0 300729Z 30110KT&D900NG 300V302 80KM&B-424&D3048 1CU033&CU001FLLN000N 6CI328&CI001FNMN000L 19/12 Q1010 "
   809349 WX Received in (16 mSecs), WX request type 4, Lat=51.4709, Lon=-0.4858, Alt=28.2m
   811392 Weather Read request (Nr Station) to area 5: Lat=51.47, Lon=-0.49, Alt=0.0, Req=1
   811408 Weather Received (type 5 request, Nearest): "EGLL&A24 000000Z 30110KT&D900NG 300V302 30125KT&A1001LG 295V307 80KM&B-448&D3048 6CI328&CI001FNMN000L 20/12 15/12&A1001 Q1010 @@@ 34 15 301 25 | "
   811408 WX Received in (16 mSecs), WX request type 5, Lat=51.4709, Lon=-0.4858, Alt=0.0m
   811408 >Change:  Pressure=1010.0 mb
   811408 >Change:  Surface wind: to alt=3030ft, dir=301T, vel=10.0, gust=0.0, turb=0, shear=0, var=2.0
   811408 >Change:  Wind layer 1: to alt=6360ft, dir=301T, vel=25.0, gust=0.0, turb=1, shear=0, var=12.0
   811408 >Change:  Wind layer 2: remainder cleared
   811408 >Change:  Visibility[0]: range=49.7sm (80000m), from=-1390ft, to=8610ft
   811408 >Change:  Cloud[0]: type=9, from 3300ft to 7300ft (+/- 0ft), cover=1, turb=1, topshape=0
   811408 >Change:                      Precip=0, base=0ft, rate=0, icing=0
   811408 >Change:  Cloud[1]: type=1, from 32800ft to 33000ft (+/- 0ft), cover=6, turb=0, topshape=0
   811408 >Change:                      Precip=0, base=0ft, rate=0, icing=2
   811408 >Change:  Cloud[2]: remainder cleared
   811408 >Change:  Temperature[0]: alt=80ft, Day=19.0 C, NightVar=0.0 C, DewPt=12.0 C
   811408 >Change:  Temperature[1]: alt=3360ft, Day=15.0 C, NightVar=0.0 C, DewPt=12.0 C
   811408  Results: FS98 Wind0: ground (82ft) to 2950ft AGL, dir 302M, vel 10, gust 0, turb 0
   811408  Results: FS98 Wind1: 3030ft to 6360ft AMSL, dir=300T, vel 25, gust 0, turb 64
   811408  Results: FS98 Wind2: 0ft to 0ft AMSL, dir=0T, vel 0, gust 0, turb 0
   811408  Results: FS98 AmbientWind at PlaneAlt=92: dir 301M, vel 10
   811408  Results: FS98 Vis: range =50sm, (raw value=4971)
   811408  Results: FS98 Cloud1: type=9, from 3300ft to 7300ft (+/- 0ft), cover 1, turb 72, ice 0
   811408  Results: FS98 Cloud2: type=1, from 32800ft to 33000ft (+/- 0ft), cover 6, turb 0, ice 2
   811408  Results: FS98 Temp0: to 80ft, Day 19.0C, NightVar 0.0C
   811408  Results: FS98 Temp1: to 3360ft, Day 15.0C

You'll see the decode DOES match what is arriving.  Note that "the nearest" means the nearest weather station - EGLL here -- and "interpolated" is at the aircraft.  I was at EGLL so they are pretty much the same.

There's also a GLOB setting which is used as default for unset stations, read at about the same time. Here's the entry corresponding with the above:

   813451 Weather Read request (Global set) to area 1: ICAO="GLOB", Req=0
   813467 Weather Received (type 1 request, AtStation): "GLOB&A0 000000Z 30110KT&D900NG 300V302 30125KT&A1025LG 295V307 80KM&B-424&D3048 1CU033&CU001FLLN000N 8CI328&CI001FNMN000L 18/12 05/04&A1025 Q0999 @@@ 34 5 301 25 | "
   813467 WX Received in (16 mSecs), WX request type 1, ICAO=GLOB

Pete

 

Link to comment
Share on other sites

5 hours ago, Pete Dowson said:

See the FSX METAR string definition (but note that it isn't complete: upper winds and air temperatures are encoded separately after the @@@. Also there are subtle differences when WRITING the METAR strings. It was a nightmare trying to sort it out back in the day -- something I hope never to have to delve into again!).


SKY CONDITIONS (has an extension)	
Note cloud heights are coded: If NNN is 999 the level is 100,000 feet, otherwise it is 100 x NNN in feet.

CCCNNN

Where NNN is the coded height, and CCC is one of::

CLR or SKC - sky clear
FEW - few clouds
SCT - scattered clouds
BKN - broken clouds
OVC - overcast
NTT - N/8ths cloud coverage of type TT, which is one of:
CI Cirrus
CS Cirro-stratus (maps to CI) 
CC Cirro-cumulus (maps to CI) 
AS Alto-stratus (maps to ST) 
AC Alto-cumulus (maps to CU) 
SC Strato-cumulus (maps to CU) 
NS Nimbo-stratus (maps to ST) 
ST Stratus
CU Cumulus
CB Cumulo-nimbus

Note that not all of these cloud types are supported within Flight Simulator, so a number are mapped to those which are. This does mean that a write followed by a read of Metar data might not give identical strings.

Flight Simulator extension:

&TT000FTPQBBBI
where:
TT - Cloud type, one of: the list above (for example, CI or CB). If this entry is different from the NNN entry above, this entry will take priority.

000 - Unused. 
F - Top of cloud, one of: F (flat), R (round), A (anvil) 
T - Turbulence, one of: N - None (default), O - Light, L - Light, M - Moderate, H - Heavy, S - Severe
P - Precipitation, one of: V (very light), L (light), M (moderate), H (heavy) D (dense) 
Q - Type of precipitation, one of: N (none), R (rain), F (freezing rain), H (hail), S (snow) 
BBB - Coded base height, the precipitation ends at this height, set to 0 for it to land on the ground 
I - icing rate, one of: N (none), T (trace), L (light), M (moderate), S (severe) 

You'll note that there's no place for cloud depth. FSUIPC has to use estimates based on cloud type. Even so, I'm not convinced your post shows related values:

To compare properly, please enable some logging:  In the FSUIPC INI file [General] section add these lines:

LogWeather=Yes
Debug=Please
LogExtras=x80

Run the sim, find the log file, and show here a suitable extract. The log shows both the METAR and the decode into offsets etc. Here's an example of what you should show:


   807289 Weather Read request (Nr Station) to area 5: Lat=51.47, Lon=-0.49, Alt=0.0, Req=1
   807305 Weather Received (type 5 request, Nearest): "EGLL&A24 000000Z 30110KT&D900NG 300V302 30125KT&A1001LG 295V307 80KM&B-448&D3048 6CI328&CI001FNMN000L 20/12 15/12&A1001 Q1010 @@@ 34 15 301 25 | "
   807305 WX Received in (16 mSecs), WX request type 5, Lat=51.4709, Lon=-0.4858, Alt=0.0m
   809333 Weather Read request (At Aircrft) to area 4: Lat=51.47, Lon=-0.49, Alt=28.2, Req=2
   809349 Weather Received (type 4 request, Interpolated): "????&A0 300729Z 30110KT&D900NG 300V302 80KM&B-424&D3048 1CU033&CU001FLLN000N 6CI328&CI001FNMN000L 19/12 Q1010 "
   809349 WX Received in (16 mSecs), WX request type 4, Lat=51.4709, Lon=-0.4858, Alt=28.2m
   811392 Weather Read request (Nr Station) to area 5: Lat=51.47, Lon=-0.49, Alt=0.0, Req=1
   811408 Weather Received (type 5 request, Nearest): "EGLL&A24 000000Z 30110KT&D900NG 300V302 30125KT&A1001LG 295V307 80KM&B-448&D3048 6CI328&CI001FNMN000L 20/12 15/12&A1001 Q1010 @@@ 34 15 301 25 | "
   811408 WX Received in (16 mSecs), WX request type 5, Lat=51.4709, Lon=-0.4858, Alt=0.0m
   811408 >Change:  Pressure=1010.0 mb
   811408 >Change:  Surface wind: to alt=3030ft, dir=301T, vel=10.0, gust=0.0, turb=0, shear=0, var=2.0
   811408 >Change:  Wind layer 1: to alt=6360ft, dir=301T, vel=25.0, gust=0.0, turb=1, shear=0, var=12.0
   811408 >Change:  Wind layer 2: remainder cleared
   811408 >Change:  Visibility[0]: range=49.7sm (80000m), from=-1390ft, to=8610ft
   811408 >Change:  Cloud[0]: type=9, from 3300ft to 7300ft (+/- 0ft), cover=1, turb=1, topshape=0
   811408 >Change:                      Precip=0, base=0ft, rate=0, icing=0
   811408 >Change:  Cloud[1]: type=1, from 32800ft to 33000ft (+/- 0ft), cover=6, turb=0, topshape=0
   811408 >Change:                      Precip=0, base=0ft, rate=0, icing=2
   811408 >Change:  Cloud[2]: remainder cleared
   811408 >Change:  Temperature[0]: alt=80ft, Day=19.0 C, NightVar=0.0 C, DewPt=12.0 C
   811408 >Change:  Temperature[1]: alt=3360ft, Day=15.0 C, NightVar=0.0 C, DewPt=12.0 C
   811408  Results: FS98 Wind0: ground (82ft) to 2950ft AGL, dir 302M, vel 10, gust 0, turb 0
   811408  Results: FS98 Wind1: 3030ft to 6360ft AMSL, dir=300T, vel 25, gust 0, turb 64
   811408  Results: FS98 Wind2: 0ft to 0ft AMSL, dir=0T, vel 0, gust 0, turb 0
   811408  Results: FS98 AmbientWind at PlaneAlt=92: dir 301M, vel 10
   811408  Results: FS98 Vis: range =50sm, (raw value=4971)
   811408  Results: FS98 Cloud1: type=9, from 3300ft to 7300ft (+/- 0ft), cover 1, turb 72, ice 0
   811408  Results: FS98 Cloud2: type=1, from 32800ft to 33000ft (+/- 0ft), cover 6, turb 0, ice 2
   811408  Results: FS98 Temp0: to 80ft, Day 19.0C, NightVar 0.0C
   811408  Results: FS98 Temp1: to 3360ft, Day 15.0C

You'll see the decode DOES match what is arriving.  Note that "the nearest" means the nearest weather station - EGLL here -- and "interpolated" is at the aircraft.  I was at EGLL so they are pretty much the same.

There's also a GLOB setting which is used as default for unset stations, read at about the same time. Here's the entry corresponding with the above:


   813451 Weather Read request (Global set) to area 1: ICAO="GLOB", Req=0
   813467 Weather Received (type 1 request, AtStation): "GLOB&A0 000000Z 30110KT&D900NG 300V302 30125KT&A1025LG 295V307 80KM&B-424&D3048 1CU033&CU001FLLN000N 8CI328&CI001FNMN000L 18/12 05/04&A1025 Q0999 @@@ 34 5 301 25 | "
   813467 WX Received in (16 mSecs), WX request type 1, ICAO=GLOB

Pete

 

Thank you very much. I was able to understand that the base elevations (lower altitude?) are 3300ft and 32800ft. But I could not follow how the top elevations (upper altitude?) were calculated as 7300ft and 33000 ft. Could you please help?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.