Examples of ProjectionImpl


Examples of ucar.unidata.geoloc.ProjectionImpl

        }
      }

      parseInfo.format("Default Conventions projection %s params = %f %f %f %f\n", projection, p[0],p[1],p[2],p[3]);

      ProjectionImpl proj;
      if (projection.equalsIgnoreCase("LambertConformal"))
        proj = new LambertConformal(p[0], p[1], p[2], p[3]);
      else if (projection.equalsIgnoreCase("TransverseMercator"))
        proj = new TransverseMercator(p[0], p[1], p[2]);
      else if (projection.equalsIgnoreCase("Stereographic") || projection.equalsIgnoreCase("Oblique_Stereographic"))
        proj = new Stereographic(p[0], p[1], p[2]);
      else {
        parseInfo.format("Default Conventions error: Unknown projection %s\n",projection);
        return null;
      }

      return new ProjectionCT(proj.getClassName(), "FGDC", proj);
    }
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

        t1 = head.indexOf(t0);

        // if( convertunsignedByte2Short(b[101 + hsize]) != 0xF0 ||
        // convertunsignedByte2Short(b[102 + hsize]) != 0x0b )
        // return;
        ProjectionImpl projection = null;
        if (product.contains("NOWRAD")) {
            ot = new String(b, t1 + 2, 68);

            List<String> toks = StringUtil.split(ot, " ", true, true);
            String       pj   = toks.get(0);
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

        xaxis.addAttribute(new Attribute("standard_name", "projection x coordinate"));
        xaxis.addAttribute(new Attribute("units", "km"));
        xaxis.addAttribute(new Attribute(_Coordinate.AxisType, "GeoX"));

        double[]       data1      = new double[numX];
        ProjectionImpl projection = new LambertConformal(clat, clon, lat1, lat2);
        double ullat = 51.8294;
        double ullon = -135.8736;
        double lrlat = 17.2454;
        double lrlon = -70.1154;

        ProjectionPointImpl ptul = (ProjectionPointImpl) projection.latLonToProj(new LatLonPointImpl(ullat, ullon));
        ProjectionPointImpl ptlr = (ProjectionPointImpl) projection.latLonToProj(new LatLonPointImpl(lrlat, lrlon));
        ProjectionPointImpl ptc = (ProjectionPointImpl) projection.latLonToProj(new LatLonPointImpl(clat, clon));
        double startX = ptul.getX();
        double startY = ptlr.getY();
        double dx = (ptlr.getX() - ptul.getX())/(numX-1);
        for (int i = 0; i < numX; i++) {
            data1[i] = startX + i*dx;
        }

        Array dataA = Array.factory(DataType.DOUBLE.getPrimitiveClassType(), new int[] { numX }, data1);

        xaxis.setCachedData(dataA, false);
        ncfile.addVariable(null, xaxis);

        Variable yaxis = new Variable(ncfile, null, null, "y");

        yaxis.setDataType(DataType.DOUBLE);
        yaxis.setDimensions("y");
        yaxis.addAttribute(new Attribute("standard_name", "projection y coordinate"));
        yaxis.addAttribute(new Attribute("units", "km"));
        yaxis.addAttribute(new Attribute(_Coordinate.AxisType, "GeoY"));
        data1 = new double[numY];
        double dy = (ptul.getY() - ptlr.getY())/(numY-1);

        for (int i = 0; i < numY; i++) {
            data1[i] = startY + i*dy;
        }

        dataA = Array.factory(DataType.DOUBLE.getPrimitiveClassType(), new int[] { numY }, data1);
        yaxis.setCachedData(dataA, false);
        ncfile.addVariable(null, yaxis);

        // projection
        // lower left and upper right corner lat/lons
        // modified cylind. equidistant or  CED with lat/lon ration != 1
        Variable ct = new Variable(ncfile, null, null, projection.getClassName());

        ct.setDataType(DataType.CHAR);
        ct.setDimensions("");

        List params = projection.getProjectionParameters();

        for (int i = 0; i < params.size(); i++) {
            Parameter p = (Parameter) params.get(i);

            ct.addAttribute(new Attribute(p));
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

        navVar.setCachedData(navArray, false);
        ncfile.addVariable(null, navVar);


        // projection variable
        ProjectionImpl projection = new McIDASAreaProjection(af);
        Variable       proj = new Variable(ncfile, null, null, "AREAnav");
        proj.setDataType(DataType.CHAR);
        proj.setDimensions("");

        List params = projection.getProjectionParameters();
        for (int i = 0; i < params.size(); i++) {
            Parameter p = (Parameter) params.get(i);
            proj.addAttribute(new Attribute(p));
        }
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

              data1[i] = numY0 + i*ddx;
            dataA = Array.factory(DataType.DOUBLE.getPrimitiveClassType(), new int[] {numY}, data1);
            yaxis.setCachedData( dataA, false);
            ncfile.addVariable(null, yaxis);

            ProjectionImpl projection = new FlatEarth(lat_min, lon_max);
            //ProjectionImpl projection = new LambertConformal(latitude, longitude, latitude, latitude);
            // coordinate transform variable
            Variable ct = new Variable( ncfile, null, null, projection.getClassName());
            ct.setDataType( DataType.CHAR);
            ct.setDimensions( "");
            List params = projection.getProjectionParameters();
            for (int i = 0; i < params.size(); i++) {
              Parameter p = (Parameter) params.get(i);
              ct.addAttribute( new Attribute(p));
            }
            ct.addAttribute( new Attribute(_Coordinate.TransformType, "Projection"));
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

          data1[i] = numY0 + i*ddx;
        dataA = Array.factory(DataType.DOUBLE.getPrimitiveClassType(), new int[] {numY}, data1);
        yaxis.setCachedData( dataA, false);
        ncfile.addVariable(null, yaxis);

        ProjectionImpl projection = new FlatEarth(lat_min, lon_max);
        //ProjectionImpl projection = new LambertConformal(latitude, longitude, latitude, latitude);
        // coordinate transform variable
        Variable ct = new Variable( ncfile, null, null, projection.getClassName());
        ct.setDataType( DataType.CHAR);
        ct.setDimensions( "");
        List params = projection.getProjectionParameters();
        for (int i = 0; i < params.size(); i++) {
          Parameter p = (Parameter) params.get(i);
          ct.addAttribute( new Attribute(p));
        }
        ct.addAttribute( new Attribute(_Coordinate.TransformType, "Projection"));
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

      double height = readAttributeDouble( ctv, "height_from_earth_center", Double.NaN);
      double scale_x = readAttributeDouble( ctv, "scale_x", Double.NaN);
      double scale_y = readAttributeDouble( ctv, "scale_y", Double.NaN);

      //ProjectionImpl proj = new ucar.unidata.geoloc.projection.sat.MSGnavigation(lat0, lon0, major_axis, minor_axis, height, scale_x, scale_y);
      ProjectionImpl proj = new ucar.unidata.geoloc.projection.sat.MSGnavigation(lat0, lon0, minor_axis, major_axis, height, scale_x, scale_y)// LOOK WTF?
      return new ProjectionCT(ctv.getShortName(), "FGDC", proj);
    }
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

                return new ucar.unidata.geoloc.projection.LatLonProjection();
            } else {
                String         projectionType = srp.getProjectionType();
                double         falseEasting   = 0;
                double         falseNorthing  = 0;
                ProjectionImpl proj           = null;
                if (srp.hasParameter("False_Easting")) {
                    falseEasting = srp.getParameter("False_Easting");
                }
                if (srp.hasParameter("False_Northing")) {
                    falseNorthing = srp.getParameter("False_Northing");
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

    for (ucar.nc2.dt.GridDataset.Gridset g : gds.getGridsets()) {
      GridCoordSystem gsys = g.getGeoCoordSystem();
      for (CoordinateTransform t : gsys.getCoordinateTransforms()) {
        if (t instanceof ProjectionCT) {
          ncd.findVariable(t.getName());
          ProjectionImpl p = ((ProjectionCT)t).getProjection();
          map.put(t.getName()+" "+p.paramsToString(), new HoldEm(gsys, p, ncd.findVariable(t.getName())));
        }
      }
    }

    for (String key : map.keySet()) {
View Full Code Here

Examples of ucar.unidata.geoloc.ProjectionImpl

  public void testPSscaleFactor() throws IOException {
    String filename = testDir+ "stereographic/foster.grib2";
    NetcdfDataset ncd = NetcdfDataset.openDataset(filename);
    GridDataset gds = new GridDataset(ncd);
    GridCoordSystem gsys = null;
    ProjectionImpl p = null;

    for (ucar.nc2.dt.GridDataset.Gridset g : gds.getGridsets()) {
      gsys = g.getGeoCoordSystem();
      for (CoordinateTransform t : gsys.getCoordinateTransforms()) {
        if (t instanceof ProjectionCT) {
          p = ((ProjectionCT)t).getProjection();
          break;
        }
      }
    }

    CoordinateAxis1D xaxis = (CoordinateAxis1D) gsys.getXHorizAxis();
    CoordinateAxis1D yaxis =  (CoordinateAxis1D) gsys.getYHorizAxis();
    p.projToLatLon(xaxis.getCoordValue(0), yaxis.getCoordValue(0)  );
    LatLonPointImpl start1 =  p.projToLatLon(xaxis.getCoordValue(0), yaxis.getCoordValue(0));
    LatLonPointImpl start2 =  p.projToLatLon(xaxis.getCoordValue((int)xaxis.getSize()-1), yaxis.getCoordValue((int)yaxis.getSize()-1));
    System.out.printf( "start = %f %f%n", start1.getLatitude(), start1.getLongitude());
    System.out.printf( "end = %f %f%n", start2.getLatitude(), start2.getLongitude());
   
    /*
    wgrib2 /data/laps/lapsprd/gr2/102711000.gr2 -ijlat 358 353 -d 1
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.