NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
If you do have access to MATLAB: http://www.mathworks.com/Create a schema for the file (i.e specify the format you want, the dimensions, variables and attributes) using ncwriteschema.
You can reuse this schema in case you want to create multiple files: http://www.mathworks.com/help/techdoc/ref/ncwriteschema.html Read the data in using textscan. Look at the 'HeaderLines' to skip over the comments. http://www.mathworks.com/help/techdoc/ref/textscan.html Write the data to the netcdf file using ncwrite. http://www.mathworks.com/help/techdoc/ref/ncwrite.htmlDepending on the size of your files and the memory available on your machine, you could either use textscan/ncwrite to read in and write all the data at one time, or loop through line/N lines and use the 'start' option in ncwrite to append the data in batches.
AshishOn Sat, 30 Jul 2011 21:14:33 -0400, David William Pierce <dpierce@xxxxxxxx> wrote:
Do you use an analysis package such as R, IDL, or Matlab? Many such packagescan create netcdf files. It might be easiest to read your files into a package you are familiar with, then write the netcdf file in the package. Regards, --Dave
On Sat, Jul 30, 2011 at 4:34 PM, spazm <kaan@xxxxxxxxxxxx> wrote:Hello, I have been googleing to find a solution to convert a couple hundreds ofASCII files to Netcdf however, the solutions I found don't really fit intomy data set. So, I wanted to ask in here. My ASCII files come from a GWC (generic water column) data. I paste the header and first two lines of the data below; /# ----------------------------------------------------- # Source Files Information # Index Filename # 0 I:\raw\234.all # ----------------------------------------------------- # Field Definitions # 0 Sample File ID (see above) # 1 Sample Position X # 2 Sample Position Y # 3 Sample Position Z # 4 Sample Value (Amplitude) # 5 Sample Time # 6 Sample Range # 7 Ship Position X # 8 Ship Position Y # 9 Ship Heading (degs) # 10 Ship Pitch (degs) # 11 Ship Roll (degs) # 12 Transducer Depth (m) # 13 Sound Speed (m/s) # 14 Ping Number X # 15 Ping Time X # 16 Sample Number X # 17 Beam Number X # 18 Beam Azimuth X # 19 Beam Elevation X #0 1 2 3 4 5 6 78 9 10 11 12 13 14 15 16 17 1819 0 684028.44 4576014.50 -3.76 -127.00 0.0004 0.32 684020.44 4576016.44 238.36 3.25 -0.21 3.28 1504.3 00002 1223471556.46 1 99 0.00 13.98 0 684028.50 4576014.50 -3.86 -127.00 0.0006 0.49 684020.44 4576016.44 238.36 3.25 -0.21 3.28 1504.3 00002 1223471556.46 2 99 0.00 13.98/Any suggestions to convert this to netcdf? I installed ferret but couldn'tmanage to write the suitable code. Thanks! -- View this message in context: http://netcdf-group.1586084.n2.nabble.com/ASCII-to-NetCDF-tp6637076p6637076.html Sent from the NetCDF Group mailing list archive at Nabble.com. _______________________________________________ netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdfgroup
archives: