
Loading netCDF files

steeve88
I am trying to load netcdf files from a folder by using the code below. I want to load them one by one as I want to derive different results from each one. I use a string to add the filename at the end of the loadnc string. Then I execute loadnc to load the file:
variable m newpath/O NC_Path, "C:Data:RadarData:camra21jan09:UniServer:" string filenames=IndexedFile(NC_Path,-1,".nc") variable num_of_files=itemsinlist(filenames) For (m=0;m<num_of_files;m+=1) string file_to_proc_name =stringfromlist(m, filenames) string loadnc="Load_NetCDF /P=NC_Path " + file_to_proc_name execute loadnc Endfor
If I write
Load_NetCDF /P=NC_Path file_to_proc_name
in the command window it makes it, but when I use the execute command in the code I get an error.
Could anyone help?
"An error" is too vague.
October 14, 2015 at 06:26 am - Permalink
I think the problem in your case is missing quotation marks. I also think your variable/string declarations were done from the command window which makes them global, otherwise the string file_to_proc_name would not be found from the working command you gave.
Here are some functions to illustrate some of the various ways of constructing a Load command. The LoadTest4() example is similar to your problem. I assume these translate to Load_NetCDF.
Note: this makes a file in your 'My Documents' folder. You will want to delete this once you have finished playing - the function CleanUp() will do this.
You will need to Kill the wave wData between running each LoadTest function.
Hope this helps
Kurt
October 14, 2015 at 06:49 am - Permalink
Your suggestions worked for me...!!!
October 14, 2015 at 08:40 am - Permalink