# Shift time in NetCDF files

I have a folder which contains (monthly) nc files from January 1980 to December 2015 with hourly data for different compounds (such as PM2.5, O3, NO2, NO, etc).The time is in UTC as follows:

``````int time(time) ;
time:units = "seconds since 1979-12-02 00:00:00 UTC" ;
time:long_name = "time" ;
time:axis = "T" ;
time:calendar = "standard" ;
time:standard_name = "time" ;
``````

My question is: Can I shift the time by + (or -) 1h, 2h,3h, etc, depending on the longitude, so I can get the local time? For example, for 15 degrees< longitude< 30 degrees the local time would be LT= UTC+1h. Any ideas?

• This would be very hard to get right. Between 1980 and 2015 there have been many changes in how some countries treat their time in relation to UTC. And then there are also new countries and border changes. This might be a xyproblem.info, if it is, best make a new question with the actual problem you are facing. – bugmenot123 Jul 15 at 9:43
• My problem is that I have monthly nc files which consist of hourly data in UTC of different compounds (such as PM2.5, O3, etc., as functions of time, lon, lat). I need these data to be daily averaged in local time. Therefore, (since I am new at this) I thought I should shift the time by + (-) 1h,2h,3h depending on the longitude and then get the daily average. For example, as I mentioned above, for 15 degrees< longitude< 30 degrees the local time would be LT= UTC+1h, and in order to get the daily average for this region, we should average the hourly data from 0+1h to 23h+1h (1-24h) for UTC= 0h. – Nina W. Jul 15 at 10:55
• Timezones are very different from a simple function of longitude: commons.wikimedia.org/wiki/File:World_Time_Zones_Map.png – bugmenot123 Jul 15 at 12:01
• I know that and I agree with you, but I was asked to extract daily averages in local time from hourly data in UTC. And to do that I was told that it would be better if I could try to derive the daily averages (from hourly data) in shifted time based on the longitude, as I explained earlier.... – Nina W. Jul 16 at 7:54
• I see! Sorry for being so persistent but I wanted to make sure you don't make a huge mistake. :) Maybe remove the "local time" wording from the question then? – bugmenot123 Jul 16 at 14:45