;BOP ; ; !ROUTINE: noaa_gmd_adj_time ; ; !DESCRIPTION: Routine to adjust the times in NOAA GMD CH4 files so that ; dates are on the 1st of the month instead of the 15th/16th. ;\\ ;\\ ; !USES: ; ; NCL routines load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" ; Local routines load "$NCL4GC/file_io/add_coards_var_atts.ncl" load "$NCL4GC/file_io/add_coards_global_atts.ncl" ; ; !REMARKS: ; (1) Adds a time dimension to emission variable ; (2) Reorder longitude to be centered around 0 degrees using lonFlip function ; ; !EXAMPLE: ; ncl NOAA_GMD_adj_time.ncl ; ; !REVISION HISTORY: ; 01 Nov 2017 - M. Sulprizio- Initial version ;EOP ;------------------------------------------------------------------------------ ;BOC begin ;========================================================================= ; Read data from the input file ;========================================================================= inFile = "monthly.gridded.surface.methane.1979-2020.1x1.nc" fIO = addfile( inFile, "w" ) time = fIO->time ; Convert from Julian date to UT-referenced date utc_date = cd_calendar(time,0) year = tointeger(utc_date(:,0)) month = tointeger(utc_date(:,1)) day = tointeger(utc_date(:,2)) hour = tointeger(utc_date(:,3)) minute = tointeger(utc_date(:,4)) second = utc_date(:,5) ; Set day to first of month day = 1 ; Set calendar to 365_day option=0 option@calendar="standard" ; Convert back to Julian date fixedTime = cd_inv_calendar( year,month,day,hour,minute,second,time@units,option) fixedTime!0 = "time" fixedTime@standard_name = time@long_name fixedTime@long_name = time@long_name fixedTime@units = time@units fixedTime@calendar = "standard" fixedTime&time = fixedTime ; Overwrite time with new value fIO->time = (/fixedTime/) end ;EOC