Example on how to extract the date (MMDDYYYY) and time from a CloudSat 2B GEOPROF granule using python
import calendar
#----------------------------------------------------------------------------------------#
# Convert day of year to MM DD YYYY format
def JulianDate_to_MMDDYYY(y,jd):
month = 1
day = 0
while jd - calendar.monthrange(y,month)[1] > 0 and month <= 12:
jd = jd - calendar.monthrange(y,month)[1]
month = month + 1
return month,jd,y
#----------------------------------------------------------------------------------------#
cloudsat_granule_name = '2008008133740_09032_CS_2B-GEOPROF_GRANULE_P_R04_E02.hdf'
print('cloudsat_granule_name: ',cloudsat_granule_name)
year = int(cloudsat_granule_name[0:4])
day_of_year = int(cloudsat_granule_name[4:7])
hh = int(cloudsat_granule_name[7:9])
mm = int(cloudsat_granule_name[9:11])
ss = int(cloudsat_granule_name[11:13] )
print('year: ',year)
print('day_of_year: ',day_of_year)
print('hour: ',hh)
print('minute: ',mm)
print('second: ',ss)
month, day, year = JulianDate_to_MMDDYYY(year,day_of_year)
print('year: ',year)
print('month: ',month)
print('day: ',day)
returns
cloudsat_granule_name: 2008008133740_09032_CS_2B-GEOPROF_GRANULE_P_R04_E02.hdf
year: 2008
day_of_year: 8
hour: 13
minute: 37
second: 40
year: 2008
month: 1
day: 8
References
Link | WebSite |
---|---|
Data Products | cloudsat.cira.colostate.edu |