I am a beginner coder, so I apologize if I’m a bit slow! I have variables in a dataset that give me longitude[:], latitude[:], time[:] and localtime_at_0[time].
localtime_at_0 only tells me which longitudes are experiencing midnight. However, I’d like to know what time it is at all longitudes, so I can use that variable in another project. How might I go about this? Also, if I need to provide more information please let me know. Thanks so much!
(Also, no need to include daylight savings or anything like that. I’m not prepared for that!)
ws = Dataset('dataset.nc')
lon = ws.variables['longitude'][:]
time = ws.variables['time'][:]
loc0 = ws.variables['lon_lt0'][:] #based on time
###I don't think this part below is right! This is what a friend wrote, but I might scrap it.###
def calculation(lon, loc0):
full_day = 24
offset = len(lon) /360 * full_day
loctime = loc0 + dt.timedelta(hours=offset)
return loctime
for i in range(len(lon)):
loct = calculation(lon, loc0)
print("{lon[i]}: {loct}")
I think there is a problem in my calculation, but I haven’t gotten any further than that yet. Any help is appreciated!