<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi everyone. I am trying to put in a CSV file the wind speed and direction for level 1 of the out file of the WRF output. I have reviewed the script a thousand times, but I can't find where the error is. The answer that prints me is:</div><div><br></div><div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span>wind_speed: dimension size mismatch</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> u: 1000</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(1)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> u: 27</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(2)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> u: 81</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(3)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> u: 82</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(0)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> v: 1000</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(1)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> v: 27</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(2)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> v: 82</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">(3)<span class="gmail-Apple-tab-span" style="white-space:pre"> </span> v: 81</span></p></div><div><br></div><div>The script is:</div><div><br></div><div><p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">begin</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Abrir archivos</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">files = systemfunc("ls /home/ssd/begur/WRF/test/em_real/wrfout_d03_*") + ".nc"</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">a = addfiles(files,"r")</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Definir latitud y longitud</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">lat = 41.935165</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">lon = 3.158911</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Opciones del encabezado</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">csv_filename = "wind_levels.csv"</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">system("rm -f " + csv_filename)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">fields = (/"TIME","WIND SPEED (m/s)","WIND DIRECTION (º)"/)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Crear encabezado</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">dq = str_get_dq()</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">fields = dq + fields + dq</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">header = [/str_join(fields,",")/]</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Formato de escritura de las variables</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">format = "%s,%g,%g,%g,%g" ; Para escribir sin espacios</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Crea el archivo con el encabezado</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">write_table(csv_filename,"w",header,"%s")</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Para leer archivo por archivo</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">nfiles = dimsizes(files)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Bucle archivo por archivo</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">do nf = 0,nfiles-1</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Localización del punto más próximo</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">opt = True ; Devuelve la coordenada entera</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">loc := wrf_user_ll_to_xy(a[nf],lon,lat,opt) ; Pasa lon/lat a xy más próximo</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Coordenadas para las variables</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">lat2 = loc(1) ; Latitud para las variables</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">lon2 = loc(0) ; Longitud para las variables</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Velocidad del viento a los niveles establecidos</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">u := wrf_user_getvar(a[nf],"U",-1)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">v := wrf_user_getvar(a[nf],"V",-1)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">wspd := wind_speed(u,v)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">wspd = decimalPlaces(wspd,2,True)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Dirección del viento a los niveles establecidos</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">wdir := wind_direction(u,v,0)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Loop temporal</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">times := wrf_user_getvar(a[nf],"times",-1)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">ntimes = dimsizes(times)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Bucle temporal</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">do it = 0,ntimes-1</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">; Crea el archivo CSV con las variables</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">alist = [/times(it),wspd(it,0,lat2,lon2),wdir(it,0,lat2,lon2)/]</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">write_table(csv_filename,"a",alist,format)</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">end do</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">end do</span></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></p>
<p style="margin:0px;font-stretch:normal;font-size:12px;line-height:normal;font-family:Monaco;color:rgb(255,255,255);background-color:rgb(30,31,41)"><span style="font-variant-ligatures:no-common-ligatures">end</span></p></div><div><br></div><div>If anyone can help me I appreciate it.</div><div><br></div>-- <br><div dir="ltr" class="gmail_signature">Borja Sas González</div></div></div></div></div>