Examples of ResponsePAZ


Examples of eu.admire.seismo.common.ResponsePAZ

       List<ResponsePAZ> responses=new ArrayList<ResponsePAZ>()
       int i=0;
       parametersMap = new HashMap<String,String>();
       while((tuple= (Tuple)tupleListIterator.nextValue())!= null){
         System.out.println("in iteration tuple");
        ResponsePAZ response= new ResponsePAZ();
        response.setName(tuple.getString(tupleMetadata,NAME));
        response.setGain(tuple.getDouble(tupleMetadata,GAIN));
        response.setGainFreq(tuple.getDouble(tupleMetadata,GAIN_FREQUENCY));
          Blob zerosB=tuple.getBlob(tupleMetadata,ZEROS);
          Blob polesB=tuple.getBlob(tupleMetadata,POLES);
        response.setZeros(zerosB.getBytes(1, (int) zerosB.length()));
          response.setPoles(polesB.getBytes(1, (int) polesB.length()));
      responses.add(response);
      JSONSerializer serializer = new JSONSerializer();
      parametersMap.put("response"+i, URLEncoder.encode(serializer.serialize(response),"UTF-8"));
      i++;
       }
View Full Code Here

Examples of eu.admire.seismo.common.ResponsePAZ

           //   throw new  ActivityUserException(new Throwable("response file not available"));
      System.out.println("response file not available");
     
      }
      else{
      ResponsePAZ resPAZ=parseResp(respFiles[0]);
   
      //List <Tuple> tuples=new ArrayList<Tuple>();
      //for(ResponsePAZ resPAZ:res){
        Tuple t= makeTuple(resPAZ.getName(),resPAZ.getGain(),resPAZ.getGainFreq(),new SimpleBlob(prettyPrintComplex(resPAZ.getZeros())),new SimpleBlob(prettyPrintComplex(resPAZ.getPoles())));
            tuples.add(t);
      }
          MetadataWrapper metadataWrapper=new MetadataWrapper(makeTupleMetadata(new String[]{ NAME, GAIN,GAIN_FREQUENCY,ZEROS,POLES},
                      new int[] { TupleTypes._STRING, TupleTypes._DOUBLE,TupleTypes._DOUBLE,TupleTypes._ODBLOB,TupleTypes._ODBLOB }));
      //}  
View Full Code Here

Examples of eu.admire.seismo.common.ResponsePAZ

   
  }
 
  protected ResponsePAZ parseResp(File file) throws IOException{
    ResponsePAZ resPAZ=new ResponsePAZ();
    Scanner sc = new Scanner(file);
    System.out.println("in parse resp");
    try{
      StringBuffer name= new StringBuffer("");
      List<Complex>zeros=new ArrayList<Complex>();
      List<Complex>poles=new ArrayList<Complex>();
      //int numZeros;
      //int numPoles;
      while (sc.hasNextLine()&&resPAZ.getGainFreq()==null) {
       // System.out.println(sc.nextLine());
        String currentLine=sc.nextLine();
      //  System.out.println(currentLine);
        if(currentLine.startsWith("B050F03")){
          String[] tokens= currentLine.split("Station:\\s+");
          name.append(tokens[1].trim()).append(".");         
        }
        if(currentLine.startsWith("B050F16")){
          String[] tokens= currentLine.split("Network:\\s+");
          name.append(tokens[1].trim()).append(".");
        }
        if(currentLine.startsWith("B052F04")){
          String[] tokens= currentLine.split("Channel:\\s+");
          name.append(tokens[1].trim()).append(".");
           
        }
        if(currentLine.startsWith("B052F22")){
          String[] tokens= currentLine.split("Start date:\\s+");
          name.append(tokens[1].trim());
         
          resPAZ.setName(name.toString());
        }
        if(currentLine.startsWith("B053F10-13")){
          String[] tokens= currentLine.split("\\s+");
        
          Complex zero=new Complex(new Double(tokens[2].trim()), new Double(tokens[3].trim()));
          zeros.add(zero);         
        }
        if(currentLine.startsWith("B053F15-18")){
              String[] tokens= currentLine.split("\\s+");
             
          Complex pole=new Complex(new Double(tokens[2].trim()), new Double(tokens[3].trim()));
          poles.add(pole);         
        }
        if(currentLine.startsWith("B058F04")){
          String[] tokens= currentLine.split("Gain:\\s+");
         
          resPAZ.setGain(new Double(tokens[1].trim()));
        }
        if(currentLine.startsWith("B058F05")){
          String[] tokens= currentLine.split("\\s+");
         
          resPAZ.setGainFreq(new Double(tokens[4].trim()));
          //break;
        }
      
      }
      resPAZ.setZeros(zeros);
      resPAZ.setPoles(poles);
      }
    finally{
      sc.close();
    }
    return resPAZ;
View Full Code Here

Examples of eu.admire.seismo.common.ResponsePAZ

 
  @Test
  public void parseFile() throws IOException{
    RespReaderActivity respReader=new RespReaderActivity();
    File respFile=new File("/Users/ltrani/seismo/BGS/CAL/RESP.GB.BATH.00.HHE");
    ResponsePAZ rPAZ=respReader.parseResp(respFile);
    System.out.println(rPAZ.getName());
    System.out.println(rPAZ.getGain());
    System.out.println(rPAZ.getGainFreq());
    System.out.println(rPAZ.printPoles());
    System.out.println(rPAZ.printZeros());
  }
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.