How to use the pygrib.julian_to_datetime function in pygrib

To help you get started, we’ve selected a few pygrib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github geocryology / globsim / redcapp_XQ.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay))
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()
        self.nams = list(set(self.nams))
        self.step = list(set(self.step))
        self.date = list(set(self.date))
        self.jday = list(set(self.jday))
        self.levs = list(set(self.levs))
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons))
        self.date.sort()
        self.jday.sort()
        self.levs.sort()
github geocryology / globsim / ERA_Interim_Download.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay)) 
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()   
        self.nams = list(set(self.nams))  
        self.step = list(set(self.step)) 
        self.date = list(set(self.date)) 
        self.jday = list(set(self.jday)) 
        self.levs = list(set(self.levs)) 
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons)) 
        self.date.sort() 
        self.jday.sort() 
        self.levs.sort() 
        self.lats.sort()
github geocryology / globsim / redcapp_XQ.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay))
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()
        self.nams = list(set(self.nams))
        self.step = list(set(self.step))
        self.date = list(set(self.date))
        self.jday = list(set(self.jday))
        self.levs = list(set(self.levs))
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons))
        self.date.sort()
        self.jday.sort()
        self.levs.sort()
        self.lats.sort()
github geocryology / globsim / ERA_Interim_Download.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay)) 
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()   
        self.nams = list(set(self.nams))  
        self.step = list(set(self.step)) 
        self.date = list(set(self.date)) 
        self.jday = list(set(self.jday)) 
        self.levs = list(set(self.levs)) 
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons)) 
        self.date.sort() 
        self.jday.sort() 
        self.levs.sort()
github geocryology / globsim / ERA_Interim.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay)) 
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()   
        self.nams = list(set(self.nams))  
        self.step = list(set(self.step)) 
        self.date = list(set(self.date)) 
        self.jday = list(set(self.jday)) 
        self.levs = list(set(self.levs)) 
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons)) 
        self.date.sort() 
        self.jday.sort() 
        self.levs.sort()
github geocryology / globsim / ERA_Interim.py View on Github external
def __init__(self, file_grib):
        self.file_grib = file_grib
        #get list of contents
        self.jday = []
        self.date = []
        self.levs = []
        self.nams = []
        self.step = []
        grbs = pg.open(self.file_grib)
        grbs.seek(0)
        self.lats = grbs[1].latlons()[0][:,0]
        self.lons = grbs[1].latlons()[1][0,:]
        for grb in grbs:
           self.jday.append(pg.julian_to_datetime(grb.julianDay)) 
           self.date.append(pg.julian_to_datetime(grb.julianDay) +
                            timedelta(hours=grb.step))
           self.levs.append(grb.level)
           self.nams.append(grb.name)
           self.step.append(grb.step) #usually 0, 3/6/9/12 for accumulated
        grbs.close()   
        self.nams = list(set(self.nams))  
        self.step = list(set(self.step)) 
        self.date = list(set(self.date)) 
        self.jday = list(set(self.jday)) 
        self.levs = list(set(self.levs)) 
        self.lats = list(set(self.lats))
        self.lons = list(set(self.lons)) 
        self.date.sort() 
        self.jday.sort() 
        self.levs.sort() 
        self.lats.sort()

pygrib

Python module for reading/writing GRIB files

MIT
Latest version published 5 months ago

Package Health Score

71 / 100
Full package analysis

Similar packages