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

Re: 20020228: Netcdf-C library use (Trouble adding more dimensions to variables)



>To: address@hidden
>From: address@hidden
>Subject: BOUNCE address@hidden: Non-member submission from [Naveenta Anand 
><address@hidden>] 
>Keywords: 200202282208.g1SM8j809246

Hi,

> Just wondering if anyone had a problem with this. I have couple variables 
> to which I need to add dimensions. They already have two dimensions and I 
> am trying to add another one to the set.
> 
> I am able to add to variables that display single values. But variables 
> that display more than 1 value (like an array of values) or multiple values 
> (in a loop) have a trouble displaying. So basically if I add a dimension, 
> it ruins the display of all the values of the variables.
> For example, my variable is Pressure and it has 1 existing dimension called 
> N_PROF, I am trying to add another one N_LEVELS and the display is as 
> follows:
> 
> With Single dimension:
> PRES =     8.9,    19.4,    29.3,    39.5,    49.5,    59.2,    69.4,
>        79.6,    89.5,    99.4,   109.3,   119.4,   129.5,   139.5,   149.2, 
>       159.4,   169.1,   179.4,   189.1,   199.4,   209.2,   219.4,   229.2, 
>       239.2,   249.3,   259.3,   269.1,   279.3,   289.3,   299.5,   309.1, 
>       319.3,   329.1,   339.4,   349.1,   359.1,   379.3,   399.3,   449.2, 
>       499.0,   549.3,   599.3,   649.5,   699.0,   749.2,   799.5,   849.5, 
>       899.1,   949.6,   999.5,  1049.3,  1099.0,  1149.0,  1199.4,  1249.2, 
>      1299.0,  1349.4,  1399.4,  1449.3,  1499.2,  1549.4,  1599.3,  1649.1, 
>      1699.4,  1749.4,  1799.4,  1849.2,  1899.5,  1949.1,  1999.6,  2002.2 
> ;
> 
> When I add a dimension it becomes:
> PRES =
>       5.9, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, 
> _,
>     _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
>     _, _, _, _, _ ;
> 
> Sorry guys, I am new to netcdf and need to resolve this before my deadline 
> (which is in 2 days). If something can help, that would be great!!!!

How are you adding dimensions?  Through a program interface (C,
Fortran 77, C++, Fortran 90, Java, Perl, Python)?  Or are you just
editing the CDL file to add a dimension?

The netCDF data model supports adding variables, attributes, and
dimensions to a netCDF file, but it doesn't support redefining the
shape of a variable (like changing the schema in a database).  If you
need to change the shape of a variable, you have to define a new
netCDF dataset and copy the data from the old dataset to the new
dataset, using a program that reads data from the old dataset and
writes it into the new dataset.

If you are just editing the CDL file, you might need to edit the data
section, since adding dimensions may require reordering the data.
It might be relatively easy to add new dimensions if they are
dimensions that vary more slowly than what you currently have.  We
would have to see the old CDL file and what you want for the new CDL
file to see if this could be done easily.

--Russ

_____________________________________________________________________

Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu