begin ; Read data into a big 1D string array fname = "20070708_06.dat" data = asciiread(fname,-1,"string") ; Count the number of fields, just to show it can be done. nfields = str_fields_count(data(1)," ") print("number of fields = " + nfields) ; ; Skip first row of "data" because it's just a header line. (optional) ; ; Use a space (" ") as a delimiter in str_get_field. The first ; field is field=1 (unlike str_get_cols, in which the first column ; is column=0). ; ;lat = stringtofloat(str_get_field(data(1::), 2," ")) (optional) ;lon = stringtofloat(str_get_field(data(1::), 3," ")) (optional) ;pwv = stringtofloat(str_get_field(data(1::), 4," ")) (optional) ; No skipping first coloumn lat = stringtofloat(str_get_field(data(1::), 2," ")) ; lon = stringtofloat(str_get_field(data(1::), 1," ")) ; rain = stringtofloat(str_get_field(data(1::), 3," ")) lon@long_name = "longitude" lon@units = "degrees_east" lat@long_name = "latitude" lat@units = "degrees_north" ;*************************************************** ; Open output netcdf file. Remove first just in case. ;*************************************************** ncdf_out_fname = "20070708_06.nc" system("rm -f " + ncdf_out_fname) ; remove any pre-existing file ncdf_out = addfile(ncdf_out_fname,"c") ncdf_out->lat = lat ncdf_out->lon = lon ncdf_out->rain = rain end