hello everyone ,please who can help me to extract netcdf file to csv precipitation for arc swat. please
--
You received this message because you are subscribed to the Google Groups "SWAT-CUP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swat-cup+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swat-cup/bedc4d3b-a5cd-406b-806e-7c8a5064d012n%40googlegroups.com.
U can use R
hello everyone ,please who can help me to extract netcdf file to csv precipitation for arc swat. please
import glob from netCDF4 import Dataset import numpy as np import pandas as pd all_years = [] for file in glob.glob('*.nc'): print(file) data = Dataset(file, 'r') time = data.variables['time'] year = time.units[11:15] all_years.append(year) year_start = min(all_years) end_year = max(all_years) date_range = pd.date_range(start = str(year_start) + '-01-01', end = str(end_year)+'-12-31', freq = 'M') df = pd.DataFrame(0.0, columns = ['precip'], index = date_range) lat_keshem = 31.93321389 lon_keshem = 63.04979722 all_years.sort() for yr in all_years: data = Dataset(str(yr)+'.nc', 'r') lat = data.variables['lat'][:] lon = data.variables['lon'][:] sq_diff_lat = (lat-lat_keshem)**2 sq_diff_lon = (lon-lon_keshem)**2 min_index_lat = sq_diff_lat.argmin() min_index_lon = sq_diff_lon.argmin() precip = data.variables['precip'] start = str(yr) + '-01-01' end = str(yr) + '-12-31' d_range = pd.date_range(start = start, end = end, freq = 'M') for t_index in np.arange(0, len(d_range)): #print('Recording the value for: '+str(d_range[t_index])) df.loc[d_range[t_index]]['precip'] = precip[t_index, min_index_lat, min_index_lon] df.to_csv('XXXXX.csv')
hello everyone ,please who can help me to extract netcdf file to csv precipitation for arc swat. please
--
You received this message because you are subscribed to the Google Groups "SWAT-CUP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swat-cup+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swat-cup/bedc4d3b-a5cd-406b-806e-7c8a5064d012n%40googlegroups.com.
Drop me the data
hello everyone ,please who can help me to extract netcdf file to csv precipitation for arc swat. please
Check this https://youtu.be/vIyZ2_U5t4c?si=k9PM5NRGrte0x4N3
hello everyone ,please who can help me to extract netcdf file to csv precipitation for arc swat. please