Skip Navigation Links 
NOAA logo - Click to go to the NOAA home page National Weather Service   NWS logo - Click to go to the NWS home page
Climate Prediction Center

About Us
   Our Mission
   Who We Are

Contact Us
   CPC Information
   CPC Web Team

HOME > Monitoring_and_Data > Oceanic and Atmospheric Data > Reanalysis: Atmospheric Data > pywgrib2: read_inv(inv_file)

pywgrib2: read_inv


The routine pywgrib2_s.read_inv(inv) reads an inventory file, inv. It returns a list of the entries of the inventory file. The inventory file can be a memory file or regular file.


>>> pywgrib2_s.mk_inv('a.grb','a.inv')
>>> a=pywgrib2_s.read_inv('a.inv')
>>> print(a[0])
1:0:D=20200101000000:CDCON:high cloud layer:0-6 hour ave fcst::CDCON:n=1:npts=18048:var0_1_0_7_6_2:pdt=8:d=2020010100:
start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:
>>> print(a[1])
2:2808:D=20200101000000:CDCON:middle cloud layer:0-6 hour ave fcst::CDCON:n=2:npts=18048:var0_1_0_7_6_2:pdt=8:d=202001
0100:start_FT=20200101000000:end_FT=20200101060000:scaling ref=0 dec_scale=0 bin_scale=0 nbits=6:vt=2020010106:


         if inv_file cannot be read, returns an empty list.  Otherwise 
         returns the inventory file as a list.  The length the list 
         (len(a)) is the number of lines in inv_file.

overview back next

NOAA/ National Weather Service
National Centers for Environmental Prediction
Climate Prediction Center
5830 University Research Court
College Park, Maryland 20740
Climate Prediction Center Web Team
Page last modified: July 10, 2014
Disclaimer Privacy Policy