I am new here. I have downloaded temeperature data from NOAA which is in netcdf format. Can anybody help me with code to convert this data in stata files using python? Data link is here: https://downloads.psl.noaa.gov/Datasets/cpc_global_temp/ Thanks.
I tried writing the code to read the files but it gives error.
` data = nc.open_data('tmax.day.ltm.1991-2020.nc') data.crop(lon= [35.54654, 97.17848], lat = [6.765741, 68.45368])
data.to_nc("wip.nc",overwrite=True)
maxtemp_19902020 = xr.open_dataset('wip.nc', decode_times=False)
timestamps = maxtemp_19902020['time'].values
dates = [datetime.fromtimestamp(ts).strftime('%Y-%m-%d') for ts in timestamps]
print(maxtemp_19902020)
maxtemp_19902020.variables.keys()
data_df = maxtemp_19902020.to_dataframe().reset_index()
data_df['time'] = pd.to_datetime(data_df['time'], format='%Y%m%d')
data_df.to_stata('maxtemp_19902020.dta')`