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.

Re: netCDF again

Eugene,

>Date: Fri, 3 Dec 1999 16:58:21 +1100 (AEDT)
>From: Eugene Tan <chet@xxxxxxxxxx>
>To: visad-list@xxxxxxxxxxxxx
>Subject: Re: netCDF again

In the above message, you wrote:

> I am still having trouble understanding how to setup a netCDF file. I
> have:
> 
> Time -> (Temp, Humidity)
> 
> Sample1: Temp = 5, Humidity = 4
> Sample2: Temp = 6, Humidity = 5
> Sample3: Temp = 7, Humidity = 8
> 
> All I want to do is try and write this information out to a netCDF file
> but I have no idea how to start so help please??

Here's a little test class that does this:


    import visad.Data;
    import visad.data.netcdf.Plain;
    public class InOut
    {
        public static void main(String[] args)
            throws Exception
        {
            Plain       plain = new Plain();
            Data        input = plain.open("1.nc");
            System.out.println("input = " + input);
            plain.save("2.nc", input, true);
        }
    }

I ran it on the netCDF file correspoding to the following CDL file:

    netcdf 1 {
        dimensions:
            Time = 3;
        variables:
            float Temp(Time);
            float Humidity(Time);
        data:
            Temp = 5, 6, 7;
            Humidity = 4, 5, 8;
    }

It generated the following output:

    input = FlatField
        FunctionType (Real): (Time) -> (Temp, Humidity)
    (5.0, 4.0), (6.0, 5.0), (7.0, 8.0)

and reproduced the input, netCDF file.

--------
Steve Emmerson   <http://www.unidata.ucar.edu>

  • 1999 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: