Package visad.data.vis5d

Examples of visad.data.vis5d.Vis5DCoordinateSystem


        Vis5DGridDefRecord vgd = new Vis5DGridDefRecord(map_proj, proj_args,
                                     nr, nc);
        GridHorizCoordSys ghc = new GridHorizCoordSys(vgd, new Vis5DLookup(),
                                    null);

        Vis5DCoordinateSystem coord_sys;
        try {
            coord_sys = new Vis5DCoordinateSystem(map_proj, proj_args, nr,
                    nc);

            Variable lat = new Variable(ncfile, null, null, LAT);
            lat.setDimensions(COLUMN + " " + ROW);
            lat.setDataType(DataType.DOUBLE);
            lat.addAttribute(new Attribute("long_name", "latitude"));
            lat.addAttribute(new Attribute(CF.UNITS, "degrees_north"));
            lat.addAttribute(new Attribute(CF.STANDARD_NAME, "latitude"));
            lat.addAttribute(new Attribute(_Coordinate.AxisType,
                                           AxisType.Lat.toString()));
            ncfile.addVariable(null, lat);

            Variable lon = new Variable(ncfile, null, null, LON);
            lon.setDimensions(COLUMN + " " + ROW);
            lon.setDataType(DataType.DOUBLE);
            lon.addAttribute(new Attribute(CF.UNITS, "degrees_east"));
            lon.addAttribute(new Attribute("long_name", "longitude"));
            lon.addAttribute(new Attribute(CF.STANDARD_NAME, "longitude"));
            lon.addAttribute(new Attribute(_Coordinate.AxisType,
                                           AxisType.Lon.toString()));
            ncfile.addVariable(null, lon);

            int[]      shape    = new int[] { nc, nr };
            Array      latArray = Array.factory(DataType.DOUBLE, shape);
            Array      lonArray = Array.factory(DataType.DOUBLE, shape);
            double[][] rowcol   = new double[2][nr * nc];
            for (int x = 0; x < nc; x++) {
                for (int y = 0; y < nr; y++) {
                    int index = x * nr + y;
                    rowcol[0][index] = y;
                    rowcol[1][index] = x;
                }
            }
            double[][] latlon   = coord_sys.toReference(rowcol);
            Index      latIndex = latArray.getIndex();
            Index      lonIndex = lonArray.getIndex();
            /*
            for (int y = 0; y < nr; y++) {
                for (int x = 0; x < nc; x++) {
View Full Code Here

TOP

Related Classes of visad.data.vis5d.Vis5DCoordinateSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.