Examples of Grib2Pds


Examples of ucar.grib.grib2.Grib2Pds

    boolean passOne = true;
    for (int i = 0; i < products.size(); i++) {
      Grib2Product product = products.get(i);
      raf.seek(product.getPdsOffset());
      PdsReader2 pds = new PdsReader2(raf);
      Grib2Pds gpv = pds.pdsVars;
      if (passOne) {
        System.out.println(" Section = " + gpv.getSection());
        System.out.println(" Length = " + gpv.getLength());
        System.out.println(" ProductDefinition = " + gpv.getProductDefinitionTemplate());
        passOne = false;
      }

      assert (pds.length == gpv.getLength());
      assert (pds.section == gpv.getSection());
      assert (pds.coordinates == gpv.getNumberCoordinates());
      assert (pds.productDefinition == gpv.getProductDefinitionTemplate());
      assert (pds.parameterCategory == gpv.getParameterCategory());
      assert (pds.parameterNumber == gpv.getParameterNumber());
      if (pds.productDefinition < 20) {  // NCEP models
        assert (pds.typeGenProcess == gpv.getGenProcessType());
        assert (pds.timeRangeUnit == gpv.getTimeUnit());
        //System.out.println( i +" "+ pds.forecastTime +" "+ gpv.getForecastTime());
        assert (pds.forecastTime == gpv.getForecastTime());
        assert (pds.typeFirstFixedSurface == gpv.getLevelType1());
        assert (pds.FirstFixedSurfaceValue == gpv.getLevelValue1());
        assert (pds.typeSecondFixedSurface == gpv.getLevelType2());
        assert (pds.SecondFixedSurfaceValue == gpv.getLevelValue2());
      }

      if ((pds.productDefinition == 1) || (pds.productDefinition == 11)) {
        assert (pds.typeEnsemble == gpv.getPerturbationType());
        assert (pds.perturbNumber == gpv.getPerturbationNumber());
        assert (pds.numberForecasts == gpv.getNumberEnsembleForecasts());

      } else if (pds.productDefinition == 2) {
        assert (pds.typeEnsemble == gpv.getPerturbationType());
        assert (pds.numberForecasts == gpv.getNumberEnsembleForecasts());

      } else if (pds.productDefinition == 5) {
        assert (pds.typeEnsemble == gpv.getPerturbationType());
        assert (pds.lowerLimit == gpv.getProbabilityLowerLimit());
        assert (pds.upperLimit == gpv.getProbabilityUpperLimit());

      } else if (pds.productDefinition == 9) {
        assert (pds.typeEnsemble == gpv.getPerturbationType());
        assert (pds.numberForecasts == gpv.getNumberEnsembleForecasts());
        // probability type
        assert (pds.lowerLimit == gpv.getProbabilityLowerLimit());
        assert (pds.upperLimit == gpv.getProbabilityUpperLimit());
      }
      pds = null;
    }
    products = null;
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    }

    if (lookup instanceof Grib2GridTableLookup) {
      Grib2GridTableLookup g2lookup = (Grib2GridTableLookup) lookup;
      GribGridRecord ggr = (GribGridRecord) firstRecord;
      Grib2Pds pds2 = (Grib2Pds) ggr.getPds();

      int[] paramId = g2lookup.getParameterId(firstRecord);
      v.addAttribute(new Attribute("GRIB_param_discipline", lookup.getDisciplineName(firstRecord)));
      v.addAttribute(new Attribute("GRIB_param_category", lookup.getCategoryName(firstRecord)));
      v.addAttribute(new Attribute("GRIB_param_name", param.getName()));
      v.addAttribute(new Attribute("GRIB_generating_process_type", g2lookup.getGenProcessTypeName(firstRecord)));
      v.addAttribute(new Attribute("GRIB_param_id", Array.factory(int.class, new int[]{paramId.length}, paramId)));
      v.addAttribute(new Attribute("GRIB_product_definition_template", pds2.getProductDefinitionTemplate()));
      v.addAttribute(new Attribute("GRIB_product_definition_template_desc", Grib2Tables.codeTable4_0( pds2.getProductDefinitionTemplate())));
      v.addAttribute(new Attribute("GRIB_level_type", new Integer(pds2.getLevelType1())));
      v.addAttribute(new Attribute("GRIB_level_type_name", lookup.getLevelName(firstRecord)));
      if (pds2.isInterval())
        v.addAttribute(new Attribute("GRIB_interval_stat_type", ggr.getStatisticalProcessTypeName() ));
      if (pds2.isEnsembleDerived()) {
        Grib2Pds.PdsEnsembleDerived pdsDerived = (Grib2Pds.PdsEnsembleDerived) pds2;
        v.addAttribute(new Attribute("GRIB_ensemble_derived_type", new Integer(pdsDerived.getDerivedForecastType()) ));
      }
      if (pds2.isEnsemble())
        v.addAttribute(new Attribute("GRIB_ensemble", "true"));
      if (pds2.isProbability()) {
        Grib2Pds.PdsProbability pdsProb = (Grib2Pds.PdsProbability) pds2;
        v.addAttribute(new Attribute("GRIB_probability_type", new Integer(pdsProb.getProbabilityType()) ));
        v.addAttribute(new Attribute("GRIB_probability_lower_limit", new Double(pdsProb.getProbabilityLowerLimit()) ));
        v.addAttribute(new Attribute("GRIB_probability_upper_limit", new Double(pdsProb.getProbabilityUpperLimit()) ));
      }
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    if (firstRecord instanceof GribGridRecord) {
      GribGridRecord ggr = (GribGridRecord) firstRecord;

      if (ggr.getEdition() == 2) {
        Grib2Pds pds2 = (Grib2Pds) ggr.getPds();
        String useGenType = pds2.getUseGenProcessType();
        if (useGenType != null)
          f.format("_%s", useGenType);
      }

      String suffixName = ggr.makeSuffix( );
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

  }

  private GridParameter getParameter() {
    GridParameter p = null;
      if (edition == 2) {
        Grib2Pds pds2 = (Grib2Pds) pds;
        p = ParameterTable.getParameter(discipline, pds2.getParameterCategory(), pds.getParameterNumber());

      } else {
        GribPDSParamTable pt = null;
        try {
          pt = GribPDSParamTable.getParameterTable(center, subCenter, tableVersion);
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

        result += result * 37 + getParameterName().hashCode();
        String statName = getStatisticalProcessTypeNameShort();
        if (statName != null) result += result * 37 + statName.hashCode();

      } else {
        Grib2Pds pds2 = (Grib2Pds) pds;
        int productTemplate = pds2.getProductDefinitionTemplate();

        result += result * 37 + discipline;
        result += result * 37 + getLevelType1();
        result += result * 37 + pds2.getParameterCategory();
        result += result * 37 + productTemplate;
        String statName = getStatisticalProcessTypeNameShort();
        if (statName != null) result += result * 37 + statName.hashCode();

        result += result * 37 +  getLevelType2(); // ??
        result += result * 37 + pds2.getParameterNumber();
        String useGenType = pds2.getUseGenProcessType();
        if (useGenType != null) result += result * 37 + useGenType.hashCode();

        if (pds2.isEnsembleDerived()) {
          Grib2Pds.PdsEnsembleDerived pdsDerived = (Grib2Pds.PdsEnsembleDerived) pds2;
          result += result * 37 + pdsDerived.getDerivedForecastType(); // derived type (table 4.7)

        } else if (pds2.isEnsemble()) {
          result += result * 37 + 1;
        }

        if (pds2.isProbability()) {
          Grib2Pds.PdsProbability pdsProb = (Grib2Pds.PdsProbability) pds2;
          String name = getProbabilityVariableNameSuffix(pdsProb.getProbabilityLowerLimit(), pdsProb.getProbabilityUpperLimit(), pdsProb.getProbabilityType());
          result +=  result * 37 + name.hashCode();
        }
      }
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    Formatter f = new Formatter();
    String desc = getParameterDescription();
    f.format("%s", desc);

    if (edition == 2) {
      Grib2Pds pds2 = (Grib2Pds) pds;
      String useGenType = pds2.getUseGenProcessType();
      if (useGenType != null)
        f.format("_%s", useGenType);
    }

    if (useLevel) {
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

       f.format("_%s", statName);
       disambig = true;
    }

    if (edition == 2) {
       Grib2Pds pds2 = (Grib2Pds) pds;

       if (pds2.isEnsembleDerived()) {
         Grib2Pds.PdsEnsembleDerived pdsDerived = (Grib2Pds.PdsEnsembleDerived) pds2;
         int type = pdsDerived.getDerivedForecastType(); // derived type (table 4.7)
         f.format("_%s", Grib2Tables.codeTable4_7short(type));
         disambig = true;

       } else if (pds2.isProbability()) {
         Grib2Pds.PdsProbability pdsProb = (Grib2Pds.PdsProbability) pds2;
         String name = getProbabilityVariableNameSuffix(pdsProb.getProbabilityLowerLimit(), pdsProb.getProbabilityUpperLimit(), pdsProb.getProbabilityType());
         f.format("_%s", name);
         disambig = true;
       }
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    List<GridRecord> grList = index.getGridRecords();
    for (GridRecord gr : grList) {
      GribGridRecord ggr = (GribGridRecord) gr;
      int genType = ggr.getPds().getGenProcessId();
      if (!isGrib1) {
        Grib2Pds pds =  (Grib2Pds) ggr.getPds();
        genType = pds.getGenProcessType();
      }
      List<String> uses = map.get(genType);
      if (uses == null) {
        uses = new ArrayList<String>();
        map.put(genType, uses);
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    List<GridRecord> grList = index.getGridRecords();
    for (GridRecord gr : grList) {
      GribGridRecord ggr = (GribGridRecord) gr;
      if (!ggr.isInterval()) continue;

      Grib2Pds pds = (Grib2Pds) ggr.getPds();
      Grib2Pds.PdsInterval pdsIntv = (Grib2Pds.PdsInterval) pds;
      for (Grib2Pds.TimeInterval intv : pdsIntv.getTimeIntervals()) {
        int val = intv.timeIncrementType;
        List<String> uses = map.get(val);
        if (uses == null) {
View Full Code Here

Examples of ucar.grib.grib2.Grib2Pds

    List<GridRecord> grList = index.getGridRecords();
    for (GridRecord gr : grList) {
      GribGridRecord ggr = (GribGridRecord) gr;
      if (!ggr.isInterval()) continue;

      Grib2Pds pds = (Grib2Pds) ggr.getPds();
      System.out.printf(" ref=%s fore=%s%n", df.toDateTimeStringISO(gr.getReferenceTime()), df.toDateTimeStringISO(pds.getForecastDate()));

      Grib2Pds.PdsInterval pdsIntv = (Grib2Pds.PdsInterval) pds;
      long timeEnd = pdsIntv.getIntervalTimeEnd();
      int[] intv = pds.getForecastTimeInterval();
      long startDate = Grib2Pds.makeDate(gr.getReferenceTime().getTime(), pds.getTimeUnit(), intv[0], cal);
      long endDate = Grib2Pds.makeDate(gr.getReferenceTime().getTime(), pds.getTimeUnit(), intv[1], cal);

      System.out.printf("  intv=[%s, %s] = [%d,%d]%n",  df.toDateTimeStringISO(new Date(startDate)),
              df.toDateTimeStringISO(new Date(endDate)), intv[0], intv[1]);
      System.out.printf("  timeEnd=%s", df.toDateTimeStringISO(new Date(timeEnd)));
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.