[ncl-talk] fatal:Dimension sizes of left hand side and right hand side of assignment do not match

Toni Klemm toni-klemm at tamu.edu
Mon Sep 30 11:18:39 MDT 2019


Borja,

Which line in your code in line 41 (where the error occurs)? If it's psfc = decimalPlaces(psfc,2,True) , try renaming the “psfc” on the left into something else so that it is different from the “psfc" on the right. Maybe that will help.

If not, could you translate your comments in the script into English? That would help understand what exactly you are doing.

Good luck,
Toni


Toni Klemm, Ph.D.
Postdoctoral Research Associate
Department of Ecosystem Science and Management
College of Agriculture and Life Sciences
Texas A&M University, College Station, TX
www.toni-klemm.de <http://www.toni-klemm.de/> | @toniklemm <http://www.twitter.com/toniklemm>
Editorial Board member, Early Career Climate Forum <http://www.eccforum.org/>








> On Sep 30, 2019, at 11:43 AM, Borja Sas González via ncl-talk <ncl-talk at ucar.edu> wrote:
> 
> In the following script, the"slp" variable is extracted from several WRF out files and the values are written to the CSV file. The variables are read file by file due to a memory problem. The problem comes when the amount of time steps of the out files are different. In this case, all the files have 1000 time steps, minus one, which has 700. If I run the script taking into account the 700 time step file, the script prints the following error: 
> fatal:Dimension sizes of left hand side and right hand side of assignment do not match
> fatal:["Execute.c":8637]:Execute: Error occurred at or near line 41 in file slp.ncl
> 
> If I omit the 700 time step file, the script works successfully. How can I fix the script so that it does not print error when the time steps are not the same?
> 
> begin
> 
> ; Abrir archivo
> files = systemfunc("ls /home/ssd/chile/WRF/test/em_real/wrfout_d03_*") + ".nc"
> a = addfiles(files,"r")
> 
> ; Definir latitud y longitud
> lat = -22.056923
> lon = -68.573862
> 
> ; Localización del punto más próximo
> opt = True ; Devuelve la coordenada entera
> loc = wrf_user_ll_to_xy(a,lon,lat,opt) ; Pasa lon/lat a xy más próximo
>   
> lat2 = loc(1) ; Latitud para las variables
> lon2 = loc(0) ; Longitud para las variables
> 
> ; Opciones del encabezado
> csv_filename = "slp.csv"
> system("rm -f " + csv_filename)
> fields = (/"TIME, PRESSURE (hPa)"/)
> 
> ; Crear encabezado
> dq = str_get_dq()
> fields = dq + fields + dq
> header = [/str_join(fields,",")/]
> 
> ; Formato de escritura de las variables
> format = "%s,%g,%g,%g;%g" ; Para escribir sin espacios
> 
> ; Crea el archivo con el encabezado
> write_table(csv_filename, "w", header, "%s")
> 
> ; Para leer archivo por archivo
> nfiles = dimsizes(files)
> 
> do nf = 0,nfiles-1
> 
> ; Presión en superficie
> psfc = wrf_user_getvar(a[nf],"slp",-1)
> psfc = decimalPlaces(psfc,2,True)
> 
> ; Loop temporal
> times = wrf_user_getvar(a[nf],"times",-1)
> ntimes = dimsizes(times)
> 
> do it = 0,ntimes-1
> 
> ; Crea el archivo con las variables
> alist = [/times(it),psfc(it,lat2,lon2)/]
> write_table(csv_filename, "a", alist, format)
> 
> end do
> 
> end do
> 
> end
> 
> 
> -- 
> Borja Sas González
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://urldefense.proofpoint.com/v2/url?u=http-3A__mailman.ucar.edu_mailman_listinfo_ncl-2Dtalk&d=DwICAg&c=u6LDEWzohnDQ01ySGnxMzg&r=zmhRVp0i4wZ5_1Ujh0fnRXAExHgKLTQu0rZLW7PxKA4&m=-Tkf1q2MAiJDK9LnLhgdvts8NvDe2vL18xoxAVsDHVQ&s=JYfFz45Jhklkzliu5PflMHW4-B22xLB9195vcoFm-lQ&e=

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190930/3ef6da1a/attachment.html>


More information about the ncl-talk mailing list