Python Forum
Help me in extracting the datetime from netcdf file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me in extracting the datetime from netcdf file
#1
Hi everyone i am having netcd file and have the time in numeric one wanna convert it to Georgian one i am using these codes but its giving me error.Kindly help me with this. but its giving me cannot convert to timestamp
from netCDF4 import Dataset
import numpy as np
import pandas as pd



data = Dataset(r'C:\Users\hp\Desktop\lhr 2015.nc', 'r')\
#reainging file
#print(data.variables.keys())

lon = data.variables['longitude'][:]

lat = data.variables['latitude'][:]

time = data.variables['time'] [:]
 
starting_date=data.variables ['time'] .units[14:24]

ending_date=data.variables ['time'].units [14:18]+ '-12-31'

date_range= pd.date_range (start=starting_date,end=ending_date,periods=8784,freq='H')
Larz60+ write May-29-2021, 01:48 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020