[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: netcdf file



Blanca,

On Dec 4, I wrote:
> OK, I downloaded the file and see the problem.  When you generated
> DataModified.cdl on a Windows computer, it has changed the endings of
> each line by replacing the single new-line character of the CDL file
> with a carriage-return and new-line character.  ncgen gets a syntax
> error on the first carriage-return character it sees and exits.  You can
> see that DataModified.cdl has these extra characters by looking at the
> size of the new file compared to the OriginalData.cdl.  The new file is
> 109351916 bytes, but the original file was about 107723284, without all
> those extra \r characters used as line endings on Windows text files.
>
> This is a problem that I have not seen before with ncgen, because it is
> used on CDL files that come from ncdump, which do not have the extra \r
> carriage-return characters before each newline.  I will eventually fix
> this in ncgen, but in the meantime for your problem, I just used a
> program named "dos2unix" to change the line endings to match what ncgen
> expects, just a newline character.

The ncgen program is now fixed to properly handle Windows line endings
in CDL files.  The fix will be in tomorrow's netCDF "snapshot" release
from

  ftp://ftp.unidata.ucar.edu/pub/netcdf/snapshot/netcdf-4-daily.tar.gz

Thanks for reporting the problem.

> Then ncgen works fine, until it encounters the last line of temp values,
> which ends with a "," rather than a ";", and it gets another syntax
> error:
>
>     ncgen: DataModified.cdl line 795855: syntax error
>
>   // temp(23,11,54, 0-54)
>     264.0619, 264.099, 264.1099, 264.0779, 264.0126, 263.9439, 263.9188,
>     263.9339, 263.9385, 263.9156, 263.8802, 263.8372, 263.8124, 263.8065,
>     263.799, 263.7932, 263.7779, 263.7554, 263.7683, 263.8624, 264.0413,
>     264.2074, 264.2559, 264.1556, 263.9081, 263.6698, 263.6201, 263.6891,
>     263.7142, 263.6941, 263.6813, 263.6721, 263.6609, 263.6432, 263.6154,
>     263.5957, 263.6472, 263.815, 264.0381, 264.1737, 264.0785, 263.8011,
>     263.6033, 263.5968, 263.6905, 263.9261, 264.1966, 264.1403, 263.8568,
>     263.6507, 263.569, 263.6014, 263.6422, 263.65,  263.645,
>
> I fixed that in an editor, replacing the last line with
>
>     263.6507, 263.569, 263.6014, 263.6422, 263.65,  263.645;
>
> Then ncgen worked fine on the resulting file, creating the corresponding
> DataModified.nc netCDF file.  I tried to upload this to your
> www.adrive.com account, but it got an error after a few minutes of
> uploading:
>
>   Connection Interrupted
>   The connection to the server was reset while the page was loading.
>   The network link was interrupted while negotiating a
>   connection. Please try again.
>
> Instead of trying again, I put the file here, so you can download it:
>
>   http://www.unidata.ucar.edu/staff/russ/public/DataModified.nc
>
> which has size 36023772 bytes.
>
> Please let me know if you can't access it.
>
> Later, I will send a small Fortran program that adds 4 to each of the
> values of the temp variable as well, just to show how to do it in
> Fortran.

--Russ