[python #LMS-970136]: Metpy METAR Parsing
- Subject: [python #LMS-970136]: Metpy METAR Parsing
- Date: Sun, 22 Nov 2020 19:47:53 -0700
Apologies on the delayed response.
The problem with those data files from the NOAA FTP are that the lines are
11641TJSJ SJU20201001010516010/01/20 01:05:31 5-MIN TJSJ 010505Z 19006KT
10SM TS SCT030CB SCT044 BKN060 24/22 A2998 -40 87 1100 200/06 RMK AO2 OCNL
LTGIC SW NW TS SW NW MOV NW T02440222 $
The beginning "11641TJSJ SJU20201001010516010/01/20 01:05:31 5-MIN " are part
of standard METAR reports and are what's breaking MetPy's parser. If you want
to use these with MetPy, you can either perform the string manipulation on each
of the lines and pass only the METAR text to
or reformat the entire file using something like:
with open('64010TJSJ202010.dat', 'rt') as infile, open('metar.txt', 'wt')
for line in infile:
Hope this helps,
> I was trying to use a particular module within Metpy to parse
> METARs to aid in research and make METAR data more manageable by turning it
> into csv's. I am aware that Metpy can utilize parse_metar_file to parse
> THREDDS METAR data that you guys host, but I was running into compatibility
> issues when trying to apply it to 5-minute Metar files found on
> NCEI's website (ftp://ftp.ncdc.noaa.gov/pub/data/asos-fivemin/). I am using
> Spyder to write and debug the scripts that I work on, in case that is
> useful information.
> Is the parser found within Metpy able to handle different formats?
> Examining the different text files shows they are clearly different, but
> just wanted to make sure. Thanks for your time!
Ticket ID: LMS-970136
Department: Support Python
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata
inquiry tracking system and then made publicly available through the web. If
you do not want to have your interactions made available in this way, you must
let us know in each email you send to us.