[SciPy-User] help! strange netCDF output

Neil Berg nberg at atmos.ucla.edu
Thu Nov 11 18:22:09 EST 2010


Hi Scipy'ers,

I have written a function to read in netCDF files, interpolate hourly grid point 80-meter wind speeds, and then output those interpolated hourly wind speeds as a new netCDF file.  The time variables should all be the same from the read in and written netCDF file, but I keep getting a strange pattern for the year, month, and day variables.  As you can see below, the hour output is fine, and hence so is my hourly wind speed output, but the year, month, and day keep vacillating between the correct value and zero!  Any suggestions on how to get rid of the oscillating year, month, and day variables?  Below is sample output for the first 9 hours of June 1999.  I've attached the script.  

time[0] time_y[0]=0 
time[1] time_y[1]=1999 
time[2] time_y[2]=0 
time[3] time_y[3]=1999 
time[4] time_y[4]=0 
time[5] time_y[5]=1999 
time[6] time_y[6]=0 
time[7] time_y[7]=1999 
time[8] time_y[8]=0 
time[9] time_y[9]=1999

time[0] time_m[0]=0 
time[1] time_m[1]=6 
time[2] time_m[2]=0 
time[3] time_m[3]=6 
time[4] time_m[4]=0 
time[5] time_m[5]=6 
time[6] time_m[6]=0 
time[7] time_m[7]=6 
time[8] time_m[8]=0 
time[9] time_m[9]=6 

time[0] time_d[0]=0 
time[1] time_d[1]=1 
time[2] time_d[2]=0 
time[3] time_d[3]=1 
time[4] time_d[4]=0 
time[5] time_d[5]=1 
time[6] time_d[6]=0 
time[7] time_d[7]=1 
time[8] time_d[8]=0 
time[9] time_d[9]=1 

time[0] time_h[0]=0 
time[1] time_h[1]=1 
time[2] time_h[2]=2 
time[3] time_h[3]=3 
time[4] time_h[4]=4 
time[5] time_h[5]=5 
time[6] time_h[6]=6 
time[7] time_h[7]=7 
time[8] time_h[8]=8 
time[9] time_h[9]=9 

time[0] latitude[0] longitude[0] wnd_spd_out[0]=1.97565 m/s
time[1] latitude[0] longitude[0] wnd_spd_out[5184]=2.55842 m/s
time[2] latitude[0] longitude[0] wnd_spd_out[10368]=3.20569 m/s
....etc... 

Thanks in advance for help,
Neil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: interpolate_copy.py
Type: text/x-python-script
Size: 2731 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101111/4db01c4b/attachment.bin>
-------------- next part --------------




More information about the SciPy-User mailing list