[ncl-talk] difficulty reading multiple files with different dimensions.
Geeta Geeta
geetag54 at yahoo.com
Sun Feb 22 22:46:08 MST 2026
Sir, I looked at the chat GPT link and found the explanation useful. My code is working with reassignment operator/
Thank you
Geeta.
On Thursday, 19 February 2026 at 09:42:12 am IST, Jonathan Vigh <jvigh at ucar.edu> wrote:
Hi Geeta,
I don't know if anyone has replied to you yet. This appears to be a typical programming challenge, in which arrays that are different shapes can't be assigned in NCL. One of your files probably has a different dimension from the others.
Tools like ChatGPT "know" NCL and can be very helpful in explaining what is going on with your code and offering potential solutions. Here's a link to a chat where I simply put the text of your email into it and asked if it could figure out what was going on. It provided a good explanation and solution. https://chatgpt.com/share/69968a1a-b73c-800f-a291-aab0c2136ec0
I don't recommend using free-tier AI tools to blindly write or patch code for complex tasks, as I've observed them to lose context and lead one around in circles. However, for debugging errors like this, they are often very helpful. As with anything AI, one always needs to carefully check to ensure that the code solution works.
Best regards,Jonathan
Jonathan Vigh
Scientist V, Environmental Resilience Applications Program
Research Applications Laboratory (RAL)
NSF National Center for Atmospheric Research (NSF NCAR)
P.O. Box 3000 tel: +1 (303) 497-8205
Boulder, CO 80307-3000 fax: +1 (303) 497-8171
Jonathan's Staff Web Page (CV, publications, etc.)
Tropical Cyclone Guidance Project (real-time hurricane data)Tropical Cyclone Data Project (FLIGHT+, VDM+, TC-OBS datasets)HurricaneRiskCalculator®️ (Now available -- Personalized hurricane wind hazard assessments for decision support)
On Mon, Feb 16, 2026 at 2:15 AM Geeta Geeta via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
Hi I have multiple files (TEXT files) like this
Variable: filesType: stringTotal Size: 248 bytes 31 valuesNumber of Dimensions: 1Dimensions and sizes: [31]Coordinates: (0) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_01.his(1) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_02.his(2) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_03.his(3) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_04.his(4) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_05.his(5) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_06.his(6) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_07.his(7) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_08.his(8) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_09.his(9) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_10.his(10) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_11.his(11) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_12.his(12) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_13.his(13) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_14.his(14) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_15.his(15) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_16.his(16) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_17.his(17) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_18.his(18) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_19.his(19) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_20.his(20) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_21.his(21) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_22.his(22) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_23.his(23) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_24.his(24) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_25.his(25) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_26.his(26) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_27.his(27) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_28.his(28) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_29.his(29) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_30.his(30) /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_31.his
Variable: NfileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 31
Code that is reading thesefiles = systemfunc("ls /mnt/c/Users/ACER/Downloads/CELIOMETER/AWOS/AWOSdata/2024/Aug/CLOUD_ALL_*") printVarSummary(files) print(files)Nfile = dimsizes(files); printVarSummary(Nfile) print(Nfile)
do NF = 0, Nfile-1ReadFile = asciiread(files(NF),-1,"string") ; Read each file as stringDimFile = dimsizes(ReadFile) print(DimFile); print(ReadFile);end do
This code is NOT executed till end as dimensions of 6th and 7th file are different.
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762
Variable: DimFileType: integerTotal Size: 4 bytes 1 valuesNumber of Dimensions: 1Dimensions and sizes: [1]Coordinates: (0) 5762fatal: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 33 in file c1.ncl
I Request to help me sort out this
Geeta._______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20260223/5571f9c5/attachment.htm>
More information about the ncl-talk
mailing list