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: Help with ncML for aggregation

mrehbein@xxxxxxxxxxx wrote:

Hi John,

I have had a bit of a break from the netcdf project I had been working on, but now I am back on the trail :)

My geoTiff writer needs a bit of work, but it uses JAI to create a tiff:

JAI.create("filestore", bufferedImage, filepath, "TIFF", null);

and then a write a text "world file" to match the tiff image.

The only problem I came across was that the numbers in the world file needed to be in the following format:

DecimalFormat format=new DecimalFormat(".00000000000000");

The numbers in the world file (in order) needed to be:

xscale
brotation
crotation
yscale
xOriginCentre
yOriginCentre

In any case, when I tidy up the code into a neat little API, I will forward it on to you.

great, id like to see it.


---

I have a question or two about NcML.

I am using NcML to aggregate netcdf files that hold data for a particular month. Below is a copy of my test NcML file.

<netcdf xmlns="http://www.ucar.edu/schemas/netcdf"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.unidata.ucar.edu/schemas/netcdf.xsd http://www.unidata.ucar.edu/schemas/netcdfDataset.xsd";>

<dimension name="lat" length="2100" /> <dimension name="lon" length="1600" /> <dimension name="time" length="61"/>
 <variable name="SST_AVE" type="float" shape="time lat lon"/>

 <netcdf uri="file://\\moon\risdev\ferret\data\mar.nc">
   <dimension name="time" length="31" />
 </netcdf>

 <netcdf uri="file://\\moon\risdev\ferret\data\apr.nc">
   <dimension name="time" length="30" />
 </netcdf>

</netcdf>


I could get the java NetCDF API to read it and aggregate, using the following code segment:

<code>

NetcdfFile ncfile = NetcdfDataset.factory("C:\\sst_ncml.xml",null);
NetcdfDataset nDataset = ucar.nc2.dataset.conv.Convention.factory(ncfile); // find the coordinate system used in this netcdf file
List systems=nDataset.getCoordinateSystems();
Iterator iSys=systems.iterator();
while (iSys.hasNext()) {
 CoordinateSystem sys=(CoordinateSystem)iSys.next();
 GridCoordSys grid=new GridCoordSys(sys);
Date fromDate=aims.util.StringUtilities.convert2Date("11/03/2003");
 Date thruDate=aims.util.StringUtilities.convert2Date("26/04/2003");
int minT=grid.findTimeCoordElement(fromDate);
 int maxT=grid.findTimeCoordElement(thruDate);
System.out.println("date indexs:" + minT + " " + maxT);
}

</code>

However, there are zero coordinates systems, so the code within the while loop never executes. I assume I must define a coordinate system within the NcML file, which I have done and the XML is shown in the attachment. The code within the while loop still does not execute. Can you tell me what am I doing wrong?

Thanks for your time,

Mark

the dataset aggregation is very "alpha" quality, so it may be a bug.

would it be easy to send me the 2 underlying netcdf files so i can reproduce the problem?

PS: i am gone for 10 days on vacation, so i wont get back to you again for a bit.

thanks,

John


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