Package: igra
IGRAAuthor: M. Blaschek
Date: Dezember 2019Version: 23.05This Python 3 Module is intended to read IGRA v2 NCDC data to pandas DataFrames or Xarray Datasets (interpolated to standard pressure levels).InstallThe code uses Python3 as a standard.Dependencies:numpypandasnetCDF4xarrayDownload the Source code from GitHubgitclonehttps://github.com/MBlaschek/igraor use the package onPyPI igrapipinstalligraUsageDownload station listRead the station list into pandas DataFrame (from fileigra2-station-list.txtin the IGRAv2 repository)>>>importigra>>>stations=igra.download.stationlist('/tmp')Downloadcomplete,readingtable...Datareadfrom:/tmp/igra2-station-list.txtDataprocessed2787>>>stationswmolatlonaltstatenamestartendtotalidACM0007886107886117.1170-61.783010.0COOLIDGEFIELD(UA)1947199313896AEM0004121704121724.433354.650016.0ABUDHABIINTERNATIONALAIRPOR1983201936252AEXUAE0546725.250055.37004.0SHARJAH193519422477AFM0004091104091136.700067.2000378.0MAZAR-I-SHARIF201020142179AFM0004091304091336.666768.9167433.0KUNDUZ201020134540AFM0004093804093834.217062.2170977.0HERAT197819881107AFM0004094804094834.550069.21671791.0KABULAIRPORT1961201917809AFM0004099004099031.500065.85001010.0KANDAHARAIRPORT197620145934AGM0006035506035536.88306.90003.0SKIKDA19741976639AGM0006036006036036.83307.81704.0ANNABA1973200830088AGM0006039006039036.68333.216725.0DAR-EL-BEIDA1948201968372AGM0006040206040236.71705.06706.0BEJAIA-AEROPORT1973198812372AGM0006041906041936.28306.6170694.0CONSTANTINE1973200821262AGM0006042506042536.21701.3330141.0CHLEF197319773213AGM0006043006043036.30002.2330715.0MILIANA1973199014988...Download stationa radiosonde station with theidfrom the station list intotmpdirectory>>>igra.download.station("AUM00011035","/tmp")https://www1.ncdc.noaa.gov/pub/data/igra/data/data-por/AUM00011035-data.txt.zipto/tmp/AUM00011035-data.txt.zipDownloaded:/tmp/ACM00078861-data.txt.zipRead stationThe downloaded station file can be read to standard pressure levels (default) or table like with all significant levels (different amount of levels per sounding) usingreturn_table=True. It is also possible to interpolate to different standard pressure levels withlevels=....Usually the standard pressure levels need to be reported, thus no interpolation should be required.>>>print(igra.std_plevels)[1000.0,2000.0,3000.0,5000.0,7000.0,10000.0,15000.0,20000.0,25000.0,30000.0,40000.0,50000.0,70000.0,85000.0,92500.0,100000.0]>>>data,station=igra.read.igra("AUM00011035","/tmp/ACM00078861-data.txt.zip")[AUM00011035][2019-12-09T12:25:42.761655]AUM00011035[1000.0,2000.0,3000.0,5000.0,7000.0,10000.0,15000.0,20000.0,25000.0,30000.0,40000.0,50000.0,70000.0,85000.0,92500.0,100000.0][AUM00011035][2019-12-09T12:25:42.761692]Readingasciidataintodataframes[AUM00011035][2019-12-09T12:25:57.710039]IGRAv2Linesread:3758652Headercount:79638[AUM00011035][2019-12-09T12:26:11.583290]Missingpressurevalues588657[AUM00011035][2019-12-09T12:26:11.583346]Interpolatingtostandardpressurelevels[AUM00011035][2019-12-09T12:28:18.356667](3090358,7)>>(3331343,8)[AUM00011035][2019-12-09T12:28:18.373608]Convertingtoxarray[AUM00011035][2019-12-09T12:28:18.377815]AddingMetadata[AUM00011035][2019-12-09T12:28:18.378166]Convertingtemperatureandhumidity[AUM00011035][2019-12-09T12:28:18.546226]CollectingStationinformation>>>data<xarray.Dataset>Dimensions:(date:78059,pres:16)Coordinates:*date(date)datetime64[ns]1949-02-08T04:00:00...2019-10-01*pres(pres)float641e+032e+033e+035e+03...8.5e+049.25e+041e+05Datavariables:gph(date,pres)float64nannannannan...1.491e+03791.0nantemp(date,pres)float64nannannannannan...274.4280.0285.2nanrhumi(date,pres)float64nannannannannan...nannannannannandpd(date,pres)float64nannannannannan...7.021.07.08.0nanwindd(date,pres)float64nannannannannan...295.0290.0300.0nanwinds(date,pres)float64nannannannannan...21.014.010.0nanflag_int(date,pres)float641.01.01.01.01.0...0.00.00.00.01.0Attributes:ident:AUM00011035source:NOAANCDCdataset:IGRAv2processed:UNIVIE,IMGinterpolated:topreslevs(#16)>>>station<xarray.Dataset>Dimensions:(date:78059)Coordinates:*date(date)datetime64[ns]1949-02-08T04:00:00...2019-10-01Datavariables:numlev(date)int641410121310151515...37413813613139105lat(date)float6448.2548.2548.2548.25...48.2548.2548.2548.25lon(date)float6416.3616.3616.3616.36...16.3616.3616.3616.36Attributes:ident:AUM00011035source:NOAANCDCdataset:IGRAv2processed:UNIVIE,IMGDownload a UADB Stationa radiosonde station with thewmofrom station list intotmpdirectoryHowever, you need to register for this data at RDA UCAR. You will need to enter your Email address and password to download the files.>>>igra.download.uadb("78861","/tmp","EMail-Adress","Password")https://rda.ucar.edu/cgi-bin/loginto/tmp/uadb_trhc_78861.txt100.000%CompletedDownloaded:/tmp/uadb_trhc_78861.txtRead a UADB StationThe downloaded station file can be read to standard pressure levels (default) or table like with all significant levels (different amount of levels per sounding) usingreturn_table=True. It is also possible to interpolate to different standard pressure levels withlevels=....Usually the standard pressure levels need to be reported, thus no interpolation should be required.>>>data,station=igra.read.uadb("078861","/tmp/uadb_trhc_78861.txt")[078861][2019-12-09T13:22:15.726180]078861[1000.0,2000.0,3000.0,5000.0,7000.0,10000.0,15000.0,20000.0,25000.0,30000.0,40000.0,50000.0,70000.0,85000.0,92500.0,100000.0][078861][2019-12-09T13:22:15.726269]Readingasciidataintodataframes[078861][2019-12-09T13:22:17.448871]UADBLinesread:579008skipped:0Header:8747[078861][2019-12-09T13:22:18.708963]Missingpressurevalues167254[078861][2019-12-09T13:22:18.709015]Interpolatingtostandardpressurelevels[078861][2019-12-09T13:22:33.040262](403008,6)>>(414833,7)[078861][2019-12-09T13:22:33.040344]Convertingtoxarray[078861][2019-12-09T13:22:33.043989]AddingMetadata[078861][2019-12-09T13:22:33.044279]Convertingtemperatureandhumidity[078861][2019-12-09T13:22:33.063961]CollectingStationinformation>>>data<xarray.Dataset>Dimensions:(date:8729,pres:16)Coordinates:*date(date)datetime64[ns]1961-04-011961-04-09...1993-04-28T12:12:00*pres(pres)float641e+032e+033e+035e+03...8.5e+049.25e+041e+05Datavariables:gph(date,pres)float64nannannannan...1.527e+03797.0124.0temp(date,pres)float64nannannannan...281.5288.5291.6297.9rhumi(date,pres)float64nannannannan...0.3130.6740.93930.799windd(date,pres)float64nannannannan...220.0140.0134.8130.0winds(date,pres)float64nannannannannan...11.33.16.27.7619.2flag_int(date,pres)float641.01.01.01.01.0...0.00.00.0nan0.0Attributes:ident:078861source:NCARRSAdataset:UADB,ds370.1processed:UNIVIE,IMGinterpolated:topreslevs(#16)>>>station<xarray.Dataset>Dimensions:(date:8743)Coordinates:*date(date)datetime64[ns]1961-04-011961-04-09...1993-04-28T12:00:00Datavariables:uid(date)int64804150280415038041504...582070915820934458211593numlev(date)int641742204354205647...9499981158910898104lat(date)float6417.1217.1217.1217.12...17.1217.1217.1217.12lon(date)float64298.2298.2298.2298.2...298.2298.2298.2298.2alt(date)float643.03.03.03.03.03.0...5.05.05.05.05.05.0stype(date)int643333333333333...333333333333Attributes:ident:078861source:NCARRSAdataset:UADB,ds370.1processed:UNIVIE,IMG)Interpolate to custom pressure levelsFor example you could use the 32 lowest ERA-Interim pressure levels.>>>print(igra.era_plevels)[1000.0,2000.0,3000.0,5000.0,7000.0,10000.0,12500.0,15000.0,17500.0,20000.0,22500.0,25000.0,30000.0,35000.0,40000.0,45000.0,50000.0,55000.0,60000.0,65000.0,70000.0,75000.0,77500.0,80000.0,82500.0,85000.0,87500.0,90000.0,92500.0,95000.0,97500.0,100000.0]>>>data,station=igra.read.uadb("078861","/tmp/uadb_trhc_78861.txt",levels=igra.era_plevels)Read as DataFrameThe data is available as ASCII, therefore the closest representation is a pandas DataFrame. This is how the data is read and in the above steps converted to an xarray representation.>>>data,station=igra.read.ascii_to_dataframe("/tmp/ACM00078861-data.txt.zip")IGRAv2Linesread:508055Headercount:13896>>>stationnumlevlatlondate1947-01-0801:00:001017.117-61.7831947-01-1001:00:001017.117-61.7831947-01-1102:00:00517.117-61.7831947-01-1202:00:00917.117-61.7831947-01-1303:00:00417.117-61.783............1993-04-2012:00:009317.117-61.7831993-04-2112:00:0010517.117-61.7831993-04-2212:00:008217.117-61.7831993-04-2612:00:0010017.117-61.7831993-04-2712:00:008717.117-61.7831993-04-2812:00:009917.117-61.783[13896rowsx3columns]>>>datapresgphtemprhumidpdwinddwindsdate1947-01-0801:00:00101600.010.025.482.0NaN70.08.01947-01-0801:00:00100000.0156.024.383.0NaN70.09.01947-01-0801:00:0085000.01559.014.593.0NaN80.010.01947-01-0801:00:0070000.03187.08.813.0NaN110.06.01947-01-0801:00:0050000.05894.0-8.138.0NaN90.07.01947-01-0801:00:0040000.07587.0-20.018.0NaNNaNNaN1947-01-0801:00:0030000.09666.0-33.2NaNNaN80.020.01947-01-0801:00:0025000.010926.0-41.7NaNNaNNaNNaN1947-01-0801:00:0020000.012416.0-49.2NaNNaN10.07.01947-01-0801:00:0015000.014263.0-61.3NaNNaNNaNNaN........................1993-04-2812:00:00960.031525.0-38.3NaNNaNNaNNaN1993-04-2812:00:00900.031976.0-34.9NaNNaNNaNNaN1993-04-2812:00:00880.032100.0NaNNaNNaN95.018.51993-04-2812:00:00810.032700.0NaNNaNNaN95.09.21993-04-2812:00:00700.033730.0-31.5NaN49.0NaNNaN1993-04-2812:00:00680.0NaN-31.9NaNNaNNaNNaN[494160rowsx7columns]LicenseMIT LicenseCopyright (c) 2019 Michael Blaschek