[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with netcdf file, please
- Subject: Re: help with netcdf file, please
- Date: Wed, 03 Dec 2008 16:07:25 -0700
Hi Blanca,
> But, I have problems to convert the DataModified.cdl file to netCDF
> because the command ncgen does not work to me. I used
>
> ncgen -o DataModified.cdf DataModified.cdl
>
> the error message is
> ncgen: DataModified.cdl: syntax error
Usually ncgen gives a line number on which the syntax error was
detected. But I see you have in line 12 of DataModified.cdl:
> float Y(Y) ; DataModified.cdl
Try deleting the "DataModified.cdl" text at the end of that line to see
if ncgen will work on that. Also change the first line of the
DataModified.cdl file from
netcdf DataModified.cdl {
to
netcdf DataModified {
because if you are using an older version of ncgen, it may not permit
the "." character in the name of the CDL structure. Then run
ncgen -o DataModified.cdf DataModified.cdl
again to see if you still get an error.
If it still doesn't work, see if you can make the modified CDL file
available to me and I'll try to fix whatever bug in ncgen is causing the
problem.
--Russ
> In
> order to make the research for my master, I need to modify an a
> extensive netCDF file (1.630.000 lines aprox) with 20 variables.
> I want to take the temp and add 4 degrees in each value.
>
> I
> converted the source netCDF file into text using ncdump then I build
> a program in VisualBasic that selects the line with the data, it
> separates each temp value , adds 4 and rebuilds the string, this string
> is copied into a text file with the name DtaModified.cdl.
>
> Example:
>
> netcdf OriginalData.cdl {
> dimensions:
> time = UNLIMITED ; // (24 currently)
> X = 55 ;
> Y = 55 ;
> Z = 12 ;
> variables:
> float time(time) ;
> time:units = "seconds since 2002-03-06 01:00:00 -05:00" ;
> float X(X) ;
> X:units = "km" ;
> float Y(Y) ;
> Y:units = "km" ;
> float Z(Z) ;
> Z:units = "m" ;
> float topo(Y, X) ;
> topo:units = "m" ;
> float dzc(Z, Y, X) ;
> dzc:units = "m" ;
> float zc(Z, Y, X) ;
> zc:units = "m" ;
> float ua(time, Z, Y, X) ;
> ua:units = "m/s" ;
> float va(time, Z, Y, X) ;
> va:units = "m/s" ;
> float wa(time, Z, Y, X) ;
> wa:units = "m/s" ;
> float pt(time, Z, Y, X) ;
> pt:units = "K" ;
> float temp(time, Z, Y, X) ;
> temp:units = "K" ;
> float ah(time, Z, Y, X) ;
> ah:units = "kg/kg" ;
> float rh(time, Z, Y, X) ;
> rh:units = "%" ;
> float pr(time, Z, Y, X) ;
> pr:units = "Pa" ;
> float da(time, Z, Y, X) ;
> da:units = "kg/m3" ;
> float cdz(time, Z, Y, X) ;
> cdz:units = "m2/s" ;
> float us(time, Y, X) ;
> us:units = "m/s" ;
> float al(time, Y, X) ;
> al:units = "1/m" ;
> float ws(time, Y, X) ;
> ws:units = "m/s" ;
> data:
>
> time = 0, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400,
> 36000, 39600, 43200, 46800, 50400, 54000, 57600, 61200, 64800, 68400,
> 72000, 75600, 79200, 82800 ;
> .
> .
> .
> temp =
> // temp(0,0,0, 0-54)
> 277.4813, 276.4155, 275.3335, 274.2372, 273.4386, 273.0315, 272.6246,
> 272.2128, 271.7205, 271.1262, 270.5313, 269.9269, 269.3189, 268.7285,
> 268.1587, 267.6162, 267.5617, 268.1147, 268.6765, 269.2408, 269.4946,
> 269.3569, 269.1975, 269.0216, 268.8656, 268.7551, 268.6632, 268.5788,
> 269.1266, 270.4707, 271.8028, 273.1227, 273.7098, 273.3803, 273.0515,
> 272.7239, 272.7801, 273.3181, 273.8549, 274.3895, 274.682, 274.6729,
> 274.6642, 274.6566, 274.9037, 275.468, 276.0289, 276.5884, 276.3576,
> 275.124, 273.8793, 272.6223, 271.6534, 271.0549, 270.4564,
> // temp(0,0,1, 0-54)
> 276.8679, 275.8403, 274.7976, 273.7424, 273.0192, 272.7307, 272.4441,
> 272.1526, 271.7513, 271.2129, 270.6729, 270.1262, 269.5375, 268.9077,
> 268.2888, 267.6906, 267.6292, 268.238, 268.859, 269.4889, 269.8028,
> 269.7146, 269.6006, 269.4674, 269.2771, 269.037, 268.8181, 268.608,
> 269.0854, 270.4286, 271.7578, 273.0732, 273.6958, 273.4539, 273.2136,
> 272.9739, 272.9522, 273.2037, 273.4539, 273.7034, 273.8842, 273.9784,
> 274.0724, 274.1676, 274.4979, 275.1201, 275.7378, 276.3535, 276.2311,
> 275.1737, 274.1059, 273.0276, 272.2213, 271.7681, 271.3176,
> // temp(0,0,2, 0-54)
> 276.2509, 275.2628, 274.2611, 273.249, 272.6028, 272.4325, 272.2656,
> 272.0939, 271.7844, 271.3026, 270.8173, 270.3286, 269.7608, 269.0945,
> 268.4276, 267.7707, 267.6999, 268.3651, 269.0464, 269.7409, 270.1137,
> 270.0747, 270.0063, 269.9181, 269.6972, 269.3281, 268.9788, 268.6389,
> 269.0432, 270.3836, 271.71, 273.023, 273.6815, 273.5254, 273.3714,
> 273.2176, 273.1172, 273.083, 273.0471, 273.0109, 273.0786, 273.2758,
> 273.4725, 273.6712, 274.0868, 274.7684, 275.4451, 276.119, 276.1048,
> 275.224, 274.3337, 273.4347, 272.7914, 272.4811, 272.1753,
> .
> .
> .
> // ws(23,54, 0-54)
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0 ;
> }
>
>
> Well, I take "277.4813, 276.4155, 275.3335, 274.2372, 273.4386, 273.0315,
> 272.6246, " and obtain
>
> "281.4813, 280.4155, 279.3335, 278.2372, 277.4386, 277.03
> 15, 276.6246, "
>
> this line is added in the results file.
>
>
> The result file is like:
>
> netcdf DataModified.cdl {
> dimensions:
> time = UNLIMITED ; // (24 currently)
> X = 55 ;
> Y = 55 ;
> Z = 12 ;
> variables:
> float time(time) ;
> time:units = "seconds since 2002-03-06 01:00:00 -05:00" ;
> float X(X) ;
> X:units = "km" ;
> float Y(Y) ; DataModified.cdl
> Y:units = "km" ;
> float Z(Z) ;
> Z:units = "m" ;
> float topo(Y, X) ;
> topo:units = "m" ;
> float dzc(Z, Y, X) ;
> dzc:units = "m" ;
> float zc(Z, Y, X) ;
> zc:units = "m" ;
> float ua(time, Z, Y, X) ;
> ua:units = "m/s" ;
> float va(time, Z, Y, X) ;
> va:units = "m/s" ;
> float wa(time, Z, Y, X) ;
> wa:units = "m/s" ;
> float pt(time, Z, Y, X) ;
> pt:units = "K" ;
> float temp(time, Z, Y, X) ;
> temp:units = "K" ;
> float ah(time, Z, Y, X) ;
> ah:units = "kg/kg" ;
> float rh(time, Z, Y, X) ;
> rh:units = "%" ;
> float pr(time, Z, Y, X) ;
> pr:units = "Pa" ;
> float da(time, Z, Y, X) ;
> da:units = "kg/m3" ;
> float cdz(time, Z, Y, X) ;
> cdz:units = "m2/s" ;
> float us(time, Y, X) ;
> us:units = "m/s" ;
> float al(time, Y, X) ;
> al:units = "1/m" ;
> float ws(time, Y, X) ;
> ws:units = "m/s" ;
> data:
>
> time = 0, 3600, 7200, 10800, 14400, 18000, 21600, 25200, 28800, 32400,
> 36000, 39600, 43200, 46800, 50400, 54000, 57600, 61200, 64800, 68400,
> 72000, 75600, 79200, 82800 ;
> .
> .
> .
> temp =
> // temp(0,0,0, 0-54)
> 281.4813, 280.4155, 279.3335, 278.2372, 277.4386, 277.0315, 276.6246,
> 276.2128, 275.7205, 275.1262, 274.5313, 273.9269, 273.3189, 272.7285,
> 272.1587, 271.6162, 271.5617, 272.1147, 272.6765, 273.2408, 273.4946,
> 273.3569, 273.1975, 273.0216, 272.8656, 272.7551, 272.6632, 272.5788,
> 273.1266, 274.4707, 275.8028, 277.1227, 277.7098, 277.3803, 277.0515,
> 276.7239, 276.7801, 277.3181, 277.8549, 278.3895, 278.682, 278.6729,
> 278.6642, 278.6566, 278.9037, 279.468, 280.0289, 280.5884, 280.3576,
> 279.124, 277.8793, 276.6223, 275.6534, 275.0549, 274.4564,
> // temp(0,0,1, 0-54)
> 280.8679, 279.8403, 278.7976, 277.7424, 277.0192, 276.7307, 276.4441,
> 276.1526, 275.7513, 275.2129, 274.6729, 274.1262, 273.5375, 272.9077,
> 272.2888, 271.6906, 271.6292, 272.238, 272.859, 273.4889, 273.8028,
> 273.7146, 273.6006, 273.4674, 273.2771, 273.037, 272.8181, 272.608,
> 273.0854, 274.4286, 275.7578, 277.0732, 277.6958, 277.4539, 277.2136,
> 276.9739, 276.9522, 277.2037, 277.4539, 277.7034, 277.8842, 277.9784,
> 278.0724, 278.1676, 278.4979, 279.1201, 279.7378, 280.3535, 280.2311,
> 279.1737, 278.1059, 277.0276, 276.2213, 275.7681, 275.3176,
> // temp(0,0,2, 0-54)
> 280.2509, 279.2628, 278.2611, 277.249, 276.6028, 276.4325, 276.2656,
> 276.0939, 275.7844, 275.3026, 274.8173, 274.3286, 273.7608, 273.0945,
> 272.4276, 271.7707, 271.6999, 272.3651, 273.0464, 273.7409, 274.1137,
> 274.0747, 274.0063, 273.9181, 273.6972, 273.3281, 272.9788, 272.6389,
> 273.0432, 274.3836, 275.71, 277.023, 277.6815, 277.5254, 277.3714,
> 277.2176, 277.1172, 277.083, 277.0471, 277.0109, 277.0786, 277.2758,
> 277.4725, 277.6712, 278.0868, 278.7684, 279.4451, 280.119, 280.1048,
> 279.224, 278.3337, 277.4347, 276.7914, 276.4811, 276.1753,
> .
> .
> .
> // ws(23,54, 0-54)
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0 ;
> }
>
>
>
>
> But, I have problems to convert the DataModified.cdl file to netCDF because t
> he command ncgen does not work to me. I used
>
> ncgen -o DataModified.cdf DataModified.cdl
>
> the error message is
> ncgen: DataModified.cdl: syntax error
>
> I don't understant what happened, basically is the same file !!!!