VLab Issue #3720 - NCEP EDEX and EDEX Common delivery for 14.3.1
Table updates for GRIB decoding; Updates to gpd, mcidas, pafm, and pgen plugins Change-Id: Ic6874210998d7f5a6b164ef45c6918246388ee68 Former-commit-id:ca9b7c8dfc
[formerlybd2dad11b5
[formerly 3c904361e7176592cc873a3414c18ad5107aea54]] Former-commit-id:bd2dad11b5
Former-commit-id:4602f86f47
This commit is contained in:
parent
2e687fbfb7
commit
80c8dae07c
50 changed files with 11509 additions and 11271 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
31,HAR,126,HARRISBURG,PA,US,40.23,-77.02
|
||||
32,DCA,306,WASHINGTON,DC,US,38.86,-77.04
|
||||
33,RIC,229,RICHMOND,VA,US,37.5,-77.32
|
||||
34,CSN,299,CASSANOVA,VA,US,38.64,-77.87
|
||||
34,CSN,299,CASANOVA,VA,US,38.64,-77.87
|
||||
35,ILM,135,WILMINGTON,NC,US,34.35,-77.87
|
||||
36,SLT,252,SLATE_RUN,PA,US,41.51,-77.97
|
||||
37,PSB,368,PHILLIPSBURG,PA,US,40.92,-77.99
|
||||
|
@ -50,7 +50,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
49,EWC,326,ELLWOOD_CITY,PA,US,40.83,-80.21
|
||||
50,ERI,92,ERIE,PA,US,42.02,-80.3
|
||||
51,MIA,176,MIAMI,FL,US,25.8,-80.3
|
||||
52,VRB,276,VERO_BEACH,FL,US,27.68,-80.49
|
||||
52,TRV,276,TREASURE,FL,US,27.68,-80.49
|
||||
53,PSK,369,DUBLIN,VA,US,37.09,-80.71
|
||||
54,AIR,280,BELLAIRE,OH,US,40.02,-80.82
|
||||
55,CLT,59,CHARLOTTE,NC,US,35.22,-80.93
|
||||
|
@ -62,7 +62,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
61,ORL,204,ORLANDO,FL,US,28.54,-81.34
|
||||
62,CRG,298,JACKSONVILLE,FL,US,30.34,-81.51
|
||||
63,EYW,96,KEY_WEST,FL,US,24.59,-81.8
|
||||
64,FMY,104,FT_MEYERS,FL,US,26.58,-81.87
|
||||
64,RSW,104,LEE_COUNTY,FL,US,26.53,-81.78
|
||||
65,SPA,380,SPARTANBURG,SC,US,35.03,-81.93
|
||||
66,HNN,339,HENDERSON,WV,US,38.75,-82.03
|
||||
67,HMV,337,HOLSTON_MOUNTAIN,TN,US,36.44,-82.13
|
||||
|
@ -83,7 +83,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
82,ROD,373,ROSEWOOD,OH,US,40.29,-84.04
|
||||
83,MBS,168,SAGINAW,MI,US,43.53,-84.08
|
||||
84,LOZ,160,LONDON,KY,US,37.03,-84.12
|
||||
85,ABY,4,ALBANY,GA,US,31.65,-84.3
|
||||
85,PZD,4,PECAN,GA,US,31.66,-84.29
|
||||
86,SSM,255,SAULT_STE_MARIE,MI,US,46.41,-84.31
|
||||
87,TLH,264,TALLAHASSEE,FL,US,30.56,-84.37
|
||||
88,ATL,19,ATLANTA,GA,US,33.63,-84.44
|
||||
|
@ -93,7 +93,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
92,LGC,350,LA_GRANGE,GA,US,33.05,-85.21
|
||||
93,GRR,332,GRAND_RAPIDS,MI,US,42.79,-85.5
|
||||
94,TVC,270,TRAVERSE_CITY,MI,US,44.67,-85.55
|
||||
95,LOU,159,LOUISVILLE,KY,US,38.1,-85.58
|
||||
95,IIU,159,LOUISVILLE,KY,US,38.1,-85.58
|
||||
96,MKG,179,MUSKEGON,MI,US,43.17,-86.04
|
||||
97,PMM,366,PULLMAN,MI,US,42.47,-86.11
|
||||
98,GIJ,330,NILES,MI,US,41.77,-86.32
|
||||
|
@ -115,7 +115,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
114,SJI,378,SEMMNES,AL,US,30.73,-88.36
|
||||
115,IGB,133,BIGBEE,MS,US,33.48,-88.52
|
||||
116,MEI,172,MERIDIAN,MS,US,32.38,-88.8
|
||||
117,DEC,70,DECATUR,IL,US,39.74,-88.86
|
||||
117,AXC,70,ADDERS,IL,US,39.74,-88.86
|
||||
118,YQT,393,THUNDER_BAY,ON,CN,48.37,-89.32
|
||||
119,DYR,83,DYERSBURG,TN,US,36.02,-89.32
|
||||
120,RHI,228,RHINELANDER,WI,US,45.63,-89.45
|
||||
|
@ -123,8 +123,8 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
122,DLL,310,DELLS,WI,US,43.55,-89.76
|
||||
123,MEM,173,MEMPHIS,TN,US,35.06,-89.98
|
||||
124,LEV,349,GRAND_ISLE,LA,US,29.18,-90.1
|
||||
125,JAN,142,JACKSON,MS,US,32.51,-90.17
|
||||
126,MSY,195,NEW_ORLEANS,LA,US,30,-90.27
|
||||
125,MHZ,142,MAGNOLIA,MS,US,32.43,-90.1
|
||||
126,HRV,195,HARVEY,LA,US,29.85,-90
|
||||
127,FAM,97,FARMINGTON,MO,US,37.67,-90.23
|
||||
128,MCB,169,MC_COMB,MS,US,31.3,-90.26
|
||||
129,SQS,381,SIDON,MS,US,33.46,-90.28
|
||||
|
@ -156,7 +156,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
155,FSM,108,FT_SMITH,AR,US,35.38,-94.27
|
||||
156,FOD,105,FT_DODGE,IA,US,42.61,-94.29
|
||||
157,BUM,45,BUTLER,MO,US,38.27,-94.49
|
||||
158,MKC,177,KANSAS_CITY,MO,US,39.28,-94.59
|
||||
158,MCI,177,KANSAS_CITY,MO,US,39.29,-94.74
|
||||
159,LFK,155,LUFKIN,TX,US,31.16,-94.72
|
||||
160,GGG,115,LONGVIEW,TX,US,32.42,-94.75
|
||||
161,BJI,33,BEMIDJI,MN,US,47.58,-95.02
|
||||
|
@ -170,7 +170,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
169,PSX,219,PALACIOS,TX,US,28.76,-96.31
|
||||
170,FSD,107,SIOUX_FALLS,SD,US,43.65,-96.78
|
||||
171,FAR,98,FARGO,ND,US,46.75,-96.85
|
||||
172,DFW,72,DALLAS-FT_WORTH,TX,US,32.87,-97.03
|
||||
172,TTT,72,MAVERICK,TX,US,32.87,-97.04
|
||||
173,ADM,8,ARDMORE,OK,US,34.21,-97.17
|
||||
174,GFK,114,GRAND_FORKS,ND,US,47.95,-97.19
|
||||
175,YWG,397,WINNIPEG,MB,CN,49.9,-97.23
|
||||
|
@ -180,7 +180,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
179,ICT,132,WICHITA,KS,US,37.75,-97.58
|
||||
180,OKC,198,OKLAHOMA_CITY,OK,US,35.36,-97.61
|
||||
181,SLN,251,SALINA,KS,US,38.93,-97.62
|
||||
182,AUS,20,AUSTIN,TX,US,30.3,-97.7
|
||||
182,CWK,20,CENTEX,TX,US,30.38,-97.53
|
||||
183,END,321,VANCE_AFB,OK,US,36.35,-97.92
|
||||
184,OBH,358,WOLBACH,NE,US,41.38,-98.35
|
||||
185,ABR,3,ABERDEEN,SD,US,45.42,-98.37
|
||||
|
@ -190,7 +190,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
189,LRD,161,LAREDO,TX,US,27.48,-99.42
|
||||
190,JCT,144,JUNCTION,TX,US,30.6,-99.82
|
||||
191,ABI,1,ABILENE,TX,US,32.48,-99.86
|
||||
192,GAG,110,GAGE,OK,US,36.34,-99.88
|
||||
192,MMB,110,MITBEE,OK,US,36.34,-99.88
|
||||
193,ANW,282,AINSWORTH,NE,US,42.57,-99.99
|
||||
194,PIR,214,PIERRE,SD,US,44.4,-100.17
|
||||
195,HLC,335,HILL_CITY,KS,US,39.26,-100.23
|
||||
|
@ -222,11 +222,11 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
221,ISN,140,WILLISTON,ND,US,48.18,-103.63
|
||||
222,MRF,190,MARFA,TX,US,30.3,-103.95
|
||||
223,PUB,220,PUEBLO,CO,US,38.29,-104.43
|
||||
224,ROW,233,ROSWELL,NM,US,33.34,-104.62
|
||||
224,CME,233,CHISUM,NM,US,33.34,-104.62
|
||||
225,DEN,71,DENVER,CO,US,39.81,-104.66
|
||||
226,CYS,301,CHEYENNE,WY,US,41.21,-104.77
|
||||
227,CIM,297,CIMARRON,NM,US,36.49,-104.87
|
||||
228,LVS,163,LAS_VEGAS,NM,US,35.66,-105.14
|
||||
228,FTI,163,FT_UNION,NM,US,35.66,-105.14
|
||||
229,LAR,148,LARAMIE,WY,US,41.33,-105.72
|
||||
230,ALS,13,ALAMOSA,CO,US,37.35,-105.82
|
||||
231,MLS,182,MILES_CITY,MT,US,46.38,-105.95
|
||||
|
@ -242,7 +242,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
241,CHE,54,HAYDEN,CO,US,40.52,-107.31
|
||||
242,DMN,76,DEMING,NM,US,32.28,-107.6
|
||||
243,YYN,400,SWIFT_CURRENT,SA,CN,50.28,-107.68
|
||||
244,FMN,103,FARMINGTON,NM,US,36.75,-108.1
|
||||
244,RSK,103,RATTLESNAKE,NM,US,36.75,-108.1
|
||||
245,BOY,290,BOYSEN_RESV.,WY,US,43.46,-108.3
|
||||
246,BIL,31,BILLINGS,MT,US,45.81,-108.63
|
||||
247,JNC,347,GRAND_JUNCTION,CO,US,39.06,-108.79
|
||||
|
@ -312,7 +312,7 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
311,OAK,356,OAKLAND,CA,US,37.73,-122.22
|
||||
312,RBL,225,RED_BLUFF,CA,US,40.1,-122.24
|
||||
313,SEA,243,SEATTLE,WA,US,47.44,-122.31
|
||||
314,BLI,35,BELLINGHAM,WA,US,48.95,-122.58
|
||||
314,HUH,35,WHATCOM,WA,US,48.95,-122.58
|
||||
315,PDX,208,PORTLAND,OR,US,45.58,-122.6
|
||||
316,PYE,371,POINT_REYES,CA,US,38.08,-122.87
|
||||
317,OED,362,MEDFORD,OR,US,42.48,-122.91
|
||||
|
@ -388,3 +388,4 @@ COPY stns.VORS(PKEY, STATION_ID, STATION_NUM, NAME, STATE, COUNTRY, LATITUDE, LO
|
|||
387,LIH,0,LIHUE,HI,US,21.97,-159.34
|
||||
388,SOK,0,SOUTH_KAUAI,HI,US,21.9,-159.53
|
||||
\.
|
||||
|
||||
|
|
|
@ -9010,4 +9010,15 @@
|
|||
<grib2Value>14</grib2Value>
|
||||
</grib1Parameter>
|
||||
<!-- end ukmetHR -->
|
||||
|
||||
<!-- cmc RELH -->
|
||||
<grib1Parameter>
|
||||
<center>54</center>
|
||||
<grib1TableVersion>2</grib1TableVersion>
|
||||
<grib1Value>52</grib1Value>
|
||||
<grib2discipline>0</grib2discipline>
|
||||
<grib2category>1</grib2category>
|
||||
<grib2Value>1</grib2Value>
|
||||
</grib1Parameter>
|
||||
<!-- end CMC -->
|
||||
</grib1ParameterSet>
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
|
||||
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
|
||||
|
||||
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
|
||||
This_software_product_contains_export-restricted_data_whose
|
||||
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
|
||||
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
|
||||
an_export_license_or_other_authorization.
|
||||
|
||||
Contractor_Name:________Raytheon_Company
|
||||
Contractor_Address:_____6825_Pine_Street,_Suite_340
|
||||
________________________Mail_Stop_B8
|
||||
________________________Omaha,_NE_68106
|
||||
________________________402.291.0100
|
||||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<polarStereoGridCoverage>
|
||||
<name>493399001</name>
|
||||
<description>15km HR CMC</description>
|
||||
<la1>32.548</la1>
|
||||
<lo1>-134.62</lo1>
|
||||
<firstGridPointCorner>LowerLeft</firstGridPointCorner>
|
||||
<nx>493</nx>
|
||||
<ny>399</ny>
|
||||
<dx>15</dx>
|
||||
<dy>15</dy>
|
||||
<spacingUnit>km</spacingUnit>
|
||||
<minorAxis>6367470.0</minorAxis>
|
||||
<majorAxis>6367470.0</majorAxis>
|
||||
<lov>-111.0</lov>
|
||||
<lad>60</lad>
|
||||
</polarStereoGridCoverage>
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
|
||||
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
|
||||
|
||||
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
|
||||
This_software_product_contains_export-restricted_data_whose
|
||||
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
|
||||
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
|
||||
an_export_license_or_other_authorization.
|
||||
|
||||
Contractor_Name:________Raytheon_Company
|
||||
Contractor_Address:_____6825_Pine_Street,_Suite_340
|
||||
________________________Mail_Stop_B8
|
||||
________________________Omaha,_NE_68106
|
||||
________________________402.291.0100
|
||||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<polarStereoGridCoverage>
|
||||
<name>825553001</name>
|
||||
<description>ESTOFS HIRES - 6 km Alaska</description>
|
||||
<la1>40.530101</la1>
|
||||
<lo1>-178.571</lo1>
|
||||
<firstGridPointCorner>LowerLeft</firstGridPointCorner>
|
||||
<nx>825</nx>
|
||||
<ny>553</ny>
|
||||
<dx>5.953125</dx>
|
||||
<dy>5.953125</dy>
|
||||
<spacingUnit>km</spacingUnit>
|
||||
<minorAxis>6371229.0</minorAxis>
|
||||
<majorAxis>6371229.0</majorAxis>
|
||||
<lov>-150.0</lov>
|
||||
<lad>60</lad>
|
||||
</polarStereoGridCoverage>
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
|
||||
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
|
||||
|
||||
U.S._EXPORT_CONTROLLED_TECHNICAL_DATA
|
||||
This_software_product_contains_export-restricted_data_whose
|
||||
export/transfer/disclosure_is_restricted_by_U.S._law._Dissemination
|
||||
to_non-U.S._persons_whether_in_the_United_States_or_abroad_requires
|
||||
an_export_license_or_other_authorization.
|
||||
|
||||
Contractor_Name:________Raytheon_Company
|
||||
Contractor_Address:_____6825_Pine_Street,_Suite_340
|
||||
________________________Mail_Stop_B8
|
||||
________________________Omaha,_NE_68106
|
||||
________________________402.291.0100
|
||||
|
||||
See_the_AWIPS_II_Master_Rights_File_("Master_Rights_File.pdf")_for
|
||||
further_licensing_information.
|
||||
-->
|
||||
<mercatorGridCoverage>
|
||||
<name>321225001</name>
|
||||
<description>Extratropical Storm and Tide Operation Forecast System (Hawaii)</description>
|
||||
<la1>18.067</la1>
|
||||
<lo1>-161.525</lo1>
|
||||
<firstGridPointCorner>LowerLeft</firstGridPointCorner>
|
||||
<nx>321</nx>
|
||||
<ny>225</ny>
|
||||
<dx>2.5</dx>
|
||||
<dy>2.5</dy>
|
||||
<spacingUnit>km</spacingUnit>
|
||||
<minorAxis>6371229.0</minorAxis>
|
||||
<majorAxis>6371229.0</majorAxis>
|
||||
<latin>20.0</latin>
|
||||
<la2>23.082</la2>
|
||||
<lo2>-153.969</lo2>
|
||||
</mercatorGridCoverage>
|
|
@ -10,6 +10,26 @@
|
|||
|
||||
<gribModelSet>
|
||||
<!-- SUBCENTER 0 -->
|
||||
<model>
|
||||
<name>estofsHW</name>
|
||||
<center>7</center>
|
||||
<subcenter>4</subcenter>
|
||||
<grid>321225001</grid>
|
||||
<process>
|
||||
<id>14</id>
|
||||
</process>
|
||||
</model>
|
||||
|
||||
<model>
|
||||
<name>estofsAK</name>
|
||||
<center>7</center>
|
||||
<subcenter>4</subcenter>
|
||||
<grid>825553001</grid>
|
||||
<process>
|
||||
<id>14</id>
|
||||
</process>
|
||||
</model>
|
||||
|
||||
<model>
|
||||
<name>estofsPR</name>
|
||||
<center>7</center>
|
||||
|
@ -2390,16 +2410,6 @@
|
|||
|
||||
<!-- END SUBCENTER 2: NCEP ENSEMBLE PRODUCTS -->
|
||||
|
||||
<model>
|
||||
<name>hysplit</name>
|
||||
<center>7</center>
|
||||
<subcenter>3</subcenter>
|
||||
<grid>36928220</grid>
|
||||
<process>
|
||||
<id>3</id>
|
||||
</process>
|
||||
</model>
|
||||
|
||||
<!-- SUBCENTER 4: ENVIRONMENTAL MODELING CENTER -->
|
||||
|
||||
<model>
|
||||
|
|
|
@ -12,6 +12,16 @@
|
|||
|
||||
<!-- SUBCENTER 0 -->
|
||||
|
||||
<model>
|
||||
<name>cmcHR</name>
|
||||
<center>53</center>
|
||||
<subcenter>0</subcenter>
|
||||
<grid>493399001</grid>
|
||||
<process>
|
||||
<id>36</id>
|
||||
</process>
|
||||
</model>
|
||||
|
||||
<model>
|
||||
<name>CanadianModel</name>
|
||||
<center>54</center>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="2.0" encoding="UTF-8" standalone="yes"?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<!--
|
||||
This_software_was_developed_and_/_or_modified_by_Raytheon_Company,
|
||||
pursuant_to_Contract_DG133W-05-CQ-1067_with_the_US_Government.
|
||||
|
|
|
@ -140,5 +140,4 @@
|
|||
<alias base="SP">SPXX</alias>
|
||||
<alias base="IDRL">IDRL</alias>
|
||||
<alias base="SRCS">SRCS</alias>
|
||||
<alias base="NTAT">NTAT</alias>
|
||||
</aliasList>
|
|
@ -355,6 +355,7 @@
|
|||
<alias base="USWRF48hr">SWRU48</alias>
|
||||
<alias base="uW">UREL</alias>
|
||||
<alias base="vW">VREL</alias>
|
||||
<alias base="VAFTAD1hr">VASH01</alias>
|
||||
<alias base="VAPP">VAPR</alias>
|
||||
<alias base="VFLX">VRELFX</alias>
|
||||
<alias base="VFLX1hr">VRELFX01</alias>
|
||||
|
|
175
edexOsgi/com.raytheon.uf.tools.cli/impl/src/pgen/ActivityUtil.py
Normal file
175
edexOsgi/com.raytheon.uf.tools.cli/impl/src/pgen/ActivityUtil.py
Normal file
|
@ -0,0 +1,175 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
##
|
||||
# This script is a collection of utility function to be used for extracting PGEN
|
||||
# products from EDEX and to store PGEN activities to EDEX.
|
||||
#
|
||||
# Users can override the default EDEX server and port name by specifying them
|
||||
# in the $DEFAULT_HOST and $DEFAULT_PORT shell environment variables.
|
||||
#
|
||||
##
|
||||
|
||||
import os
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
import lib.CommHandler as CH
|
||||
|
||||
class ActivityUtil:
|
||||
|
||||
#
|
||||
# Sends a CatalogQuery to the EDEX uEngine to get a list of
|
||||
# PGEN Activity Types, Subtypes, Labels, refTimes, and associated
|
||||
# dataURIs in the pgen database tables.
|
||||
#
|
||||
def getActivityMap(self):
|
||||
script='''import CatalogQuery
|
||||
query = CatalogQuery.CatalogQuery("pgen")
|
||||
query.addReturnedField("activityType")
|
||||
query.addReturnedField("activitySubtype")
|
||||
query.addReturnedField("activityLabel")
|
||||
query.addReturnedField("dataTime.refTime")
|
||||
query.addReturnedField("activityName")
|
||||
query.addReturnedField("dataURI")
|
||||
return query.execute()'''
|
||||
|
||||
service = '/services/pyproductjaxb'
|
||||
host = os.getenv("DEFAULT_HOST", "localhost")
|
||||
port = os.getenv("DEFAULT_PORT", "9581")
|
||||
connection=str(host+":"+port)
|
||||
ch = CH.CommHandler(connection,service)
|
||||
ch.process(script)
|
||||
|
||||
if not ch.isGoodStatus():
|
||||
print ch.formatResponse()
|
||||
exit(1)
|
||||
|
||||
return self.__generateMap( ch.getContents() )
|
||||
|
||||
#
|
||||
# Generates a map of activity types/subtypes, labels, refTimes, and dataURIs from
|
||||
# the XML returned from EDEX uEngine
|
||||
#
|
||||
# The map is a dictionary (dict) of Activity Types in form of "type(subtype)" whose values
|
||||
# are a list of dicts which have keys "activityType", "activityLabel", "dataTime.refTime",
|
||||
# and "dataURI".
|
||||
#
|
||||
def __generateMap(self, xml):
|
||||
aMap = dict()
|
||||
tree = ET.fromstring(xml)
|
||||
for item in tree.iter('items'):
|
||||
record = dict()
|
||||
for attr in item.iter('attributes'):
|
||||
record.update( {attr.attrib['field'] : attr.attrib['value'] } )
|
||||
|
||||
atype = record['activityType']
|
||||
stype = record['activitySubtype']
|
||||
if ( stype != None and len(stype.lstrip()) > 0):
|
||||
atype = atype + "(" + stype.lstrip() + ")"
|
||||
|
||||
if aMap.has_key(atype):
|
||||
aMap[atype].append(record)
|
||||
else:
|
||||
aMap.update( {atype: [record]} )
|
||||
|
||||
return aMap
|
||||
|
||||
#
|
||||
# Compare if a command line string matches an string in activity.
|
||||
# This uses string methods.
|
||||
#
|
||||
def matcher(self, cmdstr, activitystr):
|
||||
|
||||
matched = False
|
||||
if cmdstr == None:
|
||||
matched = True
|
||||
else:
|
||||
if activitystr == None:
|
||||
matched = False;
|
||||
else:
|
||||
realstr = cmdstr.strip("*")
|
||||
if ( cmdstr.startswith("*") ):
|
||||
if ( cmdstr.endswith("*") ):
|
||||
if ( activitystr.find( realstr ) >= 0 ):
|
||||
matched = True
|
||||
else:
|
||||
if activitystr.endswith( realstr):
|
||||
matched = True
|
||||
elif cmdstr.endswith("*"):
|
||||
if activitystr.startswith( realstr):
|
||||
matched = True
|
||||
else:
|
||||
if ( activitystr == cmdstr ):
|
||||
matched = True
|
||||
|
||||
return matched
|
||||
|
||||
#
|
||||
# Compare if a command line string matches an string in activity.
|
||||
# This uses regular expression matching.
|
||||
#
|
||||
# cmdstr - input from command line, could use "*" anywhere to match one or more character.
|
||||
# activitystr - value saved in PGEN DB for an activity, such as type, label, ...
|
||||
#
|
||||
def stringMatcher(self, cmdstr, activitystr):
|
||||
|
||||
matched = False
|
||||
|
||||
if cmdstr == None:
|
||||
matched = True
|
||||
elif activitystr == None:
|
||||
matched = False
|
||||
else:
|
||||
#parenthese should be escaped.
|
||||
ps = cmdstr.replace("(", "\(")
|
||||
pe = ps.replace(")", "\)")
|
||||
|
||||
# "*" could match any one or more characters.
|
||||
pn = pe.replace("*", "(.*)")
|
||||
|
||||
mb = re.match(pn, activitystr)
|
||||
if mb != None:
|
||||
matched = True
|
||||
|
||||
return matched
|
||||
|
||||
#
|
||||
# This method sends a CatalogQuery request to the EDEX uEngine
|
||||
# for the dataURI associated with the given activity type and label
|
||||
#
|
||||
def getDataURI( self, atype, label):
|
||||
|
||||
script='''import CatalogQuery
|
||||
query = CatalogQuery.CatalogQuery("pgen")
|
||||
query.addConstraint("activityType","{0}","=")
|
||||
query.addConstraint("activityLabel","{1}","=")
|
||||
query.addReturnedField("dataURI")
|
||||
query.addReturnedField("dataTime.refTime")
|
||||
return query.execute()'''.format(atype,label)
|
||||
|
||||
|
||||
service = '/services/pyproductjaxb'
|
||||
host = os.getenv("DEFAULT_HOST", "localhost")
|
||||
port = os.getenv("DEFAULT_PORT", "9581")
|
||||
connection=str(host+":"+port)
|
||||
ch = CH.CommHandler(connection,service)
|
||||
ch.process(script)
|
||||
|
||||
if not ch.isGoodStatus():
|
||||
print ch.formatResponse()
|
||||
exit(1)
|
||||
|
||||
logger.debug( ch.getContents() )
|
||||
return __parseResponse( ch.getContents() )
|
||||
|
||||
#
|
||||
# Parses the XML response from the uEngine and extracts
|
||||
# the value for the dataURI field. If multiple are returned, the last
|
||||
# one is used.
|
||||
#
|
||||
def __parseResponse(self, xml):
|
||||
tree = ET.fromstring(xml)
|
||||
for attr in tree.iter('attributes'):
|
||||
if attr.attrib['field'] == 'dataURI':
|
||||
duri = attr.attrib['value']
|
||||
|
||||
return duri
|
|
@ -11,6 +11,7 @@ class ProductRetriever:
|
|||
def __init__(self,dataURI,label):
|
||||
self.dataURI = dataURI
|
||||
self.label = label
|
||||
self.fullpath = False
|
||||
self.outdir = os.getcwd()
|
||||
self.host = os.getenv("DEFAULT_HOST", "localhost")
|
||||
self.port = os.getenv("DEFAULT_PORT", "9581")
|
||||
|
@ -19,6 +20,9 @@ class ProductRetriever:
|
|||
def setOutputDir(self, outdir):
|
||||
self.outdir = outdir
|
||||
|
||||
def setFullpath(self, fullpath):
|
||||
self.fullpath = fullpath
|
||||
|
||||
def _writeout(self,filename,bytes):
|
||||
outname = self.outdir + str(os.sep) + filename
|
||||
f = open(outname,"wb")
|
||||
|
@ -40,11 +44,17 @@ class ProductRetriever:
|
|||
else:
|
||||
filename = item.getName()
|
||||
|
||||
print "Extracting... " + filename
|
||||
if ( self.fullpath ):
|
||||
path = self.dataURI
|
||||
fname = path.replace("/", ".") + "$" + filename
|
||||
filename = fname.lstrip().strip(".").replace("..", ".")
|
||||
|
||||
|
||||
if isinstance(item, StringDataRecord):
|
||||
self._writeout(filename,item.getStringData()[0])
|
||||
elif isinstance(item, ByteDataRecord):
|
||||
self._writeout(filename,item.getByteData())
|
||||
print "Extracted... " + filename
|
||||
|
||||
return resp
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
##
|
||||
# This script is used to extract PGEN products from EDEX.
|
||||
# It can be run in batch mode by specifying the "-l" and "-t" options on the
|
||||
# command line. Optionally, users can run it in interactive mode by invoking it
|
||||
# with no argument.
|
||||
# It can be run in batch mode by specifying the "-l", "-t", "-d", "-st", "-n", and
|
||||
# "-p" options on the command line. Optionally, users can run it in interactive
|
||||
# mode by invoking it with no argument.
|
||||
#
|
||||
# Users can override the default EDEX server and port name by specifying them
|
||||
# in the $DEFAULT_HOST and $DEFAULT_PORT shell environment variables.
|
||||
|
@ -19,6 +19,7 @@ from Tkinter import *
|
|||
from ufpy import UsageArgumentParser
|
||||
import lib.CommHandler as CH
|
||||
import ProductRetriever
|
||||
import ActivityUtil
|
||||
|
||||
logger = None
|
||||
def __initLogger():
|
||||
|
@ -33,68 +34,53 @@ def __initLogger():
|
|||
ch.setFormatter(formatter)
|
||||
logger.addHandler(ch)
|
||||
|
||||
#
|
||||
# Parses command line input and store in "options".
|
||||
#
|
||||
def __parseCommandLine():
|
||||
parser = UsageArgumentParser.UsageArgumentParser(prog='retrieveActivity',description="Retrieve PGEN Activities from EDEX. When invoked without any arguments, retrieveActivity is run in interactive mode.")
|
||||
bgroup = parser.add_argument_group(title='batch',description='For running in scripts and/or batch mode.')
|
||||
|
||||
bgroup.add_argument("-l", action="store", dest="label",
|
||||
bgroup.add_argument("-l*", action="store", dest="label",
|
||||
help="Activity Label being requested",
|
||||
required=False, metavar="label")
|
||||
bgroup.add_argument("-t", action="store", dest="type",
|
||||
bgroup.add_argument("-t*", action="store", dest="type",
|
||||
help="Activity Type being requested",
|
||||
required=False, metavar="type")
|
||||
bgroup.add_argument("-st", action="store", dest="subtype",
|
||||
help="Activity Subtype being requested",
|
||||
required=False, metavar="subtype")
|
||||
bgroup.add_argument("-d*", action="store", dest="reftime",
|
||||
help="Activity Ref Time being requested (YYYY-MM-DD_HH:MM)",
|
||||
required=False, metavar="reftime")
|
||||
bgroup.add_argument("-n*", action="store", dest="name",
|
||||
help="Activity Name being requested",
|
||||
required=False, metavar="name")
|
||||
bgroup.add_argument("-f", action="store", dest="fullpath",
|
||||
help="Write out XML with full path? (Yes/No)",
|
||||
required=False, metavar="fullpath")
|
||||
|
||||
bgroup = parser.add_argument_group(title='Note',description='Pattern match with "*" is allowed for -l, -t, -d, and -n. E.g, -l "*CCFP*3*" will match any activities whose label contains CCFP and 3.')
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
options.interactive = False
|
||||
if options.label == None and options.type == None :
|
||||
if (options.label == None and options.type == None and
|
||||
options.reftime == None and options.subtype == None and
|
||||
options.fullpath == None and options.name == None):
|
||||
options.interactive = True
|
||||
elif options.label == None or options.type == None :
|
||||
print "Must enter values for both arguments -l and -t"
|
||||
else:
|
||||
if (options.label == None and options.type == None and
|
||||
options.reftime == None and options.name == None):
|
||||
print "Must enter values for at least one of -l, -t, -d, or -n"
|
||||
exit(0)
|
||||
|
||||
logger.debug("Command-line arguments: " + str(options))
|
||||
return options
|
||||
|
||||
#
|
||||
# This method sends a CatalogQuery request to the EDEX uEngine
|
||||
# for the dataURI associated with the given activity type and label
|
||||
# Main program.
|
||||
#
|
||||
def __getDataURI( type, label):
|
||||
script='''import CatalogQuery
|
||||
query = CatalogQuery.CatalogQuery("pgen")
|
||||
query.addConstraint("activityType","{0}","=")
|
||||
query.addConstraint("activityLabel","{1}","=")
|
||||
query.addReturnedField("dataURI")
|
||||
query.addReturnedField("dataTime.refTime")
|
||||
return query.execute()'''.format(type,label)
|
||||
|
||||
service = '/services/pyproductjaxb'
|
||||
host = os.getenv("DEFAULT_HOST", "localhost")
|
||||
port = os.getenv("DEFAULT_PORT", "9581")
|
||||
connection=str(host+":"+port)
|
||||
ch = CH.CommHandler(connection,service)
|
||||
ch.process(script)
|
||||
|
||||
if not ch.isGoodStatus():
|
||||
print ch.formatResponse()
|
||||
exit(1)
|
||||
|
||||
logger.debug( ch.getContents() )
|
||||
return __parseResponse( ch.getContents() )
|
||||
|
||||
#
|
||||
# Parses the XML response from the uEngine and extracts
|
||||
# the value for the dataURI field. If multiple are returned, the last
|
||||
# one is used.
|
||||
#
|
||||
def __parseResponse(xml):
|
||||
tree = ET.fromstring(xml)
|
||||
for attr in tree.iter('attributes'):
|
||||
if attr.attrib['field'] == 'dataURI':
|
||||
duri = attr.attrib['value']
|
||||
|
||||
return duri
|
||||
|
||||
def main():
|
||||
__initLogger()
|
||||
logger.info("Starting retrieveActivity.")
|
||||
|
@ -109,21 +95,51 @@ def main():
|
|||
app.mainloop()
|
||||
root.destroy()
|
||||
else:
|
||||
# Retrieve products for given activity type and label
|
||||
logger.info("looking for Product: " + options.type + " - " + options.label)
|
||||
dataURI = __getDataURI(options.type, options.label)
|
||||
logger.debug("Found dataURI = " + dataURI)
|
||||
# Retrieve all activities abnd build a map of record using
|
||||
# type(subtype) as key.
|
||||
mu = ActivityUtil.ActivityUtil()
|
||||
activityMap = mu.getActivityMap()
|
||||
|
||||
pr = ProductRetriever.ProductRetriever(dataURI, options.label)
|
||||
outdir = os.getcwd() + str(os.sep) + options.type + str(os.sep) + options.label + str(os.sep)
|
||||
#pr.setOutputDir(outdir)
|
||||
reqtype = None
|
||||
if ( options.type != None ):
|
||||
reqtype = options.type;
|
||||
if ( options.subtype != None ) :
|
||||
reqtype = options.type + "(" + options.subtype + ")"
|
||||
|
||||
records = []
|
||||
for key in activityMap.iterkeys():
|
||||
recs = activityMap[key]
|
||||
for rec in recs:
|
||||
if ( mu.stringMatcher(options.label, rec["activityLabel"]) and
|
||||
mu.stringMatcher(reqtype, key ) and
|
||||
mu.stringMatcher(options.name, rec["activityName"] ) ):
|
||||
#Remove sec.msec from record's refTime
|
||||
dbRefTime = rec["dataTime.refTime"]
|
||||
dotIndex = dbRefTime.rfind(":")
|
||||
if ( dotIndex > 0 ):
|
||||
shortTime = dbRefTime[:dotIndex]
|
||||
else:
|
||||
shortTime = dbRefTime
|
||||
|
||||
#Replace the "_" with a whitespace in reftime.
|
||||
optionTime = options.reftime.replace("_", " ")
|
||||
|
||||
if ( mu.stringMatcher( optionTime, shortTime ) ):
|
||||
records.append( rec )
|
||||
|
||||
for rec in records:
|
||||
pr = ProductRetriever.ProductRetriever(rec["dataURI"], rec["activityLabel"])
|
||||
if options.fullpath != None and options.fullpath.upper().startswith("Y"):
|
||||
pr.setFullpath(True)
|
||||
pr.getProducts()
|
||||
|
||||
#print "Products were written to directory: " + outdir
|
||||
logger.info("retrieveActivity is complete.")
|
||||
|
||||
#
|
||||
# Interactive GUI for PGEN activity retrieval
|
||||
#
|
||||
class RetrieveGui(Frame):
|
||||
""" Interactive GUI for PGEN product retrieval """
|
||||
""" Interactive GUI for PGEN activity retrieval """
|
||||
|
||||
def __init__(self, master=None):
|
||||
""" Initialize Frame and create widgets """
|
||||
|
@ -136,13 +152,14 @@ class RetrieveGui(Frame):
|
|||
# if an activity type and label have been selected, get products and write them out.
|
||||
if len(self.typeList.curselection()) != 0 and len(self.nameList.curselection()) != 0:
|
||||
type = self.typeList.get(self.typeList.curselection())
|
||||
label = self.nameList.get(self.nameList.curselection())
|
||||
labelindex = int(self.nameList.curselection()[0])
|
||||
dataURI = self.activityMap[type][labelindex]['dataURI']
|
||||
|
||||
items = self.nameList.curselection()
|
||||
for i in items :
|
||||
idx = int(i)
|
||||
label = self.nameList.get(idx)
|
||||
dataURI = self.activityMap[type][idx]['dataURI']
|
||||
|
||||
pr = ProductRetriever.ProductRetriever(dataURI, label)
|
||||
#outdir = os.getcwd() + str(os.sep) + options.type + str(os.sep) + options.label + str(os.sep)
|
||||
#pr.setOutputDir(outdir)
|
||||
pr.getProducts()
|
||||
|
||||
def createWidgets(self):
|
||||
|
@ -172,7 +189,7 @@ class RetrieveGui(Frame):
|
|||
frame2 = Frame(self)
|
||||
vscrollbar2 = Scrollbar(frame2, orient=VERTICAL)
|
||||
hscrollbar2 = Scrollbar(frame2, orient=HORIZONTAL)
|
||||
self.nameList = Listbox(frame2,yscrollcommand=vscrollbar2.set,xscrollcommand=hscrollbar2.set,exportselection=0, width=50,height=15,bg="white")
|
||||
self.nameList = Listbox(frame2,yscrollcommand=vscrollbar2.set,xscrollcommand=hscrollbar2.set,exportselection=0, width=50,height=15,bg="white", selectmode=EXTENDED)
|
||||
vscrollbar2.config(command=self.nameList.yview)
|
||||
hscrollbar2.config(command=self.nameList.xview)
|
||||
vscrollbar2.pack(side=RIGHT, fill=Y)
|
||||
|
@ -197,7 +214,7 @@ class RetrieveGui(Frame):
|
|||
# Get all Activity Types and Labels from EDEX for use in selection ListBoxes.
|
||||
# Insert list of Types in Type Listbox
|
||||
#
|
||||
self.activityMap = self.__getActivityMap()
|
||||
self.activityMap = ActivityUtil.ActivityUtil().getActivityMap()
|
||||
self.typeList.delete(0,END)
|
||||
for key in self.activityMap.iterkeys():
|
||||
self.typeList.insert(END,key)
|
||||
|
@ -225,62 +242,8 @@ class RetrieveGui(Frame):
|
|||
def typeList_has_changed(self, index):
|
||||
self.nameList.delete(0,END)
|
||||
for label in self.activityMap[ self.typeList.get(index) ]:
|
||||
#print label
|
||||
self.nameList.insert(END, label['activityLabel'])
|
||||
|
||||
#
|
||||
# Sends a CatalogQuery to the EDEX uEngine to get a list of
|
||||
# PGEN Activity TYpes, Labels, and associated dataURIs
|
||||
# in the pgen database tables.
|
||||
#
|
||||
def __getActivityMap(self):
|
||||
script='''import CatalogQuery
|
||||
query = CatalogQuery.CatalogQuery("pgen")
|
||||
query.addReturnedField("activityType")
|
||||
query.addReturnedField("activityLabel")
|
||||
query.addReturnedField("dataURI")
|
||||
return query.execute()'''
|
||||
|
||||
service = '/services/pyproductjaxb'
|
||||
host = os.getenv("DEFAULT_HOST", "localhost")
|
||||
port = os.getenv("DEFAULT_PORT", "9581")
|
||||
connection=str(host+":"+port)
|
||||
ch = CH.CommHandler(connection,service)
|
||||
ch.process(script)
|
||||
|
||||
if not ch.isGoodStatus():
|
||||
print ch.formatResponse()
|
||||
exit(1)
|
||||
|
||||
logger.debug( ch.getContents() )
|
||||
return self.__generateMap( ch.getContents() )
|
||||
|
||||
#
|
||||
# Generates a map of activity types, label, and dataURIs from
|
||||
# the XML returned from EDEX uEngine for use in the activity type and label
|
||||
# Listboxes.
|
||||
#
|
||||
# The map is a dictionary (dict) of Activity Types whose values are a list of dicts
|
||||
# which have keys "activityType", "activityLabel", and "dataURI".
|
||||
#
|
||||
def __generateMap(self, xml):
|
||||
aMap = dict()
|
||||
tree = ET.fromstring(xml)
|
||||
for item in tree.iter('items'):
|
||||
#print item.attrib['key']
|
||||
record = dict()
|
||||
for attr in item.iter('attributes'):
|
||||
record.update( {attr.attrib['field'] : attr.attrib['value'] } )
|
||||
#print record
|
||||
|
||||
atype = record['activityType']
|
||||
if aMap.has_key(atype):
|
||||
aMap[atype].append(record)
|
||||
else:
|
||||
aMap.update( {atype: [record]} )
|
||||
|
||||
return aMap
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -56,14 +56,69 @@ def __parseCommandLine():
|
|||
logger.debug("Command-line arguments: " + str(options))
|
||||
return options
|
||||
|
||||
def __getActivityInfo(options):
|
||||
#
|
||||
# create an ActivityInfo object from command line input and
|
||||
# activityXML. If no input was found from command line, the
|
||||
# info in activityXML will be used.
|
||||
#
|
||||
def __getActivityInfo(xml, options):
|
||||
|
||||
ainfo = ActivityInfo()
|
||||
ainfo.setActivityLabel(options.filename)
|
||||
ainfo.setActivityName(options.activityName)
|
||||
ainfo.setActivityType(options.activityType)
|
||||
ainfo.setActivitySubtype(options.activitySubtype)
|
||||
|
||||
tree = ET.fromstring(xml)
|
||||
product = tree.find('Product')
|
||||
|
||||
# strip the path from file and use it as activityLabel
|
||||
|
||||
fullname = options.filename
|
||||
lastslash = fullname.rfind("/")
|
||||
filename = fullname
|
||||
if ( lastslash >=0 ):
|
||||
filename = fullname[lastslash+1:]
|
||||
|
||||
ainfo.setActivityLabel(filename)
|
||||
|
||||
if ( options.forecaster != None ):
|
||||
ainfo.setForecaster(options.forecaster)
|
||||
else:
|
||||
ainfo.setForecaster(product.attrib['forecaster'])
|
||||
|
||||
if ( options.site != None ):
|
||||
ainfo.setSite(options.site)
|
||||
else:
|
||||
ainfo.setSite(product.attrib['center'])
|
||||
|
||||
# set activity type and subtype
|
||||
if ( options.activityType != None ):
|
||||
ainfo.setActivityType(options.activityType)
|
||||
|
||||
if ( options.activitySubtype != None ):
|
||||
ainfo.setActivitySubtype(options.activitySubtype)
|
||||
else:
|
||||
ainfo.setActivitySubtype("")
|
||||
else:
|
||||
if (product.attrib['type'].find("(") < 0 ):
|
||||
ainfo.setActivityType( product.attrib['type'] )
|
||||
ainfo.setActivitySubtype( "" )
|
||||
else:
|
||||
fulltyp = product.attrib['type']
|
||||
start = fulltyp.find("(")
|
||||
end = fulltyp.find(")")
|
||||
ainfo.setActivityType( fulltyp[0:start] )
|
||||
ainfo.setActivitySubtype( fulltyp[start+1:end] )
|
||||
|
||||
# set activityName
|
||||
if ( options.activityName != None ):
|
||||
ainfo.setActivityName(options.activityName)
|
||||
else:
|
||||
if ( options.activityType != None ):
|
||||
aname = options.activityType;
|
||||
if ( options.activitySubtype != None ):
|
||||
aname = aname + "(" + options.activitySubtype + ")"
|
||||
ainfo.setActivityName( aname )
|
||||
else:
|
||||
ainfo.setActivityName( product.attrib['name'] )
|
||||
|
||||
return ainfo
|
||||
|
||||
# Update Product tag attributes with options given on command line
|
||||
|
@ -74,6 +129,10 @@ def __updateXML(xml, options):
|
|||
product.attrib['name'] = options.activityName
|
||||
|
||||
if options.activityType != None:
|
||||
if options.activitySubtype != None:
|
||||
ntype = options.activityType + '(' + options.activitySubtype + ')'
|
||||
product.attrib['type'] = ntype
|
||||
else:
|
||||
product.attrib['type'] = options.activityType
|
||||
|
||||
if options.filename != None:
|
||||
|
@ -84,11 +143,12 @@ def __updateXML(xml, options):
|
|||
|
||||
if options.site != None:
|
||||
product.attrib['center'] = options.site
|
||||
|
||||
return ET.tostring(tree)
|
||||
|
||||
def main():
|
||||
__initLogger()
|
||||
logger.info("Starting retrieveActivity.")
|
||||
logger.info("Starting storeActivity.")
|
||||
options = __parseCommandLine()
|
||||
|
||||
# read in XML from input file
|
||||
|
@ -98,7 +158,7 @@ def main():
|
|||
|
||||
# generate an activityInfo object and update XML with options
|
||||
# from command line
|
||||
actinfo = __getActivityInfo(options)
|
||||
actinfo = __getActivityInfo(activityXML, options)
|
||||
activityXML = __updateXML(activityXML, options)
|
||||
|
||||
# Store Activity to EDEX
|
||||
|
|
|
@ -14,6 +14,7 @@ Import-Package: com.raytheon.edex.uengine.tasks.query,
|
|||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.serialization.comm,
|
||||
com.raytheon.uf.edex.pointdata,
|
||||
gov.noaa.nws.ncep.edex.common.sounding,
|
||||
org.apache.commons.logging
|
||||
Export-Package: gov.noaa.nws.ncep.common.dataplugin.gpd,
|
||||
gov.noaa.nws.ncep.common.dataplugin.gpd.dao,
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
@ -30,7 +34,10 @@ public class GenericPointDataConstants {
|
|||
// db filed defined in GenericPointDataRecord
|
||||
public static final String DB_PROD_NAME= "productInfo.name";
|
||||
public static final String DB_MASTER_LEVEL_NAME= "productInfo.masterLevel.name";
|
||||
public static final String DB_REFTIME_NAME= "dataTime.refTime";
|
||||
public static final String DB_REF_TIME= "dataTime.refTime";
|
||||
public static final String DB_FORECAST_TIME= "dataTime.fcstTime";
|
||||
public static final String DB_RANGESTART_TIME= "dataTime.validPeriod.start";
|
||||
public static final String DB_UTILITY_FLAGS= "dataTime.utilityFlags";
|
||||
public static final String DB_PRODUCT_VERSION = "productVersion";
|
||||
public static final String DB_STN_CATALOGTYPE = "location.catalogType";
|
||||
public static final String DB_SLAT = "slat";
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------- ------- -------- -----------
|
||||
* 05/30/2013 Chin J. Chen Initial coding
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin J. Chen
|
||||
* @version 1.0
|
||||
*/
|
||||
package gov.noaa.nws.ncep.common.dataplugin.gpd;
|
||||
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataProductInfo;
|
||||
|
@ -31,23 +52,6 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
|||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------- ------- -------- -----------
|
||||
* 05/30/2013 Chin J. Chen Initial coding
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author Chin J. Chen
|
||||
* @version 1.0
|
||||
*/
|
||||
@Entity
|
||||
// @Table(name = "gpd", uniqueConstraints = { @UniqueConstraint(columnNames = {
|
||||
// "dataURI" }) })
|
||||
|
@ -144,6 +148,7 @@ public class GenericPointDataRecord extends PersistablePluginDataObject
|
|||
this.slat = slat;
|
||||
this.slon = slon;
|
||||
this.pointDataView = pointDataView;
|
||||
// this.pluginName = "gpd";
|
||||
// System.out.println("GenericPointDataRecord(3) entered");
|
||||
}
|
||||
|
||||
|
@ -157,6 +162,7 @@ public class GenericPointDataRecord extends PersistablePluginDataObject
|
|||
this.pointDataView = pointDataView;
|
||||
this.dataTime = dataTime;
|
||||
this.productVersion = productVersion;
|
||||
// this.pluginName = "gpd";
|
||||
// System.out.println("GenericPointDataRecord(4) entered");
|
||||
}
|
||||
|
||||
|
@ -300,13 +306,10 @@ public class GenericPointDataRecord extends PersistablePluginDataObject
|
|||
this.productVersion = productVersion;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.common.dataplugin.PluginDataObject#getPluginName()
|
||||
*/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "gpd";
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
/**
|
||||
*
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
|
@ -26,8 +29,13 @@ import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataProductIn
|
|||
import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataStationProduct;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.query.GenericPointDataQuery;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.query.GenericPointDataReqMsg.GenericPointDataQueryKey;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.query.GenericPointDataReqMsg.GenericPointDataReqType;
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingStnInfo;
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingStnInfoCollection;
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingTimeLines;
|
||||
|
||||
import java.io.File;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
@ -36,6 +44,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.hibernate.Criteria;
|
||||
|
@ -47,6 +57,7 @@ import org.hibernate.criterion.Restrictions;
|
|||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
import com.raytheon.uf.common.dataplugin.PluginException;
|
||||
import com.raytheon.uf.common.dataplugin.level.MasterLevel;
|
||||
import com.raytheon.uf.common.datastorage.StorageException;
|
||||
import com.raytheon.uf.common.parameter.Parameter;
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataDescription;
|
||||
|
@ -75,7 +86,7 @@ public class GenericPointDataDao extends
|
|||
|
||||
@Override
|
||||
public String[] getKeysRequiredForFileName() {
|
||||
return new String[] { GenericPointDataConstants.DB_REFTIME_NAME,
|
||||
return new String[] { GenericPointDataConstants.DB_REF_TIME,
|
||||
GenericPointDataConstants.DB_PROD_NAME,
|
||||
GenericPointDataConstants.DB_MASTER_LEVEL_NAME };
|
||||
}
|
||||
|
@ -96,7 +107,9 @@ public class GenericPointDataDao extends
|
|||
@Override
|
||||
public String getPointDataFileName(GenericPointDataRecord p) {
|
||||
Date refTime = (p.getDataTime().getRefTime());
|
||||
String dateStr = hdfFileDateFormat.format(refTime);
|
||||
int forecasttime = p.getDataTime().getFcstTime();
|
||||
String dateStr = hdfFileDateFormat.format(refTime) + "-f"
|
||||
+ forecasttime;
|
||||
// System.out.println("gpd getPointDataFileName1 called and return: "+"gpd-"+p.getProductInfo().getName()+dateStr+/*"-"+p.getReportType().getMasterLevel().getName()+*/".h5");
|
||||
return "gpd-" + p.getProductInfo().getName() + dateStr + ".h5";
|
||||
}
|
||||
|
@ -123,10 +136,12 @@ public class GenericPointDataDao extends
|
|||
public String getPointDataFileName(Map<String, Object> dbResults) {
|
||||
String reportname = (String) dbResults
|
||||
.get(GenericPointDataConstants.DB_PROD_NAME);
|
||||
// String lmName=
|
||||
// (String)dbResults.get(GenericPointDataConstants.DB_MASTER_LEVEL_NAME);
|
||||
int forecasttime = (Integer) dbResults
|
||||
.get(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
String dateStr = hdfFileDateFormat.format(dbResults
|
||||
.get(GenericPointDataConstants.DB_REFTIME_NAME));
|
||||
.get(GenericPointDataConstants.DB_REF_TIME))
|
||||
+ "-f"
|
||||
+ forecasttime;
|
||||
String filename = PLUGIN_HDF5_DIR + reportname + File.separator
|
||||
// + lmName + File.separator
|
||||
+ this.pluginName + "-" + reportname + /* "-"+lmName+ */dateStr
|
||||
|
@ -158,7 +173,10 @@ public class GenericPointDataDao extends
|
|||
|
||||
Date refTime = ((PluginDataObject) persistable).getDataTime()
|
||||
.getRefTime();
|
||||
String dateStr = hdfFileDateFormat.format(refTime);
|
||||
int forecasttime = ((PluginDataObject) persistable).getDataTime()
|
||||
.getFcstTime();
|
||||
String dateStr = hdfFileDateFormat.format(refTime) + "-f"
|
||||
+ forecasttime;
|
||||
String fileName = persistable.getPluginName() + "-"
|
||||
+ rec.getProductInfo().getName() + /*
|
||||
* "-"+rec.getReportType().
|
||||
|
@ -174,11 +192,17 @@ public class GenericPointDataDao extends
|
|||
/*
|
||||
* This function is for development testing.. not used in production code
|
||||
*/
|
||||
public PointDataDescription getPointDataDescription()
|
||||
throws SerializationException {
|
||||
public PointDataDescription getPointDataDescription() throws JAXBException {
|
||||
if (pdd == null) {
|
||||
try {
|
||||
pdd = PointDataDescription.fromStream(this.getClass()
|
||||
.getResourceAsStream("/res/pointdata/gpd.xml"));
|
||||
} catch (SerializationException e) {
|
||||
// TODO Auto-generated catch block. Please revise as
|
||||
// appropriate.
|
||||
// statusHandler.handle(Priority.PROBLEM,
|
||||
// e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
return pdd;
|
||||
}
|
||||
|
@ -415,6 +439,7 @@ public class GenericPointDataDao extends
|
|||
|
||||
Criterion nameCrit = Restrictions.eq("name", prod.getName());
|
||||
crit.add(nameCrit);
|
||||
// query
|
||||
List<?> vals = crit.list();
|
||||
if (vals.size() > 0) {
|
||||
// the product is already in DB
|
||||
|
@ -440,7 +465,7 @@ public class GenericPointDataDao extends
|
|||
// prod version > 0, disallow update prod info
|
||||
} else {
|
||||
// TBD...do we need clone it?
|
||||
returnProdInfo = dbProdInfo;// .clone();
|
||||
returnProdInfo = dbProdInfo;
|
||||
}
|
||||
|
||||
} else if (createProd) {
|
||||
|
@ -630,6 +655,15 @@ public class GenericPointDataDao extends
|
|||
GenericPointDataQueryKey quertKey, String stnId, float slat,
|
||||
float slon, GenericPointDataProductInfo prodInfo, int productVersion)
|
||||
throws Exception {
|
||||
return (getPointDataContainer(refTime, null, quertKey, stnId, slat,
|
||||
slon, prodInfo, productVersion));
|
||||
}
|
||||
|
||||
private PointDataContainer getPointDataContainer(Date refTime,
|
||||
Date rangeStartTime, GenericPointDataQueryKey quertKey,
|
||||
String stnId, float slat, float slon,
|
||||
GenericPointDataProductInfo prodInfo, int productVersion)
|
||||
throws Exception {
|
||||
String prodName = prodInfo.getName();
|
||||
|
||||
PointDataContainer pdc = null;
|
||||
|
@ -648,15 +682,14 @@ public class GenericPointDataDao extends
|
|||
}
|
||||
returnParametersString.append(parameter);
|
||||
}
|
||||
// also add the 3 HDF5 mandatory datasets
|
||||
// also add the 3 HDF5 mandatory data sets
|
||||
returnParametersString.append(","
|
||||
+ GenericPointDataConstants.HDF5_LEVEL_VALUE);
|
||||
returnParametersString.append(","
|
||||
+ GenericPointDataConstants.HDF5_NUM_LEVEL);
|
||||
returnParametersString.append(","
|
||||
+ GenericPointDataConstants.HDF5_STN_ID);
|
||||
System.out.println("gpd dao hdf5 parameterlist="
|
||||
+ returnParametersString.toString());
|
||||
// System.out.println("gpd dao hdf5 parameterlist="+returnParametersString.toString());
|
||||
|
||||
// 2nd:: add return fields form DB. the parameter name need to be
|
||||
// defined in
|
||||
|
@ -666,7 +699,10 @@ public class GenericPointDataDao extends
|
|||
+ GenericPointDataConstants.DB_STN_CATALOGTYPE);
|
||||
returnParametersString.append("," + GenericPointDataConstants.DB_SLAT);
|
||||
returnParametersString.append("," + GenericPointDataConstants.DB_SLON);
|
||||
|
||||
returnParametersString.append(","
|
||||
+ GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
returnParametersString.append(","
|
||||
+ GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
// parameters defined in
|
||||
// /gov.noaa.nws.ncep.edex.plugin.gpd/utility/common_static/base/path/gpdPathKeys.xml
|
||||
// AND those returned by dao.getKeysRequiredForFileName()
|
||||
|
@ -681,25 +717,33 @@ public class GenericPointDataDao extends
|
|||
if (quertKey == GenericPointDataQueryKey.BY_STN_ID)
|
||||
pdq.addParameter("location.stationId", stnId, "=");
|
||||
else if (quertKey == GenericPointDataQueryKey.BY_SLAT_SLON) {
|
||||
pdq.addParameter("slat", Float.toString(slat + 0.001f), "<");
|
||||
pdq.addParameter("slon", Float.toString(slon + 0.001f), "<");
|
||||
pdq.addParameter("slat", Float.toString(slat - 0.001f), ">");
|
||||
pdq.addParameter("slon", Float.toString(slon - 0.001f), ">");
|
||||
pdq.addParameter("slat", Float.toString(slat), "=");
|
||||
pdq.addParameter("slon", Float.toString(slon), "=");
|
||||
|
||||
}
|
||||
|
||||
String dateStr = dbRefTimeFormat.format(refTime);
|
||||
pdq.addParameter("dataTime.refTime", dateStr, "=");
|
||||
pdq.addParameter("productVersion", Integer.toString(productVersion),
|
||||
"=");
|
||||
System.out.println("requestig refTime = " + dateStr);
|
||||
pdq.addParameter(GenericPointDataConstants.DB_REF_TIME, dateStr, "=");
|
||||
if (rangeStartTime != null) {
|
||||
String rangedateStr = dbRefTimeFormat.format(rangeStartTime);
|
||||
pdq.addParameter(GenericPointDataConstants.DB_RANGESTART_TIME,
|
||||
rangedateStr, "=");
|
||||
}
|
||||
pdq.addParameter(GenericPointDataConstants.DB_PRODUCT_VERSION,
|
||||
Integer.toString(productVersion), "=");
|
||||
// System.out.println("requestig refTime = "+ dateStr);
|
||||
pdq.requestAllLevels();
|
||||
try {
|
||||
pdc = pdq.execute();
|
||||
} catch (StorageException e) {
|
||||
System.out.println("HDF5 query StorageException " + e);
|
||||
}
|
||||
|
||||
return pdc;
|
||||
}
|
||||
|
||||
/*
|
||||
* TBM...Chin delet this leter...not used public
|
||||
* TBM...Chin delete this later...not used public
|
||||
* GenericPointDataProductContainer getGpdProduct(Date refTime, String
|
||||
* prodName,boolean useSpecifiedProductVersion, int productVersion)throws
|
||||
* Exception{ GenericPointDataProductInfo prodInfo = getGpdProdInfo(
|
||||
|
@ -791,6 +835,7 @@ public class GenericPointDataDao extends
|
|||
GenericPointDataQueryKey key, String stnId, float slat, float slon,
|
||||
String prodName, boolean useSpecifiedProductVersion,
|
||||
int productVersion) throws Exception {
|
||||
long t01 = System.currentTimeMillis();
|
||||
GenericPointDataProductInfo prodInfo = getGpdProdInfo(prodName);
|
||||
if (prodInfo == null) {
|
||||
System.out.println("report is not in DB");
|
||||
|
@ -809,7 +854,7 @@ public class GenericPointDataDao extends
|
|||
System.out.println("pdc is null");
|
||||
return null;
|
||||
}
|
||||
System.out.println("pdc CurrentSz()=" + pdc.getCurrentSz());
|
||||
// System.out.println("pdc CurrentSz()="+pdc.getCurrentSz());
|
||||
GenericPointDataProductContainer prodCon = new GenericPointDataProductContainer();
|
||||
prodCon.setProductInfo(prodInfo);
|
||||
prodCon.setRefTime(refTime);
|
||||
|
@ -891,6 +936,19 @@ public class GenericPointDataDao extends
|
|||
// slon value is retrieved already, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.DB_SLON);
|
||||
}
|
||||
String utFlag = null;
|
||||
if (parameters.contains(GenericPointDataConstants.DB_UTILITY_FLAGS)) {
|
||||
utFlag = pdv
|
||||
.getString(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
// System.out.println("utFlag= "+ utFlag);
|
||||
parameters.remove(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
}
|
||||
int forecastTime = 0;
|
||||
if (parameters.contains(GenericPointDataConstants.DB_FORECAST_TIME)) {
|
||||
forecastTime = pdv
|
||||
.getInt(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
parameters.remove(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
}
|
||||
// PDV id is not returned back to user, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.HDF5_PDV_ID);
|
||||
|
||||
|
@ -904,6 +962,8 @@ public class GenericPointDataDao extends
|
|||
stnPd.setNumLevel(numLevel);
|
||||
stnPd.setSlat(rtnslat);
|
||||
stnPd.setSlon(rtnslon);
|
||||
stnPd.setForecastTime(forecastTime);
|
||||
stnPd.setUtilityFlag(utFlag);
|
||||
for (String parm : parameters) {
|
||||
if (numLevel > 1) {
|
||||
// these parameters are data parameters and should be 2
|
||||
|
@ -920,6 +980,7 @@ public class GenericPointDataDao extends
|
|||
levelList.get(j).getGpdParameters().add(gpdParm);
|
||||
}
|
||||
} else {
|
||||
// System.out.println("parm ="+parm);
|
||||
GenericPointDataParameter gpdParm = new GenericPointDataParameter(
|
||||
parm, pdv.getFloat(parm));
|
||||
levelList.get(0).getGpdParameters().add(gpdParm);
|
||||
|
@ -927,6 +988,10 @@ public class GenericPointDataDao extends
|
|||
}
|
||||
prodCon.getStnProdLst().add(stnPd);
|
||||
}
|
||||
|
||||
long t02 = System.currentTimeMillis();
|
||||
System.out.println("ThrifClient: getGpdProduct() took " + (t02 - t01)
|
||||
+ " ms in total for query stn=" + stnId);
|
||||
return prodCon;
|
||||
}
|
||||
|
||||
|
@ -952,8 +1017,8 @@ public class GenericPointDataDao extends
|
|||
System.out.println("pdc is null");
|
||||
continue;
|
||||
}
|
||||
System.out.println(refTime.toString() + " pdc CurrentSz()="
|
||||
+ pdc.getCurrentSz());
|
||||
// System.out.println(refTime.toString()
|
||||
// +" pdc CurrentSz()="+pdc.getCurrentSz());
|
||||
|
||||
for (int i = 0; i < pdc.getCurrentSz(); i++) {
|
||||
PointDataView pdv = pdc.readRandom(i);
|
||||
|
@ -1036,6 +1101,23 @@ public class GenericPointDataDao extends
|
|||
// slon value is retrieved already, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.DB_SLON);
|
||||
}
|
||||
String utFlag = null;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.DB_UTILITY_FLAGS)) {
|
||||
utFlag = pdv
|
||||
.getString(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
System.out.println("utFlag= " + utFlag);
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
}
|
||||
int forecastTime = 0;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.DB_FORECAST_TIME)) {
|
||||
forecastTime = pdv
|
||||
.getInt(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
}
|
||||
// PDV id is not returned back to user, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.HDF5_PDV_ID);
|
||||
|
||||
|
@ -1049,6 +1131,8 @@ public class GenericPointDataDao extends
|
|||
stnPd.setNumLevel(numLevel);
|
||||
stnPd.setSlat(rtnslat);
|
||||
stnPd.setSlon(rtnslon);
|
||||
stnPd.setForecastTime(forecastTime);
|
||||
stnPd.setUtilityFlag(utFlag);
|
||||
for (String parm : parameters) {
|
||||
if (numLevel > 1) {
|
||||
// these parameters are data parameters and should be 2
|
||||
|
@ -1076,8 +1160,182 @@ public class GenericPointDataDao extends
|
|||
return stnProdList;
|
||||
}
|
||||
|
||||
public List<GenericPointDataStationProduct> getGpdStationModelSndProduct(
|
||||
List<Date> rangeStartTimeList, Date referenceTime,
|
||||
GenericPointDataQueryKey key, String stnId, float slat, float slon,
|
||||
String prodName) throws Exception {
|
||||
long t01 = System.currentTimeMillis();
|
||||
GenericPointDataProductInfo prodInfo = getGpdProdInfo(prodName);
|
||||
if (prodInfo == null) {
|
||||
System.out.println("product is not in DB");
|
||||
return null;
|
||||
}
|
||||
int productVersion = getGpdProductLatestVersion(referenceTime, prodName);
|
||||
if (productVersion < 0) {
|
||||
System.out.println("product version not available");
|
||||
return null;
|
||||
}
|
||||
|
||||
List<GenericPointDataStationProduct> stnProdList = new ArrayList<GenericPointDataStationProduct>();
|
||||
for (Date rangeStartTime : rangeStartTimeList) {
|
||||
|
||||
PointDataContainer pdc = getPointDataContainer(referenceTime,
|
||||
rangeStartTime, key, stnId, slat, slon, prodInfo,
|
||||
productVersion);
|
||||
if (pdc == null) {
|
||||
System.out.println("pdc is null");
|
||||
continue;
|
||||
}
|
||||
// System.out.println(rangeStartTime.toString()
|
||||
// +" pdc CurrentSz()="+pdc.getCurrentSz());
|
||||
|
||||
for (int i = 0; i < pdc.getCurrentSz(); i++) {
|
||||
PointDataView pdv = pdc.readRandom(i);
|
||||
// System.out.println("pdv#"+i+" *********************************************");
|
||||
Set<String> parameters = new HashSet<String>(pdv.getContainer()
|
||||
.getParameters());
|
||||
int numLevel = 0;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.HDF5_NUM_LEVEL)) {
|
||||
numLevel = pdv
|
||||
.getInt(GenericPointDataConstants.HDF5_NUM_LEVEL);
|
||||
// System.out.println("numLevel= "+ numLevel);
|
||||
// numLevel value is retrieved already, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.HDF5_NUM_LEVEL);
|
||||
} else
|
||||
continue; // level number is 0, no need to continue on this
|
||||
// PDV.
|
||||
|
||||
List<GenericPointDataLevel> levelList;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.HDF5_LEVEL_VALUE)) {
|
||||
levelList = new ArrayList<GenericPointDataLevel>(numLevel);
|
||||
if (numLevel > 1) {
|
||||
Number[] num = pdv
|
||||
.getNumberAllLevels(GenericPointDataConstants.HDF5_LEVEL_VALUE);// pdv.getNumberAllLevels(parm,numLevel);
|
||||
int count = 0;
|
||||
for (Number n : num) {
|
||||
count++;
|
||||
if (count > numLevel)
|
||||
break;
|
||||
// System.out.println("Level " +count+
|
||||
// " value="+n.floatValue());
|
||||
GenericPointDataLevel gpdLevel = new GenericPointDataLevel();
|
||||
gpdLevel.setLevelValue(n.floatValue());
|
||||
levelList.add(gpdLevel);
|
||||
}
|
||||
} else {
|
||||
GenericPointDataLevel gpdLevel = new GenericPointDataLevel();
|
||||
gpdLevel.setLevelValue(pdv
|
||||
.getFloat(GenericPointDataConstants.HDF5_LEVEL_VALUE));
|
||||
levelList.add(gpdLevel);
|
||||
}
|
||||
// level value is retrieved already, so drop it here
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.HDF5_LEVEL_VALUE);
|
||||
} else
|
||||
continue; // no level value, no need to continue on this
|
||||
// PDV.
|
||||
|
||||
int stnCatalogType = ObStation.CAT_TYPE_MESONET;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.DB_STN_CATALOGTYPE)) {
|
||||
stnCatalogType = pdv
|
||||
.getInt(GenericPointDataConstants.DB_STN_CATALOGTYPE);
|
||||
// System.out.println("stnCatalogType= "+ stnCatalogType);
|
||||
// DB_STN_CATALOGTYPE value is retrieved already, so drop it
|
||||
// here
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.DB_STN_CATALOGTYPE);
|
||||
}
|
||||
String rtnstnId = stnId;
|
||||
if (parameters.contains(GenericPointDataConstants.HDF5_STN_ID)) {
|
||||
rtnstnId = pdv
|
||||
.getString(GenericPointDataConstants.HDF5_STN_ID);
|
||||
// System.out.println("stnId= "+ rtnstnId);
|
||||
// stnId is input parameter, can drop it here.
|
||||
parameters.remove(GenericPointDataConstants.HDF5_STN_ID);
|
||||
}
|
||||
float rtnslat = slat;
|
||||
if (parameters.contains(GenericPointDataConstants.DB_SLAT)) {
|
||||
rtnslat = pdv.getFloat(GenericPointDataConstants.DB_SLAT);
|
||||
// System.out.println("slat= "+ rtnslat);
|
||||
// slat value is retrieved already, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.DB_SLAT);
|
||||
}
|
||||
float rtnslon = slon;
|
||||
if (parameters.contains(GenericPointDataConstants.DB_SLON)) {
|
||||
rtnslon = pdv.getFloat(GenericPointDataConstants.DB_SLON);
|
||||
// System.out.println("slon= "+ rtnslon);
|
||||
// slon value is retrieved already, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.DB_SLON);
|
||||
}
|
||||
String utFlag = null;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.DB_UTILITY_FLAGS)) {
|
||||
utFlag = pdv
|
||||
.getString(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
System.out.println("utFlag= " + utFlag);
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.DB_UTILITY_FLAGS);
|
||||
}
|
||||
int forecastTime = 0;
|
||||
if (parameters
|
||||
.contains(GenericPointDataConstants.DB_FORECAST_TIME)) {
|
||||
forecastTime = pdv
|
||||
.getInt(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
parameters
|
||||
.remove(GenericPointDataConstants.DB_FORECAST_TIME);
|
||||
}
|
||||
// PDV id is not returned back to user, so drop it here
|
||||
parameters.remove(GenericPointDataConstants.HDF5_PDV_ID);
|
||||
|
||||
GenericPointDataStationProduct stnPd = new GenericPointDataStationProduct();
|
||||
stnPd.setProductName(prodName);
|
||||
stnPd.setRefTime(referenceTime);
|
||||
stnPd.setLevelLst(levelList);
|
||||
stnPd.setProductVersion(productVersion);
|
||||
stnPd.getLocation().setStationId(rtnstnId);
|
||||
stnPd.getLocation().setCatalogType(stnCatalogType);
|
||||
stnPd.setNumLevel(numLevel);
|
||||
stnPd.setSlat(rtnslat);
|
||||
stnPd.setSlon(rtnslon);
|
||||
stnPd.setForecastTime(forecastTime);
|
||||
stnPd.setUtilityFlag(utFlag);
|
||||
|
||||
for (String parm : parameters) {
|
||||
if (numLevel > 1) {
|
||||
// these parameters are data parameters and should be 2
|
||||
// dimensional float value per design
|
||||
// If a new "meta" data is queried, then we should take
|
||||
// care of that data specifically before here.
|
||||
Number[] num = pdv.getNumberAllLevels(parm);// ,numLevel);
|
||||
// System.out.println("parm ="+parm);
|
||||
for (int j = 0; j < numLevel; j++) {
|
||||
Number n = num[j];
|
||||
// System.out.println(" value="+n.floatValue());
|
||||
GenericPointDataParameter gpdParm = new GenericPointDataParameter(
|
||||
parm, n.floatValue());
|
||||
levelList.get(j).getGpdParameters().add(gpdParm);
|
||||
}
|
||||
} else {
|
||||
GenericPointDataParameter gpdParm = new GenericPointDataParameter(
|
||||
parm, pdv.getFloat(parm));
|
||||
levelList.get(0).getGpdParameters().add(gpdParm);
|
||||
}
|
||||
}
|
||||
stnProdList.add(stnPd);
|
||||
}
|
||||
}
|
||||
long t02 = System.currentTimeMillis();
|
||||
System.out.println("ThrifClient: getGpdStationModelSndProduct() took "
|
||||
+ (t02 - t01) + " ms in total for query stn=" + stnId);
|
||||
|
||||
return stnProdList;
|
||||
}
|
||||
|
||||
/*
|
||||
* TBM...Chin delet this leter...not used public
|
||||
* TBM...Chin delete this later...not used public
|
||||
* GenericPointDataStationProduct getGpdStationProduct(Date refTime,
|
||||
* GenericPointDataQueryKey key, String stnId, double slat, double slon,
|
||||
* String reportName,boolean useSpecifiedProductVersion, int
|
||||
|
@ -1291,8 +1549,9 @@ public class GenericPointDataDao extends
|
|||
GenericPointDataRecord rec = (GenericPointDataRecord) pdo;
|
||||
String directory = PLUGIN_HDF5_DIR
|
||||
+ rec.getProductInfo().getName();
|
||||
|
||||
String dateStr = hdfFileDateFormat.format(refTime);
|
||||
int forecasttime = rec.getDataTime().getFcstTime();
|
||||
String dateStr = hdfFileDateFormat.format(refTime)
|
||||
+ "-f" + forecasttime;
|
||||
String fileName = this.pluginName + "-"
|
||||
+ rec.getProductInfo().getName() + dateStr
|
||||
+ ".h5";
|
||||
|
@ -1343,4 +1602,123 @@ public class GenericPointDataDao extends
|
|||
return results;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return distinct reference time lines for one product
|
||||
*/
|
||||
public NcSoundingTimeLines getGpdProductTimeline(String prodName) {
|
||||
Object[] synopTimeAry = null;
|
||||
NcSoundingTimeLines tl = new NcSoundingTimeLines();
|
||||
String queryStr;
|
||||
queryStr = new String(
|
||||
"Select Distinct reftime FROM gpd where productinfo_name='"
|
||||
+ prodName + "' ORDER BY reftime DESC");
|
||||
synopTimeAry = (Object[]) executeSQLQuery(queryStr);
|
||||
tl.setTimeLines(synopTimeAry);
|
||||
return tl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return distinct rangestart times for one product at one reference time.
|
||||
* Input reference time string format is "yyyy-mm-dd HH"
|
||||
*/
|
||||
public NcSoundingTimeLines getGpdProductRangestartTimes(String prodName,
|
||||
String refTimeStr) {
|
||||
|
||||
Object[] refTimeAry = null;
|
||||
NcSoundingTimeLines tl = new NcSoundingTimeLines();
|
||||
|
||||
String queryStr = new String(
|
||||
"Select Distinct rangestart FROM gpd where productinfo_name='"
|
||||
+ prodName + "' AND reftime='" + refTimeStr + ":00:00'"
|
||||
+ " ORDER BY rangestart");
|
||||
refTimeAry = (Object[]) executeSQLQuery(queryStr);
|
||||
tl.setTimeLines(refTimeAry);
|
||||
|
||||
return tl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return distinct station id(s) for one product at one reference time
|
||||
*/
|
||||
public NcSoundingStnInfoCollection getGpdStationInfoCollection(
|
||||
String selectedRefTime, String selectedRangeStartTime,
|
||||
String prodName) {
|
||||
NcSoundingStnInfoCollection stnInfoCol = new NcSoundingStnInfoCollection();
|
||||
List<NcSoundingStnInfo> stationInfoList = new ArrayList<NcSoundingStnInfo>();
|
||||
String queryStr;
|
||||
Object[] rtnobjArray;
|
||||
queryStr = new String(
|
||||
"Select Distinct slat, slon, id, location_gid, reftime, rangestart FROM gpd where reftime='"
|
||||
+ selectedRefTime
|
||||
+ "' AND rangestart='"
|
||||
+ selectedRangeStartTime
|
||||
+ "' AND productinfo_name='"
|
||||
+ prodName
|
||||
+ "' AND slat BETWEEN -89.9 AND 89.9 AND slon BETWEEN -179.9 AND 179.9");
|
||||
rtnobjArray = executeSQLQuery(queryStr);
|
||||
String stnId = "";
|
||||
Double slat, slon;
|
||||
Timestamp synoptictime = null, rsTime = null;
|
||||
for (int j = 0; j < rtnobjArray.length; j++) {
|
||||
Object[] objArray = (Object[]) rtnobjArray[j];
|
||||
// ids.add(((Integer)objArray[2]));
|
||||
// We save lat/lon as float in DB.
|
||||
// To make sure the double number get the same precision as the
|
||||
// float number saved in DB
|
||||
// we have to do the following conversion.
|
||||
slat = new Double(objArray[0].toString());
|
||||
slon = new Double(objArray[1].toString());
|
||||
stnId = (String) objArray[3];
|
||||
stnId = stnId.replace("1000-", "");
|
||||
synoptictime = (Timestamp) objArray[4];
|
||||
rsTime = (Timestamp) objArray[5];
|
||||
NcSoundingStnInfo stn = stnInfoCol.getNewStnInfo();
|
||||
stn.setStnId(stnId);
|
||||
stn.setStationLongitude(slon);
|
||||
stn.setStationLatitude(slat);
|
||||
stn.setSynopTime(synoptictime);
|
||||
stn.setRangeStartTime(rsTime);
|
||||
stationInfoList.add((NcSoundingStnInfo) stn);
|
||||
}
|
||||
NcSoundingStnInfo[] stationInfoAry = new NcSoundingStnInfo[stationInfoList
|
||||
.size()];
|
||||
stnInfoCol.setStationInfo(stationInfoList.toArray(stationInfoAry));
|
||||
// *System.out.println("stn size = "+
|
||||
// stnInfoCol.getStationInfo().length);
|
||||
return stnInfoCol;
|
||||
}
|
||||
|
||||
public Object[] getGpdAvailProducts(GenericPointDataReqType reqType) {
|
||||
String queryStr;
|
||||
Object[] rtnobjArray;
|
||||
switch (reqType) {
|
||||
case GET_GPD_AVAILABLE_OBSERVED_SOUNDING_PRODUCTS:
|
||||
queryStr = new String(
|
||||
"Select Distinct productinfo_name FROM gpd where productinfo_name IN (Select Distinct name FROM gpd_productinfo where maxnumberoflevel > 8) AND gpd.utilityflags = '[]'");
|
||||
break;
|
||||
case GET_GPD_AVAILABLE_MODEL_SOUNDING_PRODUCTS:
|
||||
queryStr = new String(
|
||||
"Select Distinct productinfo_name FROM gpd where productinfo_name IN (Select Distinct name FROM gpd_productinfo where maxnumberoflevel > 8) AND gpd.utilityflags = '[FCST_USED]'");
|
||||
break;
|
||||
case GET_GPD_AVAILABLE_SURFACE_PRODUCTS:
|
||||
queryStr = new String(
|
||||
"Select Distinct name FROM gpd_productinfo where maxnumberoflevel=1");
|
||||
break;
|
||||
case GET_GPD_ALL_AVAILABLE_PRODUCTS:
|
||||
queryStr = new String("Select Distinct name FROM gpd_productinfo");
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
rtnobjArray = executeSQLQuery(queryStr);
|
||||
|
||||
// List<String> prodList = new ArrayList<String>();
|
||||
// for (int j =0; j <rtnobjArray.length; j++){
|
||||
// Object[] objArray = (Object[] )rtnobjArray[j];
|
||||
// System.out.println("prod="+rtnobjArray[j]);
|
||||
// String prodName= (String)rtnobjArray[j];
|
||||
// prodList.add(prodName);
|
||||
// }
|
||||
return rtnobjArray;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/**
|
||||
*
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/**
|
||||
*
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
/**
|
||||
*
|
||||
*
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
* <pre>
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
/**
|
||||
*
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
*
|
||||
|
@ -19,6 +23,7 @@ package gov.noaa.nws.ncep.common.dataplugin.gpd.product;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -30,6 +35,7 @@ import javax.xml.bind.annotation.XmlRootElement;
|
|||
import com.raytheon.uf.common.pointdata.spatial.ObStation;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.common.time.DataTime.FLAG;
|
||||
|
||||
@DynamicSerialize
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
|
@ -65,6 +71,20 @@ public class GenericPointDataStationProduct {
|
|||
@XmlAttribute
|
||||
protected Date refTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
@XmlAttribute
|
||||
//set to -1, if forecast time is not used, foe example, for observed surface, observed snd type of data.
|
||||
//set forecast time in second.Its value is computed starting from reference time. So,
|
||||
//if forecastTime =0, means its forecast time is the same time as reference time
|
||||
//if forecastTime =3600, means its forecast time is one hour after the reference time
|
||||
//When saving data, this value is actually saved to DataTime in PluginDataObject Object. And
|
||||
//utilityFlags is set to "FCST_USED" to indicate forecast time is used or not.
|
||||
protected int forecastTime;
|
||||
|
||||
@DynamicSerializeElement
|
||||
@XmlAttribute
|
||||
private String utilityFlag = null;
|
||||
|
||||
//list of master level values
|
||||
@DynamicSerializeElement
|
||||
@XmlElement(name="GPD-Level-Parameters")
|
||||
|
@ -177,4 +197,25 @@ public class GenericPointDataStationProduct {
|
|||
}
|
||||
|
||||
|
||||
public int getForecastTime() {
|
||||
return forecastTime;
|
||||
}
|
||||
|
||||
|
||||
public void setForecastTime(int forecastTime) {
|
||||
this.forecastTime = forecastTime;
|
||||
}
|
||||
|
||||
|
||||
public String getUtilityFlag() {
|
||||
return utilityFlag;
|
||||
}
|
||||
|
||||
|
||||
public void setUtilityFlag(String utilityFlag) {
|
||||
this.utilityFlag = utilityFlag;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
@ -156,7 +160,7 @@ public class GenericPointDataQuery extends PointDataQuery {
|
|||
ids.get(listIndex).add(id);
|
||||
indexes.get(listIndex).add(idx);
|
||||
}
|
||||
long t0 = System.currentTimeMillis();
|
||||
//long t0 = System.currentTimeMillis();
|
||||
for (int i = 0; i < files.size(); i++) {
|
||||
File file = new File(files.get(i));
|
||||
//for(String att: hdf5attribList){
|
||||
|
@ -180,10 +184,10 @@ public class GenericPointDataQuery extends PointDataQuery {
|
|||
masterPDC.setCurrentSz(masterPDC.getAllocatedSz());
|
||||
}
|
||||
}
|
||||
long t1 = System.currentTimeMillis();
|
||||
System.out
|
||||
.println("Total time (ms) spent on pointdata hdf5 retrieval (all files): "
|
||||
+ (t1 - t0));
|
||||
//long t1 = System.currentTimeMillis();
|
||||
//System.out
|
||||
// .println("Total time (ms) spent on pointdata hdf5 retrieval (all files): "
|
||||
// + (t1 - t0));
|
||||
}
|
||||
|
||||
if (!dbParamDesc.isEmpty()) {
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package gov.noaa.nws.ncep.common.dataplugin.gpd.query;
|
||||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
@ -33,13 +37,24 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class GenericPointDataReqMsg implements IServerRequest {
|
||||
public static enum GenericPointDataReqType{
|
||||
// get GPD in Java Object format
|
||||
// get GPD data in Java Object format
|
||||
GET_GPD_PRODUCT_OBJECT,
|
||||
GET_GPD_STATION_PRODUCT_OBJECT,
|
||||
GET_GPD_MOVING_PRODUCT_OBJECT,
|
||||
GET_GPD_STATION_PRODUCT_OBJECT_LIST,
|
||||
GET_GPD_MOVING_PRODUCT_OBJECT_LIST,
|
||||
GET_GPD_STATION_MDL_SND_PRODUCT_OBJECT_LIST,
|
||||
GET_GPD_MOVING_MDL_SND_PRODUCT_OBJECT_LIST,
|
||||
GET_GPD_PRODUCT_INFO_OBJECT,
|
||||
GET_GPD_PRODUCT_TIMELINE_OBJECT,
|
||||
GET_GPD_PRODUCT_RANGESTART_TIME_OBJECT,
|
||||
GET_GPD_STATION_INFO_COLLECTION_OBJECT,
|
||||
GET_GPD_ALL_AVAILABLE_PRODUCTS,
|
||||
GET_GPD_AVAILABLE_MODEL_SOUNDING_PRODUCTS, //GPD pfc sounding
|
||||
GET_GPD_AVAILABLE_OBSERVED_SOUNDING_PRODUCTS,
|
||||
GET_GPD_AVAILABLE_SURFACE_PRODUCTS,
|
||||
|
||||
//The following request types should not be used by CAVA JAVA applications
|
||||
//get/save product in XML format
|
||||
GET_GPD_PRODUCT_XML,
|
||||
GET_GPD_STATION_PRODUCT_XML,
|
||||
|
@ -52,6 +67,9 @@ public class GenericPointDataReqMsg implements IServerRequest {
|
|||
GET_GPD_MOVING_PRODUCT_GEMPAK_TBL,
|
||||
GET_GPD_PRODUCT_INFO_GEMPAK_TBL,
|
||||
STORE_GPD_PRODUCT_FROM_GEMPAK_TBL,
|
||||
STORE_GPD_MDL_SND_PRODUCT_FROM_GEMPAK_TBL,
|
||||
STORE_GPD_OBS_SND_PRODUCT_FROM_GEMPAK_TBL,
|
||||
STORE_GPD_OBS_SFC_PRODUCT_FROM_GEMPAK_TBL,
|
||||
//Purge GPD DB
|
||||
PURGE_GPD_PRODUCT_ONETIME,
|
||||
PURGE_GPD_PRODUCT_ALLTIME,
|
||||
|
@ -61,7 +79,7 @@ public class GenericPointDataReqMsg implements IServerRequest {
|
|||
public static enum GenericPointDataQueryKey{
|
||||
BY_STN_ID,
|
||||
BY_SLAT_SLON,
|
||||
BY_REPORT_NAME
|
||||
BY_PRODUCT_NAME
|
||||
}
|
||||
|
||||
//required for all
|
||||
|
@ -117,9 +135,20 @@ public class GenericPointDataReqMsg implements IServerRequest {
|
|||
@DynamicSerializeElement
|
||||
private String gpdDataString;
|
||||
|
||||
// used for query a list of time line for one station or moving product
|
||||
// used for query a list of time line's sounding data for one station or moving product
|
||||
//con be a list of reference time (for observed data) or a list of range start time (for pfc data)
|
||||
// used for CAVE Java query only...for now
|
||||
@DynamicSerializeElement
|
||||
private List<Date> refTimeList;
|
||||
private List<Date> queryTimeList;
|
||||
|
||||
//used for query station collection, forecast time, or pfc sounding data
|
||||
// used for CAVE Java query only...for now
|
||||
@DynamicSerializeElement
|
||||
private String refTimeStr;
|
||||
//used for query station collection for model/pfc sounding
|
||||
// used for CAVE Java query only...for now
|
||||
@DynamicSerializeElement
|
||||
private String rangeStartTimeStr;
|
||||
|
||||
public GenericPointDataReqMsg() {
|
||||
super();
|
||||
|
@ -320,12 +349,24 @@ public class GenericPointDataReqMsg implements IServerRequest {
|
|||
this.maxNumLevel = maxNumLevel;
|
||||
}
|
||||
|
||||
public List<Date> getRefTimeList() {
|
||||
return refTimeList;
|
||||
public List<Date> getQueryTimeList() {
|
||||
return queryTimeList;
|
||||
}
|
||||
|
||||
public void setRefTimeList(List<Date> refTimeList) {
|
||||
this.refTimeList = refTimeList;
|
||||
public void setQueryTimeList(List<Date> queryTimeList) {
|
||||
this.queryTimeList = queryTimeList;
|
||||
}
|
||||
public String getRefTimeStr() {
|
||||
return refTimeStr;
|
||||
}
|
||||
public void setRefTimeStr(String refTimeStr) {
|
||||
this.refTimeStr = refTimeStr;
|
||||
}
|
||||
public String getRangeStartTimeStr() {
|
||||
return rangeStartTimeStr;
|
||||
}
|
||||
public void setRangeStartTimeStr(String rangeStartTimeStr) {
|
||||
this.rangeStartTimeStr = rangeStartTimeStr;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
* 05/2010 144 L. Lin Migration to TO11DR11.
|
||||
* 11/2013 1066 G. Hull call constructCRSfromWKT
|
||||
* Nov 14, 2013 2393 bclement added getGridGeometry()
|
||||
* 03/2014 TTR957 B. Yin Modified getGridGeometry() to handle native navigation
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
|
@ -72,6 +73,9 @@ public class McidasMapCoverage extends PersistableDataObject implements
|
|||
|
||||
private static final long serialVersionUID = 1;
|
||||
|
||||
// projection id for native satellite navigation
|
||||
public static final int GVAR = 7585;
|
||||
|
||||
@Id
|
||||
private int pid;
|
||||
|
||||
|
@ -371,14 +375,33 @@ public class McidasMapCoverage extends PersistableDataObject implements
|
|||
public GridGeometry2D getGridGeometry()
|
||||
throws MismatchedDimensionException, FactoryException,
|
||||
TransformException {
|
||||
|
||||
GridEnvelope gridRange;
|
||||
Envelope crsRange;
|
||||
if (projection == McidasMapCoverage.GVAR) { // for native projection
|
||||
minX = getUpperLeftElement();
|
||||
int maxX = getUpperLeftElement() + (getNx() * getElementRes());
|
||||
minY = getUpperLeftLine() + (getNy() * getLineRes());
|
||||
minY = -minY;
|
||||
int maxY = -1 * getUpperLeftLine();
|
||||
|
||||
gridRange = new GridEnvelope2D(0, 0, nx, ny);
|
||||
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(minX,
|
||||
minY, maxX, maxY));
|
||||
}
|
||||
|
||||
else {
|
||||
int nx = getNx();
|
||||
int ny = getNy();
|
||||
if (Double.isNaN(this.minX) || Double.isNaN(this.minY)) {
|
||||
findMins();
|
||||
}
|
||||
GridEnvelope gridRange = new GridEnvelope2D(0, 0, nx, ny);
|
||||
Envelope crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(
|
||||
minX, minY, nx * getDx(), ny * getDy()));
|
||||
|
||||
gridRange = new GridEnvelope2D(0, 0, nx, ny);
|
||||
crsRange = new Envelope2D(getCrs(), new Rectangle2D.Double(minX,
|
||||
minY, nx * getDx(), ny * getDy()));
|
||||
}
|
||||
|
||||
return new GridGeometry2D(gridRange, crsRange);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
* 10/2009 144 T. Lee Created
|
||||
* 12/2009 144 T. Lee Migrated to TO11D6
|
||||
* 11/2013 1066 G. Hull constructCRSfromWKT (from McidasMapCoverage)
|
||||
* 03/2014 TTR957 B. Yin Moved constructCRSfromWKT to McidasCRSBuilder
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -19,10 +20,8 @@
|
|||
|
||||
package gov.noaa.nws.ncep.common.dataplugin.mcidas;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import gov.noaa.nws.ncep.common.dataplugin.mcidas.dao.McidasMapCoverageDao;
|
||||
import gov.noaa.nws.ncep.edex.util.McidasCRSBuilder;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -30,9 +29,6 @@ import org.apache.commons.logging.LogFactory;
|
|||
import org.geotools.geometry.DirectPosition2D;
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.parameter.ParameterValueGroup;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.NoSuchIdentifierException;
|
||||
import org.opengis.referencing.crs.CoordinateReferenceSystem;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
import org.opengis.referencing.operation.MathTransform;
|
||||
|
||||
|
@ -380,8 +376,8 @@ public class McidasSpatialFactory {
|
|||
ProjectedCRS crs = null;
|
||||
|
||||
// Get the correct CRS
|
||||
if (mapProjection == 7585) {
|
||||
crs = constructCRS(type, encodedNav);
|
||||
if (mapProjection == McidasMapCoverage.GVAR) {
|
||||
crs = McidasCRSBuilder.constructCRS(type, encodedNav);
|
||||
}
|
||||
|
||||
// Construct the polygon constructor String
|
||||
|
@ -413,66 +409,8 @@ public class McidasSpatialFactory {
|
|||
return new String(coded);
|
||||
}
|
||||
|
||||
public ProjectedCRS constructCRSfromWKT( String crsWKT) {
|
||||
Pattern p = Pattern.compile("PROJCS\\[\"MCIDAS\\sAREA\\s(.*)\"");
|
||||
Matcher m = p.matcher(crsWKT);
|
||||
m.find();
|
||||
ProjectedCRS crsObject=null;
|
||||
|
||||
if ( m.groupCount() == 1 ) {
|
||||
String type = m.group(1);
|
||||
//System.out.println("FOUND PROJCS:"+m.group(0)+":"+type);
|
||||
p = Pattern.compile("\\[\"NAV_BLOCK_BASE64\",\\s\"(.*)\"\\]");
|
||||
m = p.matcher(crsWKT);
|
||||
boolean found = m.find();
|
||||
|
||||
//System.out.println(m.group());
|
||||
//System.out.println(m.groupCount()+m.group(1));
|
||||
if ( found ) {
|
||||
String navBlock = m.group(1);
|
||||
crsObject = McidasSpatialFactory.getInstance().constructCRS(type, navBlock);
|
||||
}
|
||||
}
|
||||
|
||||
return crsObject;
|
||||
}
|
||||
|
||||
public ProjectedCRS constructCRS(String type, String encoded) {
|
||||
|
||||
ParameterValueGroup pvg = null;
|
||||
|
||||
DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
|
||||
try {
|
||||
pvg = dmtFactory.getDefaultParameters("MCIDAS_AREA_NAV");
|
||||
} catch (NoSuchIdentifierException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
* semi_major and semi_minor parameters are set to 1, so that no global
|
||||
* scaling is performed during coordinate transforms by
|
||||
* org.geotools.referencing.operation.projection.MapProjection based on
|
||||
* the radius of earth
|
||||
*/
|
||||
pvg.parameter("semi_major").setValue(1.0);
|
||||
pvg.parameter("semi_minor").setValue(1.0);
|
||||
pvg.parameter("central_meridian").setValue(0.0);
|
||||
// pvg.parameter("scale_factor").setValue(1.0);
|
||||
|
||||
pvg.parameter("NAV_BLOCK_BASE64").setValue(encoded);
|
||||
// System.out.println(pvg.toString() );
|
||||
|
||||
String projectionName = "MCIDAS AREA " + type;
|
||||
ProjectedCRS mcidasCRS = null;
|
||||
try {
|
||||
mcidasCRS = MapUtil.constructProjection(projectionName, pvg);
|
||||
} catch (NoSuchIdentifierException e) {
|
||||
e.printStackTrace();
|
||||
} catch (FactoryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return mcidasCRS;
|
||||
public ProjectedCRS constructCRSfromWKT(String crsWKT) {
|
||||
return McidasCRSBuilder.constructCRSfromWKT(crsWKT);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 22, 2013 sgilbert Initial creation
|
||||
* Jan 25, 2014 jwu Set default in accordance with those in "Product"
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -27,31 +28,31 @@ import com.raytheon.uf.common.serialization.comm.IServerRequest;
|
|||
public class ActivityInfo implements IServerRequest {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String activityName = "defaultName";
|
||||
private String activityName = "Default";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String activityType = "defaultType";
|
||||
private String activityType = "Default";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String activitySubtype = "defaultSubtype";
|
||||
private String activitySubtype = "";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String activityLabel = "defaultLabel";
|
||||
private String activityLabel = "Default";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String site = "site1";
|
||||
private String site = "";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String desk = "desk1";
|
||||
private String desk = "";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String forecaster = "person1";
|
||||
private String forecaster = "";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Calendar refTime = Calendar.getInstance();
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String mode = "Unknown";
|
||||
private String mode = "OPERATIONAL";
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String status = "Unknown";
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* Jun 26, 2013 bhebbard Added SequenceGenerator annotation
|
||||
* Jul 22, 2013 1977 rjpeter Added getDataURI and annotations.
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Jan,29, 2014 1105 jwu Added ACTIVITY_SUBTYPE
|
||||
* </pre>
|
||||
*
|
||||
* @author sgilbert
|
||||
|
@ -53,6 +54,8 @@ public class PgenRecord extends PersistablePluginDataObject {
|
|||
|
||||
public static final String ACTIVITY_TYPE = "activityType";
|
||||
|
||||
public static final String ACTIVITY_SUBTYPE = "activitySubtype";
|
||||
|
||||
public static final String ACTIVITY_LABEL = "activityLabel";
|
||||
|
||||
public static final String ACTIVITY_NAME = "activityName";
|
||||
|
|
|
@ -17,16 +17,17 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.vividsolutions.jts.geom.Geometry;
|
||||
import com.vividsolutions.jts.geom.MultiPolygon;
|
||||
import com.vividsolutions.jts.geom.Polygon;
|
||||
|
||||
/**
|
||||
* Interface that contains all methods to load NCEP static data.
|
||||
* This interface is also used to look up the data provider service in client side, such as PGEN.
|
||||
* Interface that contains all methods to load NCEP static data. This interface
|
||||
* is also used to look up the data provider service in client side, such as
|
||||
* PGEN.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
|
@ -37,6 +38,7 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
* 08/12 #770 Q. Zhou added loadContWatchNum()
|
||||
* 09/12 ? B. Yin Changed county cluster return type.
|
||||
* 01/13 #966 B. Yin Added methods to load bounds into.
|
||||
* 03/14 Trac 1112 S. Russell Added getActiveCounties()
|
||||
* </pre>
|
||||
*
|
||||
* @author B. Yin
|
||||
|
@ -44,65 +46,95 @@ import com.vividsolutions.jts.geom.Polygon;
|
|||
|
||||
public interface IStaticDataProvider {
|
||||
public StationTable getSfStnTbl();
|
||||
|
||||
public StationTable getAnchorTbl();
|
||||
|
||||
public StationTable getVorTbl();
|
||||
|
||||
public StationTable getVolcanoTbl();
|
||||
public HashMap<String,Set<String>> getClstTbl();
|
||||
|
||||
public HashMap<String, Set<String>> getClstTbl();
|
||||
|
||||
public List<SPCCounty> getSPCCounties();
|
||||
public SPCCounty findCounty( String fips);
|
||||
public List<SPCCounty> getCountiesInGeometry(Geometry geo );
|
||||
|
||||
public SPCCounty findCounty(String fips);
|
||||
|
||||
public List<SPCCounty> getCountiesInGeometry(Geometry geo);
|
||||
|
||||
public List<USState> getAllstates();
|
||||
|
||||
public List<USState> loadStateTable();
|
||||
|
||||
public ArrayList<USState> statesInGeometry(Geometry geo);
|
||||
|
||||
public List<Rfc> getAllRfcs();
|
||||
|
||||
public List<Rfc> loadRfcTable();
|
||||
|
||||
public ArrayList<Rfc> rfcsInGeometry(Geometry geo);
|
||||
|
||||
public boolean isRfcLoaded();
|
||||
|
||||
public List<Cwa> getAllCwas();
|
||||
|
||||
public List<Cwa> loadCwaTable();
|
||||
|
||||
public ArrayList<Cwa> cwasInGeometry(Geometry geo);
|
||||
|
||||
public HashMap<String, String> getStateAbrvMap();
|
||||
|
||||
//localization
|
||||
// TRAC 1112
|
||||
public List<String> getActiveCounties(int watchNum, List<SPCCounty> oldCountyList);
|
||||
|
||||
// localization
|
||||
public String getPgenLocalizationRoot();
|
||||
|
||||
public String getFileAbsolutePath(String fileLoczlizationPath);
|
||||
|
||||
public File getFile(String fileLoczlizationPath);
|
||||
public LocalizationFile getStaticLocalizationFile( String fileName );
|
||||
public LocalizationFile getLocalizationFile( LocalizationContext context, String fileName );
|
||||
|
||||
public LocalizationContext getLocalizationContext( LocalizationType type, LocalizationLevel level);
|
||||
public LocalizationFile getStaticLocalizationFile(String fileName);
|
||||
|
||||
public LocalizationFile getLocalizationFile(LocalizationContext context, String fileName);
|
||||
|
||||
public LocalizationContext getLocalizationContext(LocalizationType type, LocalizationLevel level);
|
||||
|
||||
public File getStaticFile(String fname);
|
||||
|
||||
public File getStaticFile( String fname );
|
||||
public File getGeogFile();
|
||||
|
||||
public File getSfcStnFile();
|
||||
|
||||
public File getFirBoundsFile();
|
||||
|
||||
//This is for sigmet
|
||||
// This is for sigmet
|
||||
public List<Object[]> queryNcepDB(String field, String table);
|
||||
|
||||
//for TCA
|
||||
// for TCA
|
||||
public HashMap<String, String> getZoneMap();
|
||||
|
||||
//for GFA
|
||||
// for GFA
|
||||
public List<FAArea> getFAAreas();
|
||||
|
||||
public List<FAArea> getFAAreaX();
|
||||
|
||||
public List<FARegion> getFARegions();
|
||||
|
||||
public List<GreatLake> getGreatLakes();
|
||||
|
||||
public List<CostalWater> getCostalWaters();
|
||||
|
||||
//for g2g
|
||||
// for g2g
|
||||
public ArrayList<MultiPolygon> getG2GBounds(String tableAlias, String columnName, String columnValue);
|
||||
|
||||
//for continuing watches
|
||||
// for continuing watches
|
||||
public List<String> loadContWatchNum();
|
||||
|
||||
//for clipping bounds
|
||||
// for clipping bounds
|
||||
public List<String> getBoundsTableList();
|
||||
public List<String> getBoundsNames( String table );
|
||||
public Polygon loadBounds( String boundsTable, String boundsName );
|
||||
|
||||
public List<String> getBoundsNames(String table);
|
||||
|
||||
public Polygon loadBounds(String boundsTable, String boundsName);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package gov.noaa.nws.ncep.edex.common.metparameters;
|
||||
|
||||
|
||||
import java.text.ParseException;
|
||||
|
||||
import javax.measure.unit.SI;
|
||||
import javax.measure.unit.Unit;
|
||||
import javax.measure.unit.UnitFormat;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.raytheon.uf.common.serialization.ISerializableObject;
|
||||
import com.raytheon.uf.common.serialization.adapters.UnitAdapter;
|
||||
|
@ -27,6 +24,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
* 10/16/2011 G Hull make sure types of missing data and value are the same;
|
||||
* make value private
|
||||
* 11/14/2011 B Hebbard Resolve unit serialization issues
|
||||
* 04/01/2014 #1040 B Hebbard In syncUnits(), map unitStr "count" to Unit.ONE
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,7 +44,7 @@ public class Amount implements ISerializableObject {
|
|||
|
||||
// TODO : add capability to let user set their own missing data value.
|
||||
@DynamicSerializeElement
|
||||
private Number missing_data_value = new Double( -9999 );
|
||||
private Number missing_data_value = new Double(-9999);
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Number value = missing_data_value;
|
||||
|
@ -60,30 +58,31 @@ public class Amount implements ISerializableObject {
|
|||
private transient Unit<?> unit;
|
||||
|
||||
// To simplify the
|
||||
public Amount( Number val, Unit<?> unit) {
|
||||
//System.out.println("Constructor 0 called -- val " + val + " unit " + unit);
|
||||
public Amount(Number val, Unit<?> unit) {
|
||||
// System.out.println("Constructor 0 called -- val " + val + " unit " +
|
||||
// unit);
|
||||
initMissingDataSentinel();
|
||||
|
||||
setValue( val, unit );
|
||||
setValue(val, unit);
|
||||
}
|
||||
|
||||
public Amount( Unit<?> u ) {
|
||||
//System.out.println("Constructor 1 called -- u " + u);
|
||||
setValue( missing_data_value, u );
|
||||
public Amount(Unit<?> u) {
|
||||
// System.out.println("Constructor 1 called -- u " + u);
|
||||
setValue(missing_data_value, u);
|
||||
}
|
||||
|
||||
public Amount(String unitStr) {
|
||||
//System.out.println("Constructor 2 called -- unitStr " + unitStr);
|
||||
// System.out.println("Constructor 2 called -- unitStr " + unitStr);
|
||||
try {
|
||||
Unit<?> u = new UnitAdapter().unmarshal(unitStr);
|
||||
setValue( missing_data_value, u );
|
||||
setValue(missing_data_value, u);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public Amount() {
|
||||
//System.out.println("Constructor 3 called");
|
||||
// System.out.println("Constructor 3 called");
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
@ -95,27 +94,27 @@ public class Amount implements ISerializableObject {
|
|||
|
||||
// call hasValidValue before calling this method.
|
||||
//
|
||||
public Number getValueAs( Unit<?> unitNeeded ) {
|
||||
if( unitNeeded != unit && unitNeeded.isCompatible( unit ) ) {
|
||||
double newValue = unit.getConverterTo(unitNeeded).convert( value.doubleValue() );
|
||||
public Number getValueAs(Unit<?> unitNeeded) {
|
||||
if (unitNeeded != unit && unitNeeded.isCompatible(unit)) {
|
||||
double newValue = unit.getConverterTo(unitNeeded).convert(
|
||||
value.doubleValue());
|
||||
return newValue;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
//public Unit<?> getUnit() {
|
||||
// public Unit<?> getUnit() {
|
||||
// return unit;
|
||||
//}
|
||||
// }
|
||||
|
||||
public Unit<?> getUnit() {
|
||||
if (this.unitStr == null)
|
||||
return Unit.ONE;
|
||||
if (this.unit == null) {
|
||||
try {
|
||||
this.unit = (Unit<?>) UnitFormat.getUCUMInstance()
|
||||
.parseObject(this.unitStr);
|
||||
this.unit = (Unit<?>) UnitFormat.getUCUMInstance().parseObject(
|
||||
this.unitStr);
|
||||
} catch (ParseException e) {
|
||||
// logger.warn("ParseException while parsing unit string: "
|
||||
// + this.unit + " defaulting to unit: " + Unit.ONE);
|
||||
|
@ -125,14 +124,15 @@ public class Amount implements ISerializableObject {
|
|||
return this.unit;
|
||||
}
|
||||
|
||||
public void setValue( Amount v ) {
|
||||
//System.out.println("Amount.setValue(Amount v) called with v " + v);
|
||||
setValue( v.value, v.unit );
|
||||
public void setValue(Amount v) {
|
||||
// System.out.println("Amount.setValue(Amount v) called with v " + v);
|
||||
setValue(v.value, v.unit);
|
||||
}
|
||||
|
||||
public void setValue( Number n ) {
|
||||
//System.out.println("Amount.setValue(Number n) called with n " + n + " and unit " + unit);
|
||||
//setValue( n, unit );
|
||||
public void setValue(Number n) {
|
||||
// System.out.println("Amount.setValue(Number n) called with n " + n +
|
||||
// " and unit " + unit);
|
||||
// setValue( n, unit );
|
||||
value = n;
|
||||
}
|
||||
|
||||
|
@ -144,88 +144,80 @@ public class Amount implements ISerializableObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param missing_data_value the missing_data_value to set
|
||||
* @param missing_data_value
|
||||
* the missing_data_value to set
|
||||
*/
|
||||
public final void setMissing_data_value(Number missing_data_value) {
|
||||
this.missing_data_value = missing_data_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setValueAs ( Number n, String unitStr ) {
|
||||
public void setValueAs(Number n, String unitStr) {
|
||||
try {
|
||||
Unit<?> u = new UnitAdapter().unmarshal(unitStr);
|
||||
setValue( n, u );
|
||||
setValue(n, u);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
public void setValue( Number n, Unit<?> u ) {
|
||||
public void setValue(Number n, Unit<?> u) {
|
||||
value = n;
|
||||
//unit = u;
|
||||
// unit = u;
|
||||
setUnitPair(u);
|
||||
|
||||
// to make the hasValidValue method simpler, ensure that the types
|
||||
// of the value and missing data value are the same.
|
||||
// (wonder if there is a nicer way to do this for all Number types?)
|
||||
if( !value.getClass().equals( missing_data_value.getClass() ) ) {
|
||||
if( value instanceof Double ) {
|
||||
missing_data_value = new Double( missing_data_value.doubleValue() );
|
||||
}
|
||||
else if( value instanceof Float ) {
|
||||
missing_data_value = new Float( missing_data_value.floatValue() );
|
||||
}
|
||||
else if( value instanceof Short ) {
|
||||
missing_data_value = new Short( missing_data_value.shortValue() );
|
||||
}
|
||||
else if( value instanceof Integer ) {
|
||||
missing_data_value = new Integer( missing_data_value.intValue() );
|
||||
}
|
||||
else if( value instanceof Long ) {
|
||||
missing_data_value = new Long( missing_data_value.longValue() );
|
||||
}
|
||||
else if( value instanceof Byte ) {
|
||||
missing_data_value = new Byte( missing_data_value.byteValue() );
|
||||
}
|
||||
else {
|
||||
System.out.println("Amount: missing_data_value and value are of different types?");
|
||||
if (!value.getClass().equals(missing_data_value.getClass())) {
|
||||
if (value instanceof Double) {
|
||||
missing_data_value = new Double(
|
||||
missing_data_value.doubleValue());
|
||||
} else if (value instanceof Float) {
|
||||
missing_data_value = new Float(missing_data_value.floatValue());
|
||||
} else if (value instanceof Short) {
|
||||
missing_data_value = new Short(missing_data_value.shortValue());
|
||||
} else if (value instanceof Integer) {
|
||||
missing_data_value = new Integer(missing_data_value.intValue());
|
||||
} else if (value instanceof Long) {
|
||||
missing_data_value = new Long(missing_data_value.longValue());
|
||||
} else if (value instanceof Byte) {
|
||||
missing_data_value = new Byte(missing_data_value.byteValue());
|
||||
} else {
|
||||
System.out
|
||||
.println("Amount: missing_data_value and value are of different types?");
|
||||
}
|
||||
}
|
||||
|
||||
// if( hasValidValue() ) {
|
||||
// System.out.println( getClass().getName() +" has valid value "+ n.toString() );
|
||||
// }
|
||||
// if( hasValidValue() ) {
|
||||
// System.out.println( getClass().getName() +" has valid value "+
|
||||
// n.toString() );
|
||||
// }
|
||||
}
|
||||
|
||||
// make sure the missing data sentinal and the stored value are of the
|
||||
// same type so that the comparisons will work.
|
||||
//
|
||||
public void initMissingDataSentinel( ) { // Number mds ) {
|
||||
public void initMissingDataSentinel() { // Number mds ) {
|
||||
// limit the number of
|
||||
if( value instanceof Double ) {
|
||||
missing_data_value = new Double( -9999 );
|
||||
}
|
||||
else if( value instanceof Float ) {
|
||||
missing_data_value = new Float( -9999 );
|
||||
}
|
||||
else if( value instanceof Integer ) {
|
||||
missing_data_value = new Integer( -9999 );
|
||||
}
|
||||
else if( value instanceof Long ) {
|
||||
missing_data_value = new Long( -9999 );
|
||||
}
|
||||
else if( value instanceof Short ) {
|
||||
missing_data_value = new Short( (short)-9999 );
|
||||
}
|
||||
else {
|
||||
System.out.println("Error: Number object in Amount is not one of the supported types: "+
|
||||
"Double, Float, Integer, Long or Short" );
|
||||
if (value instanceof Double) {
|
||||
missing_data_value = new Double(-9999);
|
||||
} else if (value instanceof Float) {
|
||||
missing_data_value = new Float(-9999);
|
||||
} else if (value instanceof Integer) {
|
||||
missing_data_value = new Integer(-9999);
|
||||
} else if (value instanceof Long) {
|
||||
missing_data_value = new Long(-9999);
|
||||
} else if (value instanceof Short) {
|
||||
missing_data_value = new Short((short) -9999);
|
||||
} else {
|
||||
System.out
|
||||
.println("Error: Number object in Amount is not one of the supported types: "
|
||||
+ "Double, Float, Integer, Long or Short");
|
||||
}
|
||||
}
|
||||
|
||||
public void setMissingDataSentinel( Number mds ) {
|
||||
public void setMissingDataSentinel(Number mds) {
|
||||
missing_data_value = mds;
|
||||
}
|
||||
|
||||
|
@ -243,99 +235,101 @@ public class Amount implements ISerializableObject {
|
|||
if (unit == null) {
|
||||
return false;
|
||||
}
|
||||
if( !value.getClass().equals(missing_data_value.getClass() ) ) {
|
||||
//TODO: Do we care? See a lot of Double/Float differences
|
||||
//System.out.println("value and missingDataValue are of different types.");
|
||||
if (!value.getClass().equals(missing_data_value.getClass())) {
|
||||
// TODO: Do we care? See a lot of Double/Float differences
|
||||
// System.out.println("value and missingDataValue are of different types.");
|
||||
}
|
||||
if( value == null ||
|
||||
value.equals( missing_data_value ) ) {
|
||||
//|| value.doubleValue() <= missing_data_value.doubleValue()) ) {
|
||||
if (value == null || value.equals(missing_data_value)) {
|
||||
// || value.doubleValue() <= missing_data_value.doubleValue()) ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setValueToMissing( ) {
|
||||
public void setValueToMissing() {
|
||||
value = missing_data_value;
|
||||
}
|
||||
|
||||
public void setUnit( Unit<?> u ) {
|
||||
public void setUnit(Unit<?> u) {
|
||||
// Set the unit field only, but not the associated string.
|
||||
/*DEBUG
|
||||
String oldUnitStr = (unitStr == null ? "NULL" : UnitFormat.getUCUMInstance().format(unit));
|
||||
String newUnitStr = UnitFormat.getUCUMInstance().format(u);
|
||||
if (oldUnitStr.equals("Pa") && newUnitStr.equals("hPa")) {
|
||||
System.out.println("In setUnit for... " + this.getClass());
|
||||
System.out.println("...changing from Pa to hPa...");
|
||||
}
|
||||
if (oldUnitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
System.out.println("In setUnit for... " + this.getClass());
|
||||
System.out.println("...changing from hPa to Pa...");
|
||||
}
|
||||
DEBUG*/
|
||||
/*
|
||||
* DEBUG String oldUnitStr = (unitStr == null ? "NULL" :
|
||||
* UnitFormat.getUCUMInstance().format(unit)); String newUnitStr =
|
||||
* UnitFormat.getUCUMInstance().format(u); if (oldUnitStr.equals("Pa")
|
||||
* && newUnitStr.equals("hPa")) {
|
||||
* System.out.println("In setUnit for... " + this.getClass());
|
||||
* System.out.println("...changing from Pa to hPa..."); } if
|
||||
* (oldUnitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
* System.out.println("In setUnit for... " + this.getClass());
|
||||
* System.out.println("...changing from hPa to Pa..."); } DEBUG
|
||||
*/
|
||||
unit = u;
|
||||
}
|
||||
|
||||
public void setUnitPair( Unit<?> u ) {
|
||||
public void setUnitPair(Unit<?> u) {
|
||||
// Set the unit object and string, but do not convert existing value.
|
||||
unit = u;
|
||||
/*DEBUG
|
||||
String newUnitStr = UnitFormat.getUCUMInstance().format(u);
|
||||
if (unitStr.equals("Pa") && newUnitStr.equals("hPa")) {
|
||||
System.out.println("In setUnitPair for... " + this.getClass());
|
||||
System.out.println("...changing from Pa to hPa...");
|
||||
}
|
||||
if (unitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
System.out.println("In setUnitPair for... " + this.getClass());
|
||||
System.out.println("...changing from hPa to Pa...");
|
||||
}
|
||||
unitStr = newUnitStr;
|
||||
DEBUG*/
|
||||
/*
|
||||
* DEBUG String newUnitStr = UnitFormat.getUCUMInstance().format(u); if
|
||||
* (unitStr.equals("Pa") && newUnitStr.equals("hPa")) {
|
||||
* System.out.println("In setUnitPair for... " + this.getClass());
|
||||
* System.out.println("...changing from Pa to hPa..."); } if
|
||||
* (unitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
* System.out.println("In setUnitPair for... " + this.getClass());
|
||||
* System.out.println("...changing from hPa to Pa..."); } unitStr =
|
||||
* newUnitStr; DEBUG
|
||||
*/
|
||||
unitStr = UnitFormat.getUCUMInstance().format(u);
|
||||
}
|
||||
|
||||
public void setUnitPairAndConvertValue( Unit<?> u ) {
|
||||
public void setUnitPairAndConvertValue(Unit<?> u) {
|
||||
// Set the unit object and string, and convert an existing value to
|
||||
// the new unit
|
||||
if( hasValidValue() ) {
|
||||
value = getValueAs( u );
|
||||
if (hasValidValue()) {
|
||||
value = getValueAs(u);
|
||||
}
|
||||
|
||||
unit = u;
|
||||
/*DEBUG
|
||||
String newUnitStr = UnitFormat.getUCUMInstance().format(u);
|
||||
if (unitStr.equals("Pa") && newUnitStr.equals("hPa")) {
|
||||
System.out.println("In setUnitPairAndConvertValue for... " + this.getClass());
|
||||
System.out.println("...changing from Pa to hPa...");
|
||||
}
|
||||
if (unitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
System.out.println("In setUnitPairAndConvertValue for... " + this.getClass());
|
||||
System.out.println("...changing from hPa to Pa...");
|
||||
}
|
||||
unitStr = newUnitStr;
|
||||
DEBUG*/
|
||||
/*
|
||||
* DEBUG String newUnitStr = UnitFormat.getUCUMInstance().format(u); if
|
||||
* (unitStr.equals("Pa") && newUnitStr.equals("hPa")) {
|
||||
* System.out.println("In setUnitPairAndConvertValue for... " +
|
||||
* this.getClass());
|
||||
* System.out.println("...changing from Pa to hPa..."); } if
|
||||
* (unitStr.equals("hPa") && newUnitStr.equals("Pa")) {
|
||||
* System.out.println("In setUnitPairAndConvertValue for... " +
|
||||
* this.getClass());
|
||||
* System.out.println("...changing from hPa to Pa..."); } unitStr =
|
||||
* newUnitStr; DEBUG
|
||||
*/
|
||||
unitStr = UnitFormat.getUCUMInstance().format(u);
|
||||
}
|
||||
|
||||
public void syncUnits() {
|
||||
Unit<?> u;
|
||||
if (unitStr.equals("count")) {
|
||||
u = Unit.ONE;
|
||||
} else {
|
||||
try {
|
||||
u = new UnitAdapter().unmarshal(unitStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//System.out.println("Amount.syncUnits(): 'unitStr' invalid!!");
|
||||
// System.out.println("Amount.syncUnits(): 'unitStr' string '"
|
||||
// + unitStr + "' invalid!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (unit == null) {
|
||||
//System.out.println("Amount.syncUnits(): 'unit' NULL, using unitStr value " + unitStr);
|
||||
// System.out.println("Amount.syncUnits(): 'unit' NULL, using unitStr value "
|
||||
// + unitStr);
|
||||
unit = u;
|
||||
}
|
||||
else if (!unit.equals(u)) {
|
||||
//System.out.println("Amount.syncUnits(): 'unit' is " + u + ", but unitStr is " + unitStr + " using the latter");
|
||||
} else if (!unit.equals(u)) {
|
||||
// System.out.println("Amount.syncUnits(): 'unit' is " + u +
|
||||
// ", but unitStr is " + unitStr + " using the latter");
|
||||
unit = u;
|
||||
}
|
||||
else {
|
||||
//System.out.println("Amount.syncUnits(): Good! 'unit' is " + u + ", and unitStr is " + unitStr);
|
||||
} else {
|
||||
// System.out.println("Amount.syncUnits(): Good! 'unit' is " + u +
|
||||
// ", and unitStr is " + unitStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package gov.noaa.nws.ncep.edex.common.sounding;
|
||||
|
||||
/**
|
||||
*
|
||||
* gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer
|
||||
|
@ -15,6 +16,7 @@ package gov.noaa.nws.ncep.edex.common.sounding;
|
|||
* ------- ------- -------- -----------
|
||||
* 09/13/2010 229 Chin Chen Initial coding
|
||||
* 11/2010 301 T. Lee Moved Comparator to SoundingUtil
|
||||
* 03/2014 1116 T. Lee Added constructor argument for DPD
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -24,7 +26,6 @@ package gov.noaa.nws.ncep.edex.common.sounding;
|
|||
|
||||
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
|
@ -39,29 +40,34 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
@XmlRootElement
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
@DynamicSerialize
|
||||
public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
||||
public class NcSoundingLayer implements ISerializableObject, Cloneable {
|
||||
@DynamicSerializeElement
|
||||
private static final long serialVersionUID = 1324632468L;
|
||||
|
||||
public static final float MISSING = IDecoderConstantsN.UAIR_FLOAT_MISSING;//-9999.f;
|
||||
public static final float MISSING = IDecoderConstantsN.UAIR_FLOAT_MISSING;// -9999.f;
|
||||
|
||||
public static final float LEGACY_MISSING = -999.f;
|
||||
//UAIR (standard) data type definitions
|
||||
|
||||
// UAIR (standard) data type definitions
|
||||
public static enum DataType {
|
||||
TTAA, TTBB, TTCC, TTDD, PPAA, PPBB, PPCC, PPDD,
|
||||
UUAA, UUBB, UUCC, UUDD, MAXWIND_A,MAXWIND_C, TROPOPAUSE_A, TROPOPAUSE_C, ALLDATA
|
||||
TTAA, TTBB, TTCC, TTDD, PPAA, PPBB, PPCC, PPDD, UUAA, UUBB, UUCC, UUDD, MAXWIND_A, MAXWIND_C, TROPOPAUSE_A, TROPOPAUSE_C, ALLDATA
|
||||
}
|
||||
|
||||
//mapping from UAIR (standard) data type to BUFRUA data type.
|
||||
public static HashMap<String,Integer > dataTypeMap = new HashMap<String,Integer>();
|
||||
// mapping from UAIR (standard) data type to BUFRUA data type.
|
||||
public static HashMap<String, Integer> dataTypeMap = new HashMap<String, Integer>();
|
||||
static {
|
||||
dataTypeMap.put(DataType.TTAA.toString(), 2020); //Mandatory, Troppause, MaxWind
|
||||
dataTypeMap.put(DataType.TTCC.toString(), 2030); //Mandatory, Troppause, MaxWind
|
||||
dataTypeMap.put(DataType.TTBB.toString(), 2022); //SigT
|
||||
dataTypeMap.put(DataType.TTDD.toString(), 2032); //SigT
|
||||
dataTypeMap.put(DataType.PPBB.toString(), 2021); //SigW
|
||||
dataTypeMap.put(DataType.PPDD.toString(), 2031); //SigW
|
||||
dataTypeMap.put(DataType.PPAA.toString(), 0000); //TBD, BUFRUA does not support this now
|
||||
dataTypeMap.put(DataType.PPCC.toString(), 0000); //TBD, BUFRUA does not support this now
|
||||
dataTypeMap.put(DataType.TTAA.toString(), 2020); // Mandatory,
|
||||
// Troppause, MaxWind
|
||||
dataTypeMap.put(DataType.TTCC.toString(), 2030); // Mandatory,
|
||||
// Troppause, MaxWind
|
||||
dataTypeMap.put(DataType.TTBB.toString(), 2022); // SigT
|
||||
dataTypeMap.put(DataType.TTDD.toString(), 2032); // SigT
|
||||
dataTypeMap.put(DataType.PPBB.toString(), 2021); // SigW
|
||||
dataTypeMap.put(DataType.PPDD.toString(), 2031); // SigW
|
||||
dataTypeMap.put(DataType.PPAA.toString(), 0000); // TBD, BUFRUA does not
|
||||
// support this now
|
||||
dataTypeMap.put(DataType.PPCC.toString(), 0000); // TBD, BUFRUA does not
|
||||
// support this now
|
||||
dataTypeMap.put(DataType.MAXWIND_A.toString(), 2020);
|
||||
dataTypeMap.put(DataType.TROPOPAUSE_A.toString(), 2020);
|
||||
dataTypeMap.put(DataType.MAXWIND_C.toString(), 2030);
|
||||
|
@ -69,24 +75,18 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
|
||||
}
|
||||
|
||||
/* Chin's Note: user should use either the following string or, for example,
|
||||
/*
|
||||
* Chin's Note: user should use either the following string or, for example,
|
||||
* DataType.TTAA.toString() for "data type" coding.
|
||||
*
|
||||
public static String TTAA = "TTAA";
|
||||
public static String TTBB = "TTBB";
|
||||
public static String TTCC = "TTCC";
|
||||
public static String TTDD = "TTDD";
|
||||
public static String PPAA = "PPAA";
|
||||
public static String PPBB = "PPBB";
|
||||
public static String PPCC = "PPCC";
|
||||
public static String PPDD = "PPDD";
|
||||
public static String MAXWIND = "MAXWIND";
|
||||
public static String TROPOPAUSE = "TROPOPAUSE";
|
||||
public static String ALLDATA = "ALLDATA";
|
||||
public static String UUAA = "UUAA";
|
||||
public static String UUBB = "UUBB";
|
||||
public static String UUCC = "UUCC";
|
||||
public static String UUDD = "UUDD";
|
||||
* public static String TTAA = "TTAA"; public static String TTBB = "TTBB";
|
||||
* public static String TTCC = "TTCC"; public static String TTDD = "TTDD";
|
||||
* public static String PPAA = "PPAA"; public static String PPBB = "PPBB";
|
||||
* public static String PPCC = "PPCC"; public static String PPDD = "PPDD";
|
||||
* public static String MAXWIND = "MAXWIND"; public static String TROPOPAUSE
|
||||
* = "TROPOPAUSE"; public static String ALLDATA = "ALLDATA"; public static
|
||||
* String UUAA = "UUAA"; public static String UUBB = "UUBB"; public static
|
||||
* String UUCC = "UUCC"; public static String UUDD = "UUDD";
|
||||
*/
|
||||
public static String DATATYPE_MISSING = "";
|
||||
|
||||
|
@ -130,10 +130,13 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
@DynamicSerializeElement
|
||||
private float specHumidity;
|
||||
|
||||
//relative humidity
|
||||
// relative humidity
|
||||
@DynamicSerializeElement
|
||||
private float relativeHumidity;
|
||||
|
||||
// dewpoint depression
|
||||
@DynamicSerializeElement
|
||||
private float dpd;
|
||||
|
||||
public NcSoundingLayer() {
|
||||
this.pressure = MISSING;
|
||||
|
@ -147,6 +150,7 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
this.omega = MISSING;
|
||||
this.specHumidity = MISSING;
|
||||
this.relativeHumidity = MISSING;
|
||||
this.dpd = MISSING;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,11 +164,13 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
* @param windV
|
||||
* @param omega
|
||||
* @param specHumidity
|
||||
* @param dewDepression
|
||||
* @param dataType
|
||||
*/
|
||||
public NcSoundingLayer(float pressure, float geoHeight, float temperature,
|
||||
float dewpoint, float windSpeed, float windDirection, float windU,
|
||||
float windV, float omega, float specHumidity, float relativeHumidity) {
|
||||
float windV, float omega, float specHumidity,
|
||||
float relativeHumidity, float dpd) {
|
||||
super();
|
||||
this.pressure = pressure;
|
||||
this.geoHeight = geoHeight;
|
||||
|
@ -177,17 +183,15 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
this.omega = omega;
|
||||
this.specHumidity = specHumidity;
|
||||
this.relativeHumidity = relativeHumidity;
|
||||
this.dpd = dpd;
|
||||
|
||||
}
|
||||
/*
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
* public String getDataType() { return dataType; }
|
||||
*
|
||||
* public void setDataType(String dataType) { this.dataType = dataType; }
|
||||
*/
|
||||
/**
|
||||
* @return the pressure in hectoPascals (milliBars)
|
||||
*/
|
||||
|
@ -348,8 +352,6 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
this.omega = omega;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float getSpecHumidity() {
|
||||
return specHumidity;
|
||||
}
|
||||
|
@ -358,7 +360,6 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
this.specHumidity = specHumidity;
|
||||
}
|
||||
|
||||
|
||||
public float getRelativeHumidity() {
|
||||
return relativeHumidity;
|
||||
}
|
||||
|
@ -367,6 +368,14 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
this.relativeHumidity = relativeHumidity;
|
||||
}
|
||||
|
||||
public float getDpd() {
|
||||
return dpd;
|
||||
}
|
||||
|
||||
public void setDpd(float dpd) {
|
||||
this.dpd = dpd;
|
||||
}
|
||||
|
||||
private void computeUV() {
|
||||
if (windSpeed > MISSING && windDirection > MISSING) {
|
||||
Coordinate uv = uvComp(windSpeed, windDirection);
|
||||
|
@ -443,20 +452,19 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
return retValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a clone of this object.
|
||||
*
|
||||
* @return The cloned data.
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pressure=" + getPressure() + "mb:Z="
|
||||
+ getGeoHeight() + "m:T=" + getTemperature() + "\u00B0C:Td="
|
||||
+ getDewpoint() + "\u00B0C:WS=" + getWindSpeed() + "m/s:WD="
|
||||
+ getWindDirection() + "\u00B0:SH="+ getSpecHumidity() ;
|
||||
return "Pressure=" + getPressure() + "mb:Z=" + getGeoHeight() + "m:T="
|
||||
+ getTemperature() + "\u00B0C:Td=" + getDewpoint()
|
||||
+ "\u00B0C:WS=" + getWindSpeed() + "m/s:WD="
|
||||
+ getWindDirection() + "\u00B0:SH=" + getSpecHumidity()
|
||||
+ "\u00B0C" + getDpd();
|
||||
|
||||
}
|
||||
|
||||
|
@ -478,6 +486,7 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
result = prime * result + Float.floatToIntBits(windSpeed);
|
||||
result = prime * result + Float.floatToIntBits(specHumidity);
|
||||
result = prime * result + Float.floatToIntBits(relativeHumidity);
|
||||
result = prime * result + Float.floatToIntBits(dpd);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -534,10 +543,12 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
.floatToIntBits(other.relativeHumidity)) {
|
||||
return false;
|
||||
}
|
||||
if (Float.floatToIntBits(dpd) != Float.floatToIntBits(other.dpd)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert wind speed and direction to U/V components.
|
||||
*
|
||||
|
@ -561,6 +572,7 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
}
|
||||
return new Coordinate(spd, dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of this object.
|
||||
*
|
||||
|
@ -571,5 +583,4 @@ public class NcSoundingLayer implements ISerializableObject, Cloneable{
|
|||
return super.clone();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
* gov.noaa.nws.ncep.edex.util.McidasCRSBuilder
|
||||
*
|
||||
* March 2014
|
||||
*
|
||||
* This code has been developed by the NCEP/SIB for use in the AWIPS2 system.
|
||||
*/
|
||||
|
||||
package gov.noaa.nws.ncep.edex.util;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.geotools.referencing.operation.DefaultMathTransformFactory;
|
||||
import org.opengis.parameter.ParameterValueGroup;
|
||||
import org.opengis.referencing.FactoryException;
|
||||
import org.opengis.referencing.NoSuchIdentifierException;
|
||||
import org.opengis.referencing.crs.ProjectedCRS;
|
||||
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
|
||||
/**
|
||||
* Class to construct CRS for mcidas.
|
||||
*
|
||||
* <pre>
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 03/2014 TTR957 B. Yin Moved from McidasSpatialFactory.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author byin
|
||||
*/
|
||||
|
||||
public class McidasCRSBuilder {
|
||||
|
||||
public static ProjectedCRS constructCRSfromWKT(String crsWKT) {
|
||||
Pattern p = Pattern.compile("PROJCS\\[\"MCIDAS\\sAREA\\s(.*)\"");
|
||||
Matcher m = p.matcher(crsWKT);
|
||||
m.find();
|
||||
ProjectedCRS crsObject = null;
|
||||
|
||||
if (m.groupCount() == 1) {
|
||||
String type = m.group(1);
|
||||
// System.out.println("FOUND PROJCS:"+m.group(0)+":"+type);
|
||||
p = Pattern.compile("\\[\"NAV_BLOCK_BASE64\",\\s\"(.*)\"\\]");
|
||||
m = p.matcher(crsWKT);
|
||||
boolean found = m.find();
|
||||
|
||||
// System.out.println(m.group());
|
||||
// System.out.println(m.groupCount()+m.group(1));
|
||||
if (found) {
|
||||
String navBlock = m.group(1);
|
||||
crsObject = McidasCRSBuilder.constructCRS(type, navBlock);
|
||||
}
|
||||
}
|
||||
|
||||
return crsObject;
|
||||
}
|
||||
|
||||
public static ProjectedCRS constructCRS(String type, String encoded) {
|
||||
|
||||
ParameterValueGroup pvg = null;
|
||||
|
||||
DefaultMathTransformFactory dmtFactory = new DefaultMathTransformFactory();
|
||||
try {
|
||||
pvg = dmtFactory.getDefaultParameters("MCIDAS_AREA_NAV");
|
||||
} catch (NoSuchIdentifierException e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
|
||||
/*
|
||||
* semi_major and semi_minor parameters are set to 1, so that no global
|
||||
* scaling is performed during coordinate transforms by
|
||||
* org.geotools.referencing.operation.projection.MapProjection based on
|
||||
* the radius of earth
|
||||
*/
|
||||
pvg.parameter("semi_major").setValue(1.0);
|
||||
pvg.parameter("semi_minor").setValue(1.0);
|
||||
pvg.parameter("central_meridian").setValue(0.0);
|
||||
// pvg.parameter("scale_factor").setValue(1.0);
|
||||
|
||||
pvg.parameter("NAV_BLOCK_BASE64").setValue(encoded);
|
||||
// System.out.println(pvg.toString() );
|
||||
|
||||
String projectionName = "MCIDAS AREA " + type;
|
||||
ProjectedCRS mcidasCRS = null;
|
||||
try {
|
||||
mcidasCRS = MapUtil.constructProjection(projectionName, pvg);
|
||||
} catch (NoSuchIdentifierException e) {
|
||||
e.printStackTrace();
|
||||
} catch (FactoryException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return mcidasCRS;
|
||||
}
|
||||
}
|
|
@ -59,6 +59,7 @@ import com.raytheon.uf.edex.decodertools.core.IDecoderConstants;
|
|||
* because it is a dead code.
|
||||
* Aug 08, 2013 1028 G. Hull rm underscores from reportType and set mndTime in URI
|
||||
* Aug 30, 2013 2298 rjpeter Make getPluginName abstract
|
||||
* Mar 21, 2103 1112 S. Russell *.WCN files, get the watch number
|
||||
* </pre>
|
||||
*
|
||||
* This code has been developed by the SIB for use in the AWIPS2 system.
|
||||
|
@ -78,8 +79,7 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
public AwwDecoder() throws DecoderException {
|
||||
}
|
||||
|
||||
public PluginDataObject[] decode(byte[] data, Headers headers)
|
||||
throws DecoderException {
|
||||
public PluginDataObject[] decode(byte[] data, Headers headers) throws DecoderException {
|
||||
|
||||
String traceId = "";
|
||||
if (headers != null) {
|
||||
|
@ -108,10 +108,8 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
messageData = sep.next();
|
||||
String theMessage = new String(messageData);
|
||||
|
||||
/*
|
||||
* May have multiple duplicate bulletins, only get the first bulletin
|
||||
* and eliminate the remaining bulletins after the first bulletin.
|
||||
*/
|
||||
/* May have multiple duplicate bulletins, only get the first bulletin
|
||||
* and eliminate the remaining bulletins after the first bulletin. */
|
||||
Scanner cc = new Scanner(theMessage).useDelimiter(etx);
|
||||
if (cc.hasNext()) {
|
||||
theBulletin = cc.next();
|
||||
|
@ -144,6 +142,13 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
// Break the bulletin message into segments by a "$$"
|
||||
Scanner sc = new Scanner(theBulletin).useDelimiter(segmentDelim);
|
||||
|
||||
boolean isWCN = false;
|
||||
String wcnLbl = AwwRecord.AwwReportType.WATCH_COUNTY_NOTIFICATION.name();
|
||||
wcnLbl = wcnLbl.replace("_", " ");
|
||||
if (reportType.equals(wcnLbl)) {
|
||||
isWCN = true;
|
||||
}
|
||||
|
||||
while (sc.hasNext()) {
|
||||
String segment = sc.next();
|
||||
Matcher ugcMatcher = ugcPattern.matcher(segment);
|
||||
|
@ -162,43 +167,46 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
Matcher ugcMatcher = ugcPattern.matcher(segment);
|
||||
AwwUgc ugc = null;
|
||||
|
||||
// TRAC 1112
|
||||
if (isWCN) {
|
||||
String watchNumber = AwwParser.retrieveWatchNumberFromWCN(segment);
|
||||
if (watchNumber != null) {
|
||||
record.setWatchNumber(watchNumber);
|
||||
if (ugcMatcher.find()) {
|
||||
ugc = AwwParser.processUgc(ugcMatcher.group(), segment,
|
||||
mndTime, watchesList);
|
||||
} else if (isWtchFlag) {
|
||||
ugc = AwwParser.processUgcForWtch(
|
||||
AwwParser.WTCH_BOX_UGC_LINE, segment, mndTime,
|
||||
record.getIssueOffice(), watchesList);
|
||||
ugc = AwwParser.processUgc(ugcMatcher.group(), segment, mndTime, watchesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
// local forecast
|
||||
else if (isWtchFlag) {
|
||||
ugc = AwwParser.processUgcForWtch(AwwParser.WTCH_BOX_UGC_LINE, segment, mndTime, record.getIssueOffice(), watchesList);
|
||||
// else if(isSevereWeatherStatusFlag)
|
||||
// ugc =
|
||||
// AwwParser.processUgcForSereveWeatherStatus(ugcMatcher.group(),
|
||||
// segment, mndTime, record.getIssueOffice(),
|
||||
// watchesList);
|
||||
String watchNumber = AwwParser
|
||||
.processUgcToRetrieveWatchNumberForThunderstormOrTornado(segment);
|
||||
String watchNumber = AwwParser.processUgcToRetrieveWatchNumberForThunderstormOrTornado(segment);
|
||||
record.setWatchNumber(watchNumber);
|
||||
// } else if(isSevereWeatherStatusFlag) {
|
||||
// String watchNumber =
|
||||
// AwwParser.processUgcToRetrieveWatchNumberForStatusReport(segment);
|
||||
// record.setWatchNumber(watchNumber);
|
||||
} else if (ugcMatcher.find()) {
|
||||
ugc = AwwParser.processUgc(ugcMatcher.group(), segment, mndTime, watchesList);
|
||||
}
|
||||
|
||||
if (ugc != null) {
|
||||
record.addAwwUGC(ugc);
|
||||
|
||||
/*
|
||||
* Collect watch numbers which are the event tracking
|
||||
/* Collect watch numbers which are the event tracking
|
||||
* numbers in VTEC lines as one of primary keys in AWW
|
||||
* record to prevent not writing raw data to DB note: 1.
|
||||
* each bulletin may have multiple segments 2. each
|
||||
* segment has one UGC line but may have multiple VTEC
|
||||
* lines and have more than one watch number
|
||||
*/
|
||||
/*
|
||||
* not quite sure the following logic is correct to
|
||||
* lines and have more than one watch number */
|
||||
/* not quite sure the following logic is correct to
|
||||
* retrieve and then store the watch number. thus
|
||||
* comment it out now. M. Gao
|
||||
*/
|
||||
* comment it out now. M. Gao */
|
||||
// if (watchesList.size() > 0) {
|
||||
// String collectWatches = null;
|
||||
// for (int idxWatch = 0; idxWatch < watchesList.size();
|
||||
|
@ -221,63 +229,47 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
// record.setWatchNumber("0000");
|
||||
// }
|
||||
|
||||
/*
|
||||
* construct VTEC object and then add it to the current
|
||||
* Ugc for SevereWeatherStatus aww reocrd
|
||||
*/
|
||||
/* construct VTEC object and then add it to the current
|
||||
* Ugc for SevereWeatherStatus aww reocrd */
|
||||
|
||||
if (AwwParser.isSegmentTextValid(segment)) {
|
||||
/*
|
||||
* parse and then set the Watch Number for Status
|
||||
* Report
|
||||
*/
|
||||
String watchNumber = AwwParser
|
||||
.processUgcToRetrieveWatchNumberForStatusReport(segment);
|
||||
/* parse and then set the Watch Number for Status
|
||||
* Report */
|
||||
String watchNumber = AwwParser.processUgcToRetrieveWatchNumberForStatusReport(segment);
|
||||
record.setWatchNumber(watchNumber);
|
||||
|
||||
AwwVtec awwVtec = AwwParser
|
||||
.processVtectForSevereWeatherStatus(
|
||||
theBulletin, record.getIssueTime(),
|
||||
record.getIssueOffice());
|
||||
AwwVtec awwVtec = AwwParser.processVtectForSevereWeatherStatus(theBulletin, record.getIssueTime(), record.getIssueOffice());
|
||||
Set<AwwVtec> awwVtecSet = new HashSet<AwwVtec>();
|
||||
awwVtecSet.add(awwVtec);
|
||||
ugc.setAwwVtecLine(awwVtecSet);
|
||||
/*
|
||||
* now calculate status latlon info and then add to
|
||||
* ugc
|
||||
*/
|
||||
List<AwwLatlons> pointAwwLatLonsList = AwwLatLonUtil
|
||||
.getAwwLatLonsListBySereveWeatherStatusPointLine(awwVtec
|
||||
.getVtecLine());
|
||||
/* now calculate status latlon info and then add to
|
||||
* ugc */
|
||||
List<AwwLatlons> pointAwwLatLonsList = AwwLatLonUtil.getAwwLatLonsListBySereveWeatherStatusPointLine(awwVtec.getVtecLine());
|
||||
for (AwwLatlons eachAwwLatlons : pointAwwLatLonsList) {
|
||||
ugc.addAwwLatLon(eachAwwLatlons);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error processing decoded sigmet", e);
|
||||
logger.error("Error processing decoded segment", e);
|
||||
record = null;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Check the AWW record object. If not, throws exception.
|
||||
*/
|
||||
/* Check the AWW record object. If not, throws exception. */
|
||||
if (record != null) {
|
||||
// T976 - check if the record has a valid UGC. If not return an
|
||||
// empty PluginDataObject array
|
||||
if ((record.getAwwUGC() == null)
|
||||
|| (record.getAwwUGC().size() == 0)) {
|
||||
if ((record.getAwwUGC() == null) || (record.getAwwUGC().size() == 0)) {
|
||||
return new PluginDataObject[0];
|
||||
}
|
||||
|
||||
record.setReportType(reportType.trim());
|
||||
record.setTraceId(traceId);
|
||||
// Set MND remark before the URI is constructed
|
||||
if ((mt.getMndTimeString() == null)
|
||||
|| mt.getMndTimeString().trim().isEmpty()) {
|
||||
if ((mt.getMndTimeString() == null) || mt.getMndTimeString().trim().isEmpty()) {
|
||||
record.setMndTime("unknown");
|
||||
} else {
|
||||
record.setMndTime(mt.getMndTimeString());
|
||||
|
@ -297,10 +289,8 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
|
||||
// Replace special characters to a blank so that it may be readable.
|
||||
if (theBulletin.length() < 40000) {
|
||||
record.setBullMessage(UtilN.removeLeadingWhiteSpaces(theBulletin
|
||||
.replace('\r', ' ').replace('\003', ' ')
|
||||
.replace('\000', ' ').replace('\001', ' ')
|
||||
.replace('\036', ' ')));
|
||||
record.setBullMessage(UtilN
|
||||
.removeLeadingWhiteSpaces(theBulletin.replace('\r', ' ').replace('\003', ' ').replace('\000', ' ').replace('\001', ' ').replace('\036', ' ')));
|
||||
}
|
||||
|
||||
// Return the AwwRecord record object.
|
||||
|
@ -309,11 +299,9 @@ public class AwwDecoder extends AbstractDecoder {
|
|||
// } else {
|
||||
// return new PluginDataObject[] {record};
|
||||
// }
|
||||
/*
|
||||
* The reason the above is commented out is the check to see if record
|
||||
/* The reason the above is commented out is the check to see if record
|
||||
* == null is a dead code. It will never get executed according the
|
||||
* logic before the if statement.
|
||||
*/
|
||||
* logic before the if statement. */
|
||||
return new PluginDataObject[] { record };
|
||||
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -6,8 +6,8 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import com.raytheon.uf.common.pointdata.PointDataContainer;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.pointdata.PointDataDescription.Type;
|
||||
import com.raytheon.uf.common.pointdata.PointDataView;
|
||||
import com.raytheon.uf.common.serialization.comm.IRequestHandler;
|
||||
import com.raytheon.uf.edex.pointdata.PointDataQuery;
|
||||
|
||||
|
@ -35,9 +35,11 @@ public class StationDataRequestHandler implements
|
|||
|
||||
query.setParameters(request.getParmList());
|
||||
query.addParameter(STATION_ID, request.getStationId(), "=");
|
||||
if (!request.getPluginName().equalsIgnoreCase("bufrua")) {
|
||||
query.addParameter(REF_HOUR, request.getRefTime().toString(), "=");
|
||||
}
|
||||
query.addParameter(REF_TIME, request.getRefTime().toString(), "<=");
|
||||
if ( ! request.getPartNumber().equals("0") ) {
|
||||
if (!request.getPartNumber().equals("0")) {
|
||||
query.addParameter(REP_TYPE, request.getPartNumber(), "=");
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,12 @@ Import-Package: com.raytheon.edex.exception,
|
|||
com.raytheon.uf.common.parameter,
|
||||
com.raytheon.uf.common.pointdata,
|
||||
com.raytheon.uf.common.serialization.comm,
|
||||
gov.noaa.nws.ncep.edex.common.sounding,
|
||||
javax.measure.unit
|
||||
Require-Bundle: com.raytheon.edex.common;bundle-version="1.12.1174",
|
||||
gov.noaa.nws.ncep.common.dataplugin.gpd;bundle-version="1.0.0",
|
||||
com.raytheon.uf.common.dataplugin.level;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.edex.ingest;bundle-version="1.12.1174"
|
||||
com.raytheon.uf.edex.ingest;bundle-version="1.12.1174",
|
||||
org.apache.commons.io;bundle-version="2.4.0"
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
@ -25,6 +29,7 @@ import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataParameter
|
|||
import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataProductContainer;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataProductInfo;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.product.GenericPointDataStationProduct;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.gpd.query.GenericPointDataReqMsg.GenericPointDataReqType;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -34,6 +39,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.StringWriter;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
@ -48,6 +54,8 @@ import javax.xml.bind.Unmarshaller;
|
|||
import javax.xml.transform.Result;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import com.raytheon.edex.exception.DecoderException;
|
||||
import com.raytheon.edex.plugin.AbstractDecoder;
|
||||
import com.raytheon.uf.common.dataplugin.PluginDataObject;
|
||||
|
@ -262,7 +270,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
********************************************************************************************
|
||||
*
|
||||
*/
|
||||
private String parseSoundingTable(String prodTblString,String prodName,int versionNum, int levelNumMax){
|
||||
private String parseSoundingTable(String prodTblString,String prodName,int versionNum, int levelNumMax, GenericPointDataReqType reqType){
|
||||
if( levelNumMax < 2) {//should set to a minimum of 2, see comments in parseSurfaceTable()
|
||||
return "Bad input, max number of level should be greater than 1";
|
||||
}
|
||||
|
@ -331,10 +339,14 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
//remainDataString: point to data starting from first STID
|
||||
String remainDataString = prodTblString.substring(stnIdIndex);
|
||||
//split remaining data and parse data for each station.
|
||||
Date date=null;
|
||||
//Chin NOTE: current time is reference time for OBS SND (e.g. Uair) and is forecast time for Model SND (for example pfc-nam)
|
||||
Date currentTime=null;
|
||||
//Chin Note: reference time is indeed reference time for Model SND. Currently, we use the first decoded TIME
|
||||
// as reference time.
|
||||
Date refTime=null;
|
||||
boolean firstRoundOfPersistence = true;
|
||||
PointDataDescription pdd=null;
|
||||
int blockCount=0;
|
||||
//int blockCount=0;
|
||||
List<GenericPointDataStationProduct> stnProdList = new ArrayList<GenericPointDataStationProduct>();
|
||||
/*
|
||||
* Chin Note: To speed up HDF5 persistence speed and also avoid out of heap memory problem,
|
||||
|
@ -354,7 +366,9 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
else {
|
||||
stnDataString = remainDataString;
|
||||
found = false;
|
||||
//System.out.println("reach last station, contents= \n"+stnDataString);
|
||||
}
|
||||
boolean goodStation = true;
|
||||
//System.out.println(stnDataString);
|
||||
int stnSndParmIndex = stnDataString.indexOf(sndParmArray[0]);
|
||||
//System.out.println("stnSndParmIndex=" + stnSndParmIndex);
|
||||
|
@ -390,7 +404,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
int i=0;
|
||||
GenericPointDataStationProduct stnProd = new GenericPointDataStationProduct(versionNum,prodName);
|
||||
boolean reftimeNotAvail = true, stnIdNotAvail=true;
|
||||
String stid="", reftime="";
|
||||
String stid="", timeStr="";
|
||||
for(String pm: stnMetaArray){
|
||||
//System.out.println("Metainfo="+pm);
|
||||
if(pm.equals(GenericPointDataConstants.SND_STN_ID)){
|
||||
|
@ -450,16 +464,32 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
SimpleDateFormat df = new SimpleDateFormat("yyMMdd/HHmm");
|
||||
|
||||
try {
|
||||
date = df.parse(stnMetaArray[i+1]);
|
||||
reftime = stnMetaArray[i+1];
|
||||
//For PFC sounding, reference time and forecast time may be different
|
||||
//We use the first station's "TIME" decoded as reference time for all time lines / stations in
|
||||
//one GEMPAK file..
|
||||
// The rest decoded TIME is decoded as forecast time for each time line.
|
||||
//However, for UAIR, all decoded "TIME" are treated as reference time for that station/time line
|
||||
if(refTime == null)
|
||||
refTime = df.parse(stnMetaArray[i+1]);
|
||||
currentTime = df.parse(stnMetaArray[i+1]);
|
||||
timeStr = stnMetaArray[i+1];
|
||||
//System.out.println("date="+date.toString());
|
||||
reftimeNotAvail=false;
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(date!=null)
|
||||
stnProd.setRefTime(date);
|
||||
if(currentTime!=null){
|
||||
if(GenericPointDataReqType.STORE_GPD_MDL_SND_PRODUCT_FROM_GEMPAK_TBL == reqType){
|
||||
stnProd.setRefTime(refTime);
|
||||
int forecastTime= (int)((currentTime.getTime() - refTime.getTime())/1000);
|
||||
stnProd.setForecastTime(forecastTime);
|
||||
}
|
||||
else {// should be (GenericPointDataReqType.STORE_GPD_OBS_SND_PRODUCT_FROM_GEMPAK_TBL == reqType){
|
||||
stnProd.setRefTime(currentTime);
|
||||
stnProd.setForecastTime(-1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
//no mandatory reference time found
|
||||
returnStatus = "*****************************************\nDropped one station product. TIME not found. \n"+ stnMetaDataStr + "\n";
|
||||
|
@ -543,9 +573,9 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
}
|
||||
else{
|
||||
//Chin NOTE: with this simple error handling design,
|
||||
//When a missing line in input table, we will drop all data for its station after the missing line.
|
||||
//When a missing parameter in line, we will drop all data for this level.
|
||||
//System.out.println("sdnParmlength="+stnSndDataParmAtCurLineArray.length+" should be"+ numSndParmAtLine);
|
||||
returnStatus = returnStatus +"Dropped incomplete sounding data line @ "+ stid+ " Time="+reftime+"\n"+ lineStr + "\n";
|
||||
returnStatus = returnStatus +"Dropped incomplete sounding data level, missing data at line @ "+ stid+ " Time="+timeStr+"\n"+ lineStr + "\n stnStr="+stnDataString+"\n found="+found;
|
||||
goodLevel = false;
|
||||
break;
|
||||
}
|
||||
|
@ -553,10 +583,24 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
}
|
||||
if(goodLevel)
|
||||
stnProd.getLevelLst().add(gpdLevel);
|
||||
else{
|
||||
//if there is a bad level, we drop this station
|
||||
goodStation = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(goodStation)
|
||||
stnProdList.add(stnProd);
|
||||
}
|
||||
if(firstRoundOfPersistence == true ){
|
||||
int latestProdVersion = gpdDao.getGpdProductLatestVersion(currentTime, prodName);
|
||||
if(versionNum <= latestProdVersion)
|
||||
//input product should not have version smaller or equal to same product's latest product version in DB
|
||||
//If a new product, its product version should be 0 and latestProdVersion should be -1.
|
||||
return "Data persistence failed. Input version number "+ versionNum+ " DB latest version number "+latestProdVersion;
|
||||
prodInfo = gpdDao.lookupUpdateGpdProdInfo(prodInfo, true, versionNum);
|
||||
if(prodInfo == null)
|
||||
return "Data persistence failed. Bad Product info\n";
|
||||
//NOte: we assume at first round, we will already have max level set for generating
|
||||
// pdd
|
||||
pdd = createPointDataDescription(prodInfo);
|
||||
|
@ -564,7 +608,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
if(pdd != null && stnProdList.size() >=BLOCKSIZE ){
|
||||
try {
|
||||
String sts = performPersist( prodInfo,stnProdList
|
||||
,versionNum, date, pdd, firstRoundOfPersistence) ;
|
||||
,versionNum, pdd) ;
|
||||
|
||||
if(sts.equals(OK)== false){
|
||||
//either product info or version is not right, stop parsing.
|
||||
|
@ -576,7 +620,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
blockCount++;
|
||||
//blockCount++;
|
||||
}
|
||||
}
|
||||
//System.out.println("Prod " + prodName+": persisted "+ (blockCount*BLOCKSIZE + stnProdList.size())+ " records.");
|
||||
|
@ -585,7 +629,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
if(pdd!=null && stnProdList.size() > 0 ){
|
||||
try {
|
||||
String sts = performPersist( prodInfo,stnProdList
|
||||
,versionNum, date, pdd, firstRoundOfPersistence) ;
|
||||
,versionNum, pdd) ;
|
||||
if(sts.equals(OK)== false){
|
||||
//either product info or version is not right, stop parsing.
|
||||
return returnStatus+ sts;
|
||||
|
@ -828,7 +872,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
|
||||
//to here means that this is a none numeric string, then it should be a station id line, ie. the first line of a record
|
||||
//add first line to stnTbl
|
||||
System.out.println(" line: "+stnlineStr + " length="+ stnlineStr.length());
|
||||
//System.out.println(" line: "+stnlineStr + " length="+ stnlineStr.length());
|
||||
|
||||
stnTbl.add((new ArrayList(Arrays.asList(stnparmArry))));
|
||||
currentIndex++;
|
||||
|
@ -876,7 +920,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
}
|
||||
// get stnId value and drop it from table
|
||||
String stnIdStr = stnTbl.get(0).get(0);
|
||||
System.out.println("stnId="+stnIdStr);
|
||||
//System.out.println("stnId="+stnIdStr);
|
||||
if(stnIdStr.length()<=0){
|
||||
returnStatus =returnStatus + "Dropped one station product. STN not found \n"+ stnTbl.get(0) + "\n";
|
||||
stnTbl.clear();
|
||||
|
@ -893,14 +937,16 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
}
|
||||
try {
|
||||
date = df.parse(refTime);
|
||||
System.out.println("date="+date.toString());
|
||||
//System.out.println("date="+date.toString());
|
||||
} catch (ParseException e) {
|
||||
// TODO Auto-generated catch block
|
||||
//e.printStackTrace();
|
||||
System.out.println("bad reftime"+refTime);
|
||||
}
|
||||
if(date!=null)
|
||||
if(date!=null){
|
||||
newstnProd.setRefTime(date);
|
||||
newstnProd.setForecastTime(-1);
|
||||
}
|
||||
else{
|
||||
returnStatus = returnStatus + "Dropped one station product. Time in bad format \n"+ stnTbl.get(0) + "\n";
|
||||
stnTbl.clear();
|
||||
|
@ -945,13 +991,21 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
stnIndexInBlock++;
|
||||
stnTbl.clear();
|
||||
if(firstRoundOfPersistence == true ){
|
||||
int latestProdVersion = gpdDao.getGpdProductLatestVersion(stnProdList.get(0).getRefTime(), prodName);
|
||||
if(versionNum <= latestProdVersion)
|
||||
//input product should not have version smaller or equal to same product's latest product version in DB
|
||||
//If a new product, its product version should be 0 and latestProdVersion should be -1.
|
||||
return "Data persistence failed. Input version number "+ versionNum+ " DB latest version number "+latestProdVersion;
|
||||
prodInfo = gpdDao.lookupUpdateGpdProdInfo(prodInfo, true, versionNum);
|
||||
if(prodInfo == null)
|
||||
return "Data persistence failed. Bad Product info\n";
|
||||
pdd = createPointDataDescription(prodInfo);
|
||||
|
||||
}
|
||||
if(pdd != null && stnIndexInBlock >=BLOCKSIZE ){
|
||||
try {
|
||||
String sts = performPersist( prodInfo,stnProdList
|
||||
,versionNum, stnProdList.get(0).getRefTime(), pdd, firstRoundOfPersistence) ;
|
||||
,versionNum, pdd) ;
|
||||
if(sts.equals(OK)== false){
|
||||
//either product info or version is not right, stop parsing.
|
||||
return returnStatus+ sts;
|
||||
|
@ -971,7 +1025,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
if(pdd!=null && stnIndexInBlock > 0 ){
|
||||
try {
|
||||
String sts = performPersist( prodInfo,stnProdList
|
||||
,versionNum, stnProdList.get(0).getRefTime(), pdd, firstRoundOfPersistence) ;
|
||||
,versionNum, pdd) ;
|
||||
if(sts.equals(OK)== false){
|
||||
//either product info or version is not right, stop parsing.
|
||||
return returnStatus+ sts;
|
||||
|
@ -989,19 +1043,10 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
* Return status: OK or error status
|
||||
*/
|
||||
private String performPersist(GenericPointDataProductInfo prodInfo,List<GenericPointDataStationProduct> stnProdLst
|
||||
, int prodVersion, Date refTime, PointDataDescription pdd, boolean firstRoundOfPersist) throws PluginException {
|
||||
, int prodVersion, PointDataDescription pdd) throws PluginException {
|
||||
String prodName = prodInfo.getName();
|
||||
List<PluginDataObject> rtObLst =null;
|
||||
if(firstRoundOfPersist == true){
|
||||
int latestProdVersion = gpdDao.getGpdProductLatestVersion(refTime, prodName);
|
||||
if(prodVersion <= latestProdVersion)
|
||||
//input product should not have version smaller or equal to same product's latest product version in DB
|
||||
//If a new product, its product version should be 0 and latestProdVersion should be -1.
|
||||
return "Data persistence failed. Wrong version number!\n";
|
||||
prodInfo = gpdDao.lookupUpdateGpdProdInfo(prodInfo, true, prodVersion);
|
||||
if(prodInfo == null)
|
||||
return "Data persistence failed. Bad Product info\n";
|
||||
}
|
||||
|
||||
|
||||
DataTime dataTime;
|
||||
//System.out.println("GenericPointDataProductInfo is obtained! report name="+prodInfo.getName()+
|
||||
|
@ -1024,7 +1069,12 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
stnPd.setNumLevel(numLevel);
|
||||
PointDataView view = createPointDataView(pdd, stnPd);
|
||||
if(view !=null){
|
||||
Date refTime = stnPd.getRefTime();
|
||||
int forecastTimeSec = stnPd.getForecastTime();
|
||||
if(forecastTimeSec == -1)
|
||||
dataTime = new DataTime(stnPd.getRefTime());
|
||||
else
|
||||
dataTime = new DataTime(stnPd.getRefTime(), (int)forecastTimeSec);
|
||||
gpdRec= new GenericPointDataRecord(prodInfo,location,stnPd.getSlat(), stnPd.getSlon(),view, dataTime, prodVersion);
|
||||
rtObLst.add(gpdRec);
|
||||
}
|
||||
|
@ -1037,9 +1087,9 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
long t1 = System.currentTimeMillis();
|
||||
gpdDao.persistToDatabase(recordObjects);
|
||||
long t2 = System.currentTimeMillis();
|
||||
System.out.println("\nTime spent to persist "+recordObjects.length+ " records to HDF5: "
|
||||
+ (t1 - t0)+" persist to Postgres: "
|
||||
+ (t2 - t1));
|
||||
//System.out.println("\nTime spent to persist "+recordObjects.length+ " records to HDF5: "
|
||||
// + (t1 - t0)+" persist to Postgres: "
|
||||
// + (t2 - t1));
|
||||
totalHDF5Time = totalHDF5Time + (t1 - t0);
|
||||
}
|
||||
return OK;
|
||||
|
@ -1051,11 +1101,17 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
* @throws DecoderException
|
||||
* @throws PluginException
|
||||
*/
|
||||
public String decodeTblProdFmCli(String prodTblString, String ProdName,int versionNum, int maxNumOfLevel)throws DecoderException, PluginException {
|
||||
public String decodeGempakTblProdFmCli(String prodTblString, String ProdName,int versionNum, int maxNumOfLevel, GenericPointDataReqType reqType)throws DecoderException, PluginException {
|
||||
long tin = System.currentTimeMillis();
|
||||
String returnStatus="";
|
||||
totalHDF5Time=0;
|
||||
if ( prodTblString !=null) {
|
||||
//check to see what type of product is
|
||||
if(reqType == GenericPointDataReqType.STORE_GPD_OBS_SFC_PRODUCT_FROM_GEMPAK_TBL)
|
||||
returnStatus = parseSurfaceTable(prodTblString, ProdName,versionNum);
|
||||
else if(reqType == GenericPointDataReqType.STORE_GPD_OBS_SND_PRODUCT_FROM_GEMPAK_TBL||reqType == GenericPointDataReqType.STORE_GPD_MDL_SND_PRODUCT_FROM_GEMPAK_TBL)
|
||||
returnStatus= parseSoundingTable(prodTblString, ProdName, versionNum,maxNumOfLevel,reqType);
|
||||
/*
|
||||
if(prodTblString.contains(GenericPointDataConstants.SND_PARM)){
|
||||
//"SNPARM" is an unique string in sounding table file
|
||||
totalHDF5Time=0;
|
||||
|
@ -1065,7 +1121,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
totalHDF5Time=0;
|
||||
//"YYMMDD/HHMM" is an unique string in surface table file
|
||||
returnStatus = parseSurfaceTable(prodTblString, ProdName,versionNum);
|
||||
}
|
||||
}*/
|
||||
else{
|
||||
return("Decode failed! Bad product type, can not tell what product type is input!");
|
||||
}
|
||||
|
@ -1134,7 +1190,7 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
if(prodInfo == null)
|
||||
return "Data persistence failed. Bad Product info";
|
||||
DataTime dataTime = new DataTime(gpdc.getRefTime());
|
||||
System.out.println("GenericPointDataProductInfo is obtained! report name="+prodInfo.getName()+
|
||||
System.out.println("GenericPointDataProductInfo is obtained! report name="+prodInfo.getName()+ " number of param="+prodInfo.getParameterLst().size() +
|
||||
" Reftime="+ dataTime.getRefTimeAsCalendar().getTime()+" in ms="+ dataTime.getRefTimeAsCalendar().getTimeInMillis()+ " stnLstSize="+lstSize + " numMaxLvls="+prodInfo.getMaxNumberOfLevel());
|
||||
|
||||
PointDataDescription pdd = createPointDataDescription(prodInfo);
|
||||
|
@ -1358,6 +1414,33 @@ SNPARM = PRES;TMPC;DWPT;HGHT;DRCT;SKNT;TMPK;RELH;MIXR;UKNT;VKNT;THTA;THTE
|
|||
}
|
||||
return INPUT_TYPE.GPD_UNKNOWN;
|
||||
}
|
||||
public void decodeGempakProdFmSbn(File inputFile)throws DecoderException, PluginException {
|
||||
System.out.println("GPD decodeGempakProdFmSbn() entered!");
|
||||
if(inputFile.getName().equals("test")){
|
||||
test(inputFile);
|
||||
return;// returnObjects;
|
||||
}
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(inputFile);
|
||||
} catch (FileNotFoundException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return;// returnObjects;
|
||||
}
|
||||
StringWriter writer = new StringWriter();
|
||||
try {
|
||||
IOUtils.copy(is, writer, "UTF-8");
|
||||
String gempakFileStr = writer.toString();
|
||||
String status = decodeGempakTblProdFmCli(gempakFileStr, "nampfc", 0, 100, GenericPointDataReqType.STORE_GPD_MDL_SND_PRODUCT_FROM_GEMPAK_TBL);
|
||||
System.out.println(status);
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Decode GPD XML file input from SBN/gpd
|
||||
* @param inputProdStr : XML file
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/**
|
||||
* This code has unlimited rights, and is provided "as is" by the National Centers
|
||||
* for Environmental Prediction, without warranty of any kind, either expressed or implied,
|
||||
* including but not limited to the implied warranties of merchantability and/or fitness
|
||||
* for a particular purpose.
|
||||
*
|
||||
*
|
||||
* This code has been developed by the NCEP-SIB for use in the AWIPS2 system.
|
||||
|
@ -390,7 +394,7 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
if(gpdDao== null)
|
||||
return null;
|
||||
GenericPointDataReqType msgType = request.getReqType();
|
||||
String reportName;
|
||||
String prodName= request.getProductName();;
|
||||
Date refTime;
|
||||
float slon ;
|
||||
float slat;
|
||||
|
@ -399,9 +403,8 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
case GET_GPD_PRODUCT_INFO_GEMPAK_TBL:
|
||||
case GET_GPD_PRODUCT_INFO_OBJECT:
|
||||
case GET_GPD_PRODUCT_INFO_XML:
|
||||
reportName = request.getProductName();
|
||||
if(reportName !=null){
|
||||
GenericPointDataProductInfo prodInfo = gpdDao.getGpdProdInfo(reportName);
|
||||
if(prodName !=null){
|
||||
GenericPointDataProductInfo prodInfo = gpdDao.getGpdProdInfo(prodName);
|
||||
//*System.out.println(" report name= "+prodInfo.getName()+ " master="+prodInfo.getMasterLevel().getName()+ " maxLevel="+prodInfo.getMaxNumberOfLevel());
|
||||
//for(Parameter pam: prodInfo.getParameterLst() ){
|
||||
// System.out.println("parm ="+pam.getAbbreviation());
|
||||
|
@ -418,10 +421,9 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
case GET_GPD_STATION_PRODUCT_GEMPAK_TBL:
|
||||
case GET_GPD_STATION_PRODUCT_OBJECT:
|
||||
case GET_GPD_STATION_PRODUCT_XML:
|
||||
reportName = request.getProductName();
|
||||
String stnId = request.getStnId();
|
||||
refTime = request.getRefTime();
|
||||
stnProd=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_STN_ID, stnId,-9999,-9999,reportName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
stnProd=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_STN_ID, stnId,-9999,-9999,prodName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
//System.out.println("stnProduct id="+ stnProd.getLocation().getStationId());
|
||||
if(stnProd!=null)
|
||||
if(msgType.equals(GenericPointDataReqType.GET_GPD_STATION_PRODUCT_OBJECT)){
|
||||
|
@ -438,11 +440,10 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
case GET_GPD_MOVING_PRODUCT_GEMPAK_TBL:
|
||||
case GET_GPD_MOVING_PRODUCT_OBJECT:
|
||||
case GET_GPD_MOVING_PRODUCT_XML:
|
||||
reportName = request.getProductName();
|
||||
slon = request.getSlon();
|
||||
slat = request.getSlat();
|
||||
refTime = request.getRefTime();
|
||||
stnProd=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_SLAT_SLON,null, slat,slon,reportName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
stnProd=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_SLAT_SLON,null, slat,slon,prodName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
//System.out.println("stnProduct id="+ stnProd.getLocation().getStationId());
|
||||
if(stnProd!=null)
|
||||
if(msgType.equals(GenericPointDataReqType.GET_GPD_MOVING_PRODUCT_OBJECT)){
|
||||
|
@ -459,9 +460,8 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
case GET_GPD_PRODUCT_GEMPAK_TBL:
|
||||
case GET_GPD_PRODUCT_OBJECT:
|
||||
case GET_GPD_PRODUCT_XML:
|
||||
reportName = request.getProductName();
|
||||
refTime = request.getRefTime();
|
||||
GenericPointDataProductContainer pdCon=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_REPORT_NAME,null, -9999,-9999,reportName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());//(refTime, reportName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
GenericPointDataProductContainer pdCon=gpdDao.getGpdProduct(refTime,GenericPointDataQueryKey.BY_PRODUCT_NAME,null, -9999,-9999,prodName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());//(refTime, reportName,request.isQuerySpecifiedProductVersion(), request.getProductVersion());
|
||||
//System.out.println("stnProduct id="+ stnProd.getLocation().getStationId());
|
||||
if(pdCon!=null)
|
||||
if(msgType.equals(GenericPointDataReqType.GET_GPD_PRODUCT_OBJECT)){
|
||||
|
@ -476,27 +476,45 @@ public class GenericPointDataRequestHandler implements IRequestHandler<GenericPo
|
|||
}
|
||||
break;
|
||||
case GET_GPD_STATION_PRODUCT_OBJECT_LIST:
|
||||
reportName = request.getProductName();
|
||||
stnId = request.getStnId();
|
||||
return (Object)gpdDao.getGpdStationProduct(request.getRefTimeList(),GenericPointDataQueryKey.BY_STN_ID, stnId,-9999,-9999,reportName);
|
||||
return (Object)gpdDao.getGpdStationProduct(request.getQueryTimeList(),GenericPointDataQueryKey.BY_STN_ID, stnId,-9999,-9999,prodName);
|
||||
case GET_GPD_STATION_MDL_SND_PRODUCT_OBJECT_LIST:
|
||||
stnId = request.getStnId();
|
||||
//System.out.println("GET_GPD_STATION_MDL_SND_PRODUCT_OBJECT_LIST stnProduct id="+ stnId);
|
||||
return (Object)gpdDao.getGpdStationModelSndProduct(request.getQueryTimeList(),request.getRefTime(),GenericPointDataQueryKey.BY_STN_ID, stnId,-9999,-9999,prodName);
|
||||
//System.out.println("stnProduct id="+ stnProd.getLocation().getStationId());
|
||||
case GET_GPD_MOVING_PRODUCT_OBJECT_LIST:
|
||||
reportName = request.getProductName();
|
||||
slon = request.getSlon();
|
||||
slat = request.getSlat();
|
||||
return (Object)gpdDao.getGpdStationProduct(request.getRefTimeList(),GenericPointDataQueryKey.BY_SLAT_SLON, null,slat,slon,reportName);
|
||||
//System.out.println("stnProduct id="+ stnProd.getLocation().getStationId());
|
||||
|
||||
return (Object)gpdDao.getGpdStationProduct(request.getQueryTimeList(),GenericPointDataQueryKey.BY_SLAT_SLON, null,slat,slon,prodName);
|
||||
case GET_GPD_MOVING_MDL_SND_PRODUCT_OBJECT_LIST:
|
||||
slon = request.getSlon();
|
||||
slat = request.getSlat();
|
||||
return (Object)gpdDao.getGpdStationModelSndProduct(request.getQueryTimeList(),request.getRefTime(),GenericPointDataQueryKey.BY_SLAT_SLON, null,slat,slon,prodName);
|
||||
case STORE_GPD_PRODUCT_FROM_XML:
|
||||
return (decoder.decodeXmlProdFmCli(request.getGpdDataString()));
|
||||
case STORE_GPD_PRODUCT_FROM_GEMPAK_TBL:
|
||||
return (decoder.decodeTblProdFmCli(request.getGpdDataString(), request.getProductName(), request.getProductVersion(), request.getMaxNumLevel()));
|
||||
case STORE_GPD_OBS_SFC_PRODUCT_FROM_GEMPAK_TBL:
|
||||
case STORE_GPD_OBS_SND_PRODUCT_FROM_GEMPAK_TBL:
|
||||
case STORE_GPD_MDL_SND_PRODUCT_FROM_GEMPAK_TBL:
|
||||
return (decoder.decodeGempakTblProdFmCli(request.getGpdDataString(), prodName, request.getProductVersion(), request.getMaxNumLevel(), msgType));
|
||||
case PURGE_GPD_EXPIRED_PRODUCT:
|
||||
gpdDao.purgeExpiredData();
|
||||
break;
|
||||
case PURGE_GPD_ALL_PRODUCTS:
|
||||
gpdDao.purgeAllData();
|
||||
break;
|
||||
case GET_GPD_PRODUCT_TIMELINE_OBJECT:
|
||||
return (Object)(gpdDao.getGpdProductTimeline(prodName));
|
||||
case GET_GPD_PRODUCT_RANGESTART_TIME_OBJECT:
|
||||
return (Object)(gpdDao.getGpdProductRangestartTimes(prodName,request.getRefTimeStr()));
|
||||
case GET_GPD_STATION_INFO_COLLECTION_OBJECT:
|
||||
return (Object)(gpdDao.getGpdStationInfoCollection(request.getRefTimeStr(), request.getRangeStartTimeStr(),prodName));
|
||||
case GET_GPD_ALL_AVAILABLE_PRODUCTS:
|
||||
case GET_GPD_AVAILABLE_OBSERVED_SOUNDING_PRODUCTS:
|
||||
case GET_GPD_AVAILABLE_MODEL_SOUNDING_PRODUCTS:
|
||||
case GET_GPD_AVAILABLE_SURFACE_PRODUCTS:
|
||||
return (Object) (gpdDao.getGpdAvailProducts(msgType));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -3,28 +3,79 @@
|
|||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
|
||||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
|
||||
|
||||
<bean id="ncgribFilenameProcessor" class="gov.noaa.nws.ncep.edex.plugin.ncgrib.NcgribFileNameProcessor" />
|
||||
<bean id="ncgribFilenameProcessor" class="gov.noaa.nws.ncep.edex.plugin.ncgrib.NcgribFileNameProcessor"/>
|
||||
|
||||
<bean id="ncgribGridPointLock" class="com.raytheon.edex.plugin.grib.GribGridPointLock">
|
||||
<constructor-arg value="${ncgrib-decode.count.gridpoints}"/>
|
||||
<constructor-arg value="${ncgrib-decode.count.threads}"/>
|
||||
</bean>
|
||||
|
||||
<camelContext id="ncgrib-file-endpoint" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<endpoint id="gribFileEndpoint" uri="file:${edex.home}/data/sbn/grib?noop=true&idempotent=false" />
|
||||
<endpoint id="gribFileEndpoint" uri="file:${edex.home}/data/sbn/grib?noop=true&idempotent=false"/>
|
||||
|
||||
<route id="gribFileConsumerRoute">
|
||||
<from ref="gribFileEndpoint" />
|
||||
<bean ref="fileToString" />
|
||||
<bean ref="ncgribFilenameProcessor" />
|
||||
<from ref="gribFileEndpoint"/>
|
||||
<bean ref="fileToString"/>
|
||||
<bean ref="ncgribFilenameProcessor"/>
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>grid</constant>
|
||||
</setHeader>
|
||||
<to uri="jms-durable:queue:Ingest.GribSplit" />
|
||||
<to uri="jms-durable:queue:Ingest.ncGrib"/>
|
||||
</route>
|
||||
|
||||
</camelContext>
|
||||
|
||||
<camelContext id="ncgrib-qpid-endpoint" xmlns="http://camel.apache.org/schema/spring"
|
||||
errorHandlerRef="errorHandler"
|
||||
autoStartup="false">
|
||||
|
||||
<endpoint id="ncgribJmsEndpoint" uri="jms-durable:queue:Ingest.ncGrib?concurrentConsumers=${ncgrib-decode.count.threads}"/>
|
||||
|
||||
<route id="ncgribFileNameConsumerRoute">
|
||||
<from ref="ncgribJmsEndpoint"/>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="ncgribFilenameProcessor"/>
|
||||
<setHeader headerName="pluginName">
|
||||
<constant>grid</constant>
|
||||
</setHeader>
|
||||
<bean ref="stringToFile"/>
|
||||
<split streaming="true">
|
||||
<method bean="gribSplitter" method="split"/>
|
||||
<doTry>
|
||||
<pipeline>
|
||||
<bean ref="ncgribGridPointLock" method="reserve"/>
|
||||
<bean ref="gribDecoder"/>
|
||||
<bean ref="gribPostProcessor" method="process"/>
|
||||
<to uri="direct-vm:persistIndexAlert"/>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:ncgrib?level=ERROR"/>
|
||||
</doCatch>
|
||||
<doFinally>
|
||||
<bean ref="ncgribGridPointLock" method="release"/>
|
||||
</doFinally>
|
||||
</doTry>
|
||||
</split>
|
||||
</pipeline>
|
||||
<doCatch>
|
||||
<exception>java.lang.Throwable</exception>
|
||||
<to uri="log:ncgrib?level=ERROR"/>
|
||||
</doCatch>
|
||||
</doTry>
|
||||
</route>
|
||||
</camelContext>
|
||||
|
||||
<bean id="ncgribDecodeCamelRegistered" factory-bean="contextManager"
|
||||
factory-method="register" depends-on="persistCamelRegistered">
|
||||
<constructor-arg ref="ncgrib-qpid-endpoint"/>
|
||||
</bean>
|
||||
|
||||
<bean factory-bean="clusteredCamelContextMgr"
|
||||
factory-method="register">
|
||||
<constructor-arg ref="ncgrib-file-endpoint" />
|
||||
<constructor-arg ref="ncgrib-file-endpoint"/>
|
||||
</bean>
|
||||
</beans>
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# the number of ncgrib decode threads.
|
||||
ncgrib-decode.count.threads=8
|
||||
# Maximum number of grid points to decode at one time for all threads. Large
|
||||
# grib files may cause the decoder to reach this limit and then some threads
|
||||
# will have to wait. This can be used to control the amount of memory used by
|
||||
# the decoder.
|
||||
ncgrib-decode.count.gridpoints=36000000
|
|
@ -1,4 +1,5 @@
|
|||
package gov.noaa.nws.ncep.edex.plugin.ncgrib;
|
||||
|
||||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
|
@ -19,6 +20,7 @@ package gov.noaa.nws.ncep.edex.plugin.ncgrib;
|
|||
* further licensing information.
|
||||
**/
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
@ -41,6 +43,8 @@ import org.apache.camel.Processor;
|
|||
* May 29, 2013 995 B. Yin Get model name from NcgribModelNameMap
|
||||
* June, 2013 T. Lee Added NFCENS
|
||||
* Oct 15, 2012 2473 bsteffen Move to ncgrib plugin
|
||||
* 5/2014 S. Gilbert Removed absolute path from fileName
|
||||
* 5/2014 T. Lee Added HYSPLIT
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -60,28 +64,53 @@ public class NcgribFileNameProcessor implements Processor {
|
|||
// grab global wind and wave ensemble IDs
|
||||
private static final Pattern ENSEMBLE_NFC_PATTERN = Pattern
|
||||
.compile("^\\d{8}_HTSGW_(\\d{2})$");
|
||||
|
||||
// anything that ends in nest is assumed to be a nested grid identifier
|
||||
// might add alaska fire weather later...
|
||||
private static final Pattern FIREWXNEST_ID_PATTERN = Pattern
|
||||
.compile("^firewxnest$");
|
||||
|
||||
// anything that ends in nest is assumed to be a nested grid identifier
|
||||
//private static final Pattern NEST_ID_PATTERN = Pattern.compile("^.*nest$");
|
||||
// private static final Pattern NEST_ID_PATTERN =
|
||||
// Pattern.compile("^.*nest$");
|
||||
|
||||
// SREF gets special handling, does this apply to other models?
|
||||
//private static final Pattern SREF_PATTERN = Pattern.compile("^sref_.*$");
|
||||
// private static final Pattern SREF_PATTERN = Pattern.compile("^sref_.*$");
|
||||
|
||||
// This is the least generic pattern ever, are there any constraints on
|
||||
// event names, who knows?
|
||||
private static final Pattern HURRICANE_PATTERN = Pattern
|
||||
.compile("^\\d{10}_([a-z]*)\\d{1,2}[lewcs]$");
|
||||
|
||||
// For hysplit model
|
||||
private static final Pattern HYSPLIT_PATTERN = Pattern
|
||||
.compile("^e\\d{10}$");
|
||||
|
||||
private static NcgribModelNameMap modelMap = null;
|
||||
|
||||
@Override
|
||||
public void process(Exchange exchange) throws Exception {
|
||||
String flName = (String) exchange.getIn()
|
||||
.getHeader("CamelFileNameOnly");
|
||||
|
||||
/*
|
||||
* If filename not found in Header, look in body in case it came in from
|
||||
* an ingest queue
|
||||
*/
|
||||
if (flName == null) {
|
||||
Object payload = exchange.getIn().getBody();
|
||||
if (payload instanceof byte[]) {
|
||||
flName = new String((byte[]) payload);
|
||||
} else if (payload instanceof String) {
|
||||
flName = (String) payload;
|
||||
}
|
||||
// Remove Path from filename
|
||||
if (flName != null) {
|
||||
File f = new File(flName);
|
||||
flName = f.getName();
|
||||
}
|
||||
}
|
||||
|
||||
String datasetid = null;
|
||||
String secondaryid = null;
|
||||
String ensembleid = null;
|
||||
|
@ -100,15 +129,15 @@ public class NcgribFileNameProcessor implements Processor {
|
|||
matcher.find();
|
||||
ensembleid = matcher.group(1);
|
||||
} else if (FIREWXNEST_ID_PATTERN.matcher(token).find()) {
|
||||
//datasetid = "NAMFIREWX";
|
||||
// datasetid = "NAMFIREWX";
|
||||
datasetid = "fireWxNAM";
|
||||
//secondaryid = token;
|
||||
//} else if (NEST_ID_PATTERN.matcher(token).find()) {
|
||||
// secondaryid = token;
|
||||
//} else if (SREF_PATTERN.matcher(token).find()) {
|
||||
// } else if (NEST_ID_PATTERN.matcher(token).find()) {
|
||||
// secondaryid = token;
|
||||
// } else if (SREF_PATTERN.matcher(token).find()) {
|
||||
// String[] tokens = token.split("_");
|
||||
// datasetid = tokens[0].toUpperCase();
|
||||
//secondaryid = tokens[1].toUpperCase();
|
||||
// secondaryid = tokens[1].toUpperCase();
|
||||
} else if (HURRICANE_PATTERN.matcher(token).find()) {
|
||||
Matcher matcher = HURRICANE_PATTERN.matcher(token);
|
||||
matcher.find();
|
||||
|
@ -125,10 +154,13 @@ public class NcgribFileNameProcessor implements Processor {
|
|||
datasetid = "HWRF";
|
||||
}
|
||||
|
||||
} else if (HYSPLIT_PATTERN.matcher(token).find()) {
|
||||
secondaryid = nameTokens[0];
|
||||
datasetid = "HYSPLIT";
|
||||
}
|
||||
}
|
||||
|
||||
if ( modelMap == null ) {
|
||||
if (modelMap == null) {
|
||||
modelMap = NcgribModelNameMap.load();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,49 +14,44 @@
|
|||
* 03/30/11 126 F. J. Yen Add BLIZZARD, FRZNG RAIN, and HARD FREEZE to
|
||||
* hazard types
|
||||
* 09/30/11 126 B. Hebbard PafmParser becomes new NcPafmParser
|
||||
* 03/24/14 1064 B. Hebbard (TTR 892) (a) update readZoneLocs() localization
|
||||
* code to fix failure to access zones.xml;
|
||||
* (b) when parsing ELEV (in PFM only), also get
|
||||
* lat/lon, and store as point location (instead of
|
||||
* using FIPS centroid as for AFM)
|
||||
*
|
||||
* This code has been developed by the SIB for use in the AWIPS2 system.
|
||||
*/
|
||||
|
||||
package gov.noaa.nws.ncep.edex.plugin.ncpafm.util;
|
||||
|
||||
import static com.raytheon.uf.common.localization.LocalizationContext.LocalizationType.EDEX_STATIC;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmBulletin;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmFips;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmParameters;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmUgc;
|
||||
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
|
||||
import gov.noaa.nws.ncep.edex.common.stationTables.IStationField.StationField;
|
||||
import gov.noaa.nws.ncep.edex.common.stationTables.Station;
|
||||
import gov.noaa.nws.ncep.edex.common.stationTables.StationTable;
|
||||
import gov.noaa.nws.ncep.edex.common.stationTables.IStationField.StationField;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmBulletin;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmUgc;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmParameters;
|
||||
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmFips;
|
||||
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
|
||||
import gov.noaa.nws.ncep.edex.tools.decoder.MndTime;
|
||||
import gov.noaa.nws.ncep.edex.util.UtilN;
|
||||
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Scanner;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import com.raytheon.uf.common.time.DataTime;
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.io.File;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import com.raytheon.uf.common.localization.IPathManager;
|
||||
import com.raytheon.uf.common.localization.LocalizationContext;
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||
|
||||
enum Param {
|
||||
MIN_MAX, MN_MX, MAX_MIN, MX_MN, TEMP, DEWPT, RH, WIND_CHAR, WIND_DIR,
|
||||
WIND_GUST, WIND_SPD, AVG_CLOUDS, CLOUDS, POP_12HR, QPF_12HR, MAX_QPF,
|
||||
SNOW_12HR, PWIND_DIR, RAIN, RAIN_SHWRS, SPRINKLES, TSTMS, DRIZZLE,
|
||||
SNOW, SNOWSHWRS, FLURRIES, SLEET, FRZG_RAIN, FRZG_DRZL, OBVIS, WIND_CHILL,
|
||||
HEAT_INDEX, MIN_CHILL, MAX_HEAT, BLIZZARD, COAST_FLOOD, DENSE_FOG, EXCESS_HEAT,
|
||||
FIRE_WEATHER, FLASH_FLOOD, FLOOD, FREEZE, FROST, FRZNG_RAIN, HARD_FREEZE, HEAT,
|
||||
HIGH_SURF, HIGH_WIND, LAKE_WIND, LKSHORE_FLD, SVR_TSTORM, TORNADO, WIND,
|
||||
WINTER_STORM, WINTER_WEATH, NOVALUE;
|
||||
MIN_MAX, MN_MX, MAX_MIN, MX_MN, TEMP, DEWPT, RH, WIND_CHAR, WIND_DIR, WIND_GUST, WIND_SPD, AVG_CLOUDS, CLOUDS, POP_12HR, QPF_12HR, MAX_QPF, SNOW_12HR, PWIND_DIR, RAIN, RAIN_SHWRS, SPRINKLES, TSTMS, DRIZZLE, SNOW, SNOWSHWRS, FLURRIES, SLEET, FRZG_RAIN, FRZG_DRZL, OBVIS, WIND_CHILL, HEAT_INDEX, MIN_CHILL, MAX_HEAT, BLIZZARD, COAST_FLOOD, DENSE_FOG, EXCESS_HEAT, FIRE_WEATHER, FLASH_FLOOD, FLOOD, FREEZE, FROST, FRZNG_RAIN, HARD_FREEZE, HEAT, HIGH_SURF, HIGH_WIND, LAKE_WIND, LKSHORE_FLD, SVR_TSTORM, TORNADO, WIND, WINTER_STORM, WINTER_WEATH, NOVALUE;
|
||||
|
||||
static Param toParam(String paramStr) {
|
||||
try {
|
||||
|
@ -70,56 +65,95 @@ enum Param {
|
|||
public class NcPafmParser {
|
||||
|
||||
private static final float RMISSD = IDecoderConstantsN.FLOAT_MISSING;
|
||||
|
||||
private static final int IMISSD = IDecoderConstantsN.INTEGER_MISSING;
|
||||
|
||||
private static StationTable zonesList;
|
||||
|
||||
private static int ndxLast;
|
||||
|
||||
private static final int maxNmHr = 48;
|
||||
|
||||
private static String locTimeZone = " ";
|
||||
|
||||
private static int[] locHrs = new int[maxNmHr];
|
||||
|
||||
private static Float[] tmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] dwpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] relhAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] pop12Ar = new Float[maxNmHr];
|
||||
|
||||
private static Float[] qpf12MnAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] qpf12MxAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] highestMaxQpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] lowestMaxQpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] snow12MnAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] snow12MxAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] maxHeatAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] minChillAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] heatIndexAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] windChillAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] avgMxTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] hiMxTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] loMxTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] avgMnTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] hiMnTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static Float[] loMnTmpfAr = new Float[maxNmHr];
|
||||
|
||||
private static String[] windDirAr = new String[maxNmHr];
|
||||
|
||||
private static String[] windSmphAr = new String[maxNmHr];
|
||||
|
||||
private static String[] gust_MphAr = new String[maxNmHr];
|
||||
|
||||
private static String[] pwindDirAr = new String[maxNmHr];
|
||||
|
||||
private static String[] windCharAr = new String[maxNmHr];
|
||||
|
||||
private static String[] skyCoverAr = new String[maxNmHr];
|
||||
|
||||
private static String[] avgSkyCoverAr = new String[maxNmHr];
|
||||
|
||||
private static String[] obvisAr = new String[maxNmHr];
|
||||
|
||||
private static String[] rainAr = new String[maxNmHr];
|
||||
|
||||
private static String[] rainShwrsAr = new String[maxNmHr];
|
||||
|
||||
private static String[] sprinklesAr = new String[maxNmHr];
|
||||
|
||||
private static String[] tstmsAr = new String[maxNmHr];
|
||||
|
||||
private static String[] drizzleAr = new String[maxNmHr];
|
||||
|
||||
private static String[] snowAr = new String[maxNmHr];
|
||||
|
||||
private static String[] snowShwrsAr = new String[maxNmHr];
|
||||
|
||||
private static String[] flurriesAr = new String[maxNmHr];
|
||||
|
||||
private static String[] sleetAr = new String[maxNmHr];
|
||||
|
||||
private static String[] frzgRainAr = new String[maxNmHr];
|
||||
|
||||
private static String[] frzgDrzlAr = new String[maxNmHr];
|
||||
|
||||
private static String[] hazardsAr = new String[maxNmHr];
|
||||
|
@ -169,8 +203,8 @@ public class NcPafmParser {
|
|||
mndTime);
|
||||
record.setIssueTime(issueTime);
|
||||
|
||||
//DataTime dataTime = new DataTime(issueTime);
|
||||
//record.setDataTime(dataTime);
|
||||
// DataTime dataTime = new DataTime(issueTime);
|
||||
// record.setDataTime(dataTime);
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
@ -196,13 +230,15 @@ public class NcPafmParser {
|
|||
int maxFrame = 3;
|
||||
boolean findSegMndTime;
|
||||
String[] frame = new String[maxFrame];
|
||||
Float lat;
|
||||
Float lon;
|
||||
Float elev;
|
||||
Calendar segMndTime = null;
|
||||
Matcher segMndTimeMatcher = null;
|
||||
|
||||
// Regular expression for elevation
|
||||
final String ELEV_RGEX = " (ELEV\\..*) (-?\\d+|\\?{4}) FT";
|
||||
final Pattern elevPattern = Pattern.compile(ELEV_RGEX);
|
||||
// Regular expression for latitude, longitude, and elevation (PFM only)
|
||||
final String LAT_LON_ELEV_RGEX = "(\\d{2}\\.\\d{2})(N|S)\\s{1,2}(\\d{2,3}\\.\\d{2})(E|W) (ELEV\\..*) (-?\\d+|\\?{4}) FT";
|
||||
final Pattern latLonElevPattern = Pattern.compile(LAT_LON_ELEV_RGEX);
|
||||
|
||||
// Regular expression for MND Time
|
||||
final String SEG_MND_TIME = "(\\d{3,4}) ((AM)|(PM)|(am)|(pm)) (\\p{Alpha}{3}) "
|
||||
|
@ -211,28 +247,56 @@ public class NcPafmParser {
|
|||
|
||||
NcPafmUgc currentUgc = new NcPafmUgc();
|
||||
/*
|
||||
* Decode the elevation and store it in elev
|
||||
* Decode the point LAT/LON and elevation string (PFM product only)
|
||||
*/
|
||||
Matcher elevMatcher = elevPattern.matcher(segment);
|
||||
if (elevMatcher.find()) {
|
||||
if (elevMatcher.group(2).equals("????")) {
|
||||
Matcher latLonElevMatcher = latLonElevPattern.matcher(segment);
|
||||
if (latLonElevMatcher.find()) {
|
||||
try {
|
||||
lat = Float.parseFloat(latLonElevMatcher.group(1));
|
||||
if (latLonElevMatcher.group(2).equals("S")) {
|
||||
lat = -lat;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out
|
||||
.println("PAFM WARNING: Bad format encountered in latitude:"
|
||||
+ latLonElevMatcher.group(1)
|
||||
+ latLonElevMatcher.group(2));
|
||||
lat = RMISSD;
|
||||
}
|
||||
try {
|
||||
lon = Float.parseFloat(latLonElevMatcher.group(3));
|
||||
if (latLonElevMatcher.group(4).equals("W")) {
|
||||
lon = -lon;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out
|
||||
.println("PAFM WARNING: Bad format encountered in longitude:"
|
||||
+ latLonElevMatcher.group(3)
|
||||
+ latLonElevMatcher.group(4));
|
||||
lon = RMISSD;
|
||||
}
|
||||
if (latLonElevMatcher.group(6).equals("????")) {
|
||||
elev = RMISSD;
|
||||
} else {
|
||||
try {
|
||||
elev = Float.parseFloat(elevMatcher.group(2));
|
||||
elev = Float.parseFloat(latLonElevMatcher.group(6));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.out
|
||||
.println("PAFM WARNING: Bad format encountered in elevation:"
|
||||
+ elevMatcher.group(2));
|
||||
+ latLonElevMatcher.group(6));
|
||||
elev = RMISSD;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lat = RMISSD;
|
||||
lon = RMISSD;
|
||||
elev = RMISSD;
|
||||
}
|
||||
|
||||
NcPafmParser.processFips(ugcline, elev, currentUgc, mndTime);
|
||||
NcPafmParser.processFips(ugcline, lat, lon, elev, currentUgc, mndTime);
|
||||
/*
|
||||
* Break up into Matrix frames which begins with "DATE". There should be
|
||||
* 2 frames for each UGC, but sometimes there is only one. (When there
|
||||
|
@ -276,8 +340,7 @@ public class NcPafmParser {
|
|||
/*
|
||||
* Don't have frame matrix
|
||||
*/
|
||||
System.out
|
||||
.println("PAFM WARNING: No frame matrix");
|
||||
System.out.println("PAFM WARNING: No frame matrix");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -487,36 +550,36 @@ public class NcPafmParser {
|
|||
* The following for single floating point values
|
||||
*/
|
||||
case DEWPT:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, dwpfAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, dwpfAr);
|
||||
break;
|
||||
case HEAT_INDEX:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, heatIndexAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, heatIndexAr);
|
||||
break;
|
||||
case MAX_HEAT:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, maxHeatAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, maxHeatAr);
|
||||
break;
|
||||
case MIN_CHILL:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, minChillAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, minChillAr);
|
||||
break;
|
||||
case POP_12HR:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, pop12Ar);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, pop12Ar);
|
||||
break;
|
||||
case RH:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, relhAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, relhAr);
|
||||
break;
|
||||
case TEMP:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, tmpfAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, tmpfAr);
|
||||
break;
|
||||
case WIND_CHILL:
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst, ndxLast,
|
||||
locStNdx, locEnNdx, windChillAr);
|
||||
NcPafmParser.parseFlParmRow(row[idx], idxst,
|
||||
ndxLast, locStNdx, locEnNdx, windChillAr);
|
||||
break;
|
||||
/*
|
||||
* The following for a value of MM, 0, a single floating
|
||||
|
@ -639,13 +702,13 @@ public class NcPafmParser {
|
|||
* WFO. Although PAFM raw data do not have VTECs, the
|
||||
* phenomena appear in the left column of the PAFM
|
||||
* matrix. It is possible that there are phenomena that
|
||||
* are not listed here because they have not been seen in
|
||||
* a PAFM raw data and so it is not known what they are
|
||||
* and/or what the actual text string would be. In such
|
||||
* an instance, a warning message would appear that the
|
||||
* "Parameter is currently not known: ". If the parameter
|
||||
* is a Watch, Warning, or Advisory phenomena, then it
|
||||
* can be added below and in the enum Param.
|
||||
* are not listed here because they have not been seen
|
||||
* in a PAFM raw data and so it is not known what they
|
||||
* are and/or what the actual text string would be. In
|
||||
* such an instance, a warning message would appear that
|
||||
* the "Parameter is currently not known: ". If the
|
||||
* parameter is a Watch, Warning, or Advisory phenomena,
|
||||
* then it can be added below and in the enum Param.
|
||||
*/
|
||||
case BLIZZARD:
|
||||
case COAST_FLOOD:
|
||||
|
@ -812,7 +875,8 @@ public class NcPafmParser {
|
|||
try {
|
||||
parmValStr = parmRow
|
||||
.substring(locStNdx[idx], locEnNdx[idx]);
|
||||
if (parmValStr.equals(" ") || parmValStr.trim().equals("MM")) {
|
||||
if (parmValStr.equals(" ")
|
||||
|| parmValStr.trim().equals("MM")) {
|
||||
flParmAr[idx] = RMISSD;
|
||||
} else {
|
||||
Matcher floatValMatcher = floatValPattern
|
||||
|
@ -918,7 +982,8 @@ public class NcPafmParser {
|
|||
if (floatValMatcher.find()) {
|
||||
switch (numfl) {
|
||||
case 0:
|
||||
if (parmValStr.equals(" ") || parmValStr.trim().equals("MM")) {
|
||||
if (parmValStr.equals(" ")
|
||||
|| parmValStr.trim().equals("MM")) {
|
||||
avgMxTmpfAr[idx] = RMISSD;
|
||||
avgMnTmpfAr[idx] = RMISSD;
|
||||
numfl = 0;
|
||||
|
@ -948,7 +1013,8 @@ public class NcPafmParser {
|
|||
}
|
||||
break;
|
||||
case 1:
|
||||
if (parmValStr.equals(" ") || parmValStr.trim().equals("MM")) {
|
||||
if (parmValStr.equals(" ")
|
||||
|| parmValStr.trim().equals("MM")) {
|
||||
numfl = 0;
|
||||
} else {
|
||||
try {
|
||||
|
@ -983,7 +1049,8 @@ public class NcPafmParser {
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
if (parmValStr.equals(" ") || parmValStr.trim().equals("MM")) {
|
||||
if (parmValStr.equals(" ")
|
||||
|| parmValStr.trim().equals("MM")) {
|
||||
numfl = 0;
|
||||
/*
|
||||
* Only two values in group, so use the second value
|
||||
|
@ -1181,10 +1248,8 @@ public class NcPafmParser {
|
|||
strParmAr[idx] = parmValStr;
|
||||
} else {
|
||||
badLenFlag = true;
|
||||
System.out
|
||||
.println("PAFM WARNING in parseStrParmRow: Row "
|
||||
+ "length does not agree with Date line: "
|
||||
+ parmRow);
|
||||
System.out.println("PAFM WARNING in parseStrParmRow: Row "
|
||||
+ "length does not agree with Date line: " + parmRow);
|
||||
}
|
||||
}
|
||||
if (mdxEn > ndxEn) {
|
||||
|
@ -1199,13 +1264,19 @@ public class NcPafmParser {
|
|||
*
|
||||
* @param ugc
|
||||
* The UGC line which contains FIPS
|
||||
* @param lat
|
||||
* The specific point latitude, if specified in (PFM) bulletin
|
||||
* @param lon
|
||||
* The specific point longitude, if specified in (PFM) bulletin
|
||||
* @param elev
|
||||
* The specific point elevation, if specified in (PFM) bulletin
|
||||
* @param UGC
|
||||
* The NcPafmUgc table
|
||||
* @param mndTIme
|
||||
* The calendar from MND remark
|
||||
*/
|
||||
public static void processFips(String ugc, Float elev, NcPafmUgc UGC,
|
||||
Calendar mndTime) {
|
||||
public static void processFips(String ugc, Float lat, Float lon,
|
||||
Float elev, NcPafmUgc UGC, Calendar mndTime) {
|
||||
|
||||
Calendar purgeDate = null;
|
||||
String countyFips = null;
|
||||
|
@ -1253,6 +1324,13 @@ public class NcPafmParser {
|
|||
currentFips.setLat(zone.getLatitude());
|
||||
currentFips.setLon(zone.getLongitude());
|
||||
}
|
||||
// If meaningful lat/lon passed in -- specific to a point --
|
||||
// use that to override more general area (FIPS) location
|
||||
if (lat != null && lon != null && !lat.equals(RMISSD)
|
||||
&& !lon.equals(RMISSD)) {
|
||||
currentFips.setLat(lat);
|
||||
currentFips.setLon(lon);
|
||||
}
|
||||
UGC.addPafmFIPS(currentFips);
|
||||
} else if (fipsToken.length() == 10) {
|
||||
String intervalToken = fipsToken.substring(3, 10);
|
||||
|
@ -1671,21 +1749,33 @@ public class NcPafmParser {
|
|||
* @throws Exception
|
||||
*/
|
||||
public static void readZoneLocs() throws Exception {
|
||||
final String NCEP_DIR = "ncep";
|
||||
final String stnsDir = "stns";
|
||||
final String idftLocTableName = "zones.xml";
|
||||
|
||||
// final String NCEP_DIR = "ncep";
|
||||
// final String stnsDir = "stns";
|
||||
// final String idftLocTableName = "zones.xml";
|
||||
|
||||
final String ZONES_TABLE = "ncep" + File.separator + "stns"
|
||||
+ File.separator + "zones.xml";
|
||||
|
||||
IPathManager manager = PathManagerFactory.getPathManager();
|
||||
|
||||
LocalizationContext baseContext = null;
|
||||
File baseDir = null;
|
||||
String stnsFileName = null;
|
||||
baseContext = manager.getContext(EDEX_STATIC, LocalizationLevel.BASE);
|
||||
baseContext.setContextName(NCEP_DIR);
|
||||
baseDir = manager.getFile(baseContext, "");
|
||||
stnsFileName = baseDir + File.separator + stnsDir + File.separator
|
||||
+ idftLocTableName;
|
||||
|
||||
zonesList = new StationTable(stnsFileName);
|
||||
// File baseDir = null;
|
||||
// String stnsFileName = null;
|
||||
baseContext = manager.getContext(
|
||||
LocalizationContext.LocalizationType.EDEX_STATIC,
|
||||
LocalizationContext.LocalizationLevel.BASE);
|
||||
// baseContext.setContextName(NCEP_DIR);
|
||||
LocalizationFile zonesFile = null;
|
||||
zonesFile = manager.getStaticLocalizationFile(ZONES_TABLE);
|
||||
// baseDir = manager.getFile(baseContext, "");
|
||||
// stnsFileName = baseDir + File.separator + stnsDir + File.separator
|
||||
// + idftLocTableName;
|
||||
|
||||
if (zonesFile != null) {
|
||||
// zonesList = new StationTable(stnsFileName);
|
||||
zonesList = new StationTable(zonesFile.getFile().getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<requestPatterns xmlns:ns2="group">
|
||||
<!-- regex>^FOUS5[1-5] ([A-Z]{4}) ([0-9]{6}).*\\x0d\\x0d\\x0a[AP]FM.*</regex -->
|
||||
<regex>^FOUS5[1-5] ([A-Z]{4}) ([0-9]{6}).*</regex>
|
||||
<regex>^FOUS5[1-6] ([A-Z]{4}) ([0-9]{6}).*</regex>
|
||||
</requestPatterns>
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,8 @@ import java.util.List;
|
|||
* 02/28/2012 Chin Chen modify several sounding query algorithms for better performance
|
||||
* 8/2012 T. Lee/NCEP Removed missing wind interpolation
|
||||
* 8/2012 T. Lee/NCEP Fixed max wind merging; May fix NSHARP EL calculation
|
||||
* 12/2013 T. Lee/NCEP Fixed missing height at top level before sorting
|
||||
* 12/2013 1115 T. Lee/NCEP Fixed missing height at top level before sorting
|
||||
* 3/2014 1116 T. Lee/NCEP Added dpdToDewpoint for cmcHR (15km) data
|
||||
* </pre>
|
||||
*
|
||||
* @author T. Lee
|
||||
|
@ -93,8 +94,7 @@ public class MergeSounding {
|
|||
|
||||
} else {
|
||||
if (ppaa.size() < 1 && ttbb.size() < 1) {
|
||||
System.out
|
||||
.println(" Missing TTAA/TTBB and PPAA data.");
|
||||
System.out.println(" Missing TTAA/TTBB and PPAA data.");
|
||||
return missingSounding();
|
||||
} else {
|
||||
man = missingSounding();
|
||||
|
@ -389,6 +389,33 @@ public class MergeSounding {
|
|||
return sndata;
|
||||
}
|
||||
|
||||
/*
|
||||
* computes DWPC from TMPC and RELH Note: If DWPC is less than -190 degrees
|
||||
* C, it is treated as missing data Code is based on GEMPAK's prrhdp.f
|
||||
*/
|
||||
public List<NcSoundingLayer> dpdToDewpoint(List<NcSoundingLayer> sndata) {
|
||||
float temp, dpdk;
|
||||
float dwpc = RMISSD;
|
||||
|
||||
for (NcSoundingLayer layer : sndata) {
|
||||
if (layer.getDewpoint() == RMISSD) {
|
||||
temp = layer.getTemperature();
|
||||
dpdk = layer.getDpd();
|
||||
|
||||
if (temp == RMISSD || dpdk == RMISSD) {
|
||||
continue;
|
||||
} else {
|
||||
|
||||
dwpc = temp - dpdk;
|
||||
layer.setDewpoint(dwpc);
|
||||
// //System.out.println("rhToDewpoint dwpc: " + dwpc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return sndata;
|
||||
}
|
||||
|
||||
/*
|
||||
* computes VAPR from TMPC Code is based on GEMPAK's prvapr.f
|
||||
*/
|
||||
|
|
|
@ -12,11 +12,8 @@ import java.util.Set;
|
|||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
//TODO fix?
|
||||
@Ignore
|
||||
public class FfgParserTest {
|
||||
FfgRecord record = new FfgRecord();
|
||||
|
||||
|
@ -83,11 +80,11 @@ public class FfgParserTest {
|
|||
Iterator<FfgPrecip> it = ppp.iterator();
|
||||
while (it.hasNext()) {
|
||||
FfgPrecip pr = it.next();
|
||||
assertEquals(3.0, pr.getFf01());
|
||||
assertEquals(4.2, pr.getFf03());
|
||||
assertEquals(4.5, pr.getFf06());
|
||||
assertEquals(4.8, pr.getFf12());
|
||||
assertEquals(6.0, pr.getFf24());
|
||||
assertEquals(3.0, pr.getFf01(), 0.01);
|
||||
assertEquals(4.2, pr.getFf03(), 0.01);
|
||||
assertEquals(4.5, pr.getFf06(), 0.01);
|
||||
assertEquals(4.8, pr.getFf12(), 0.01);
|
||||
assertEquals(6.0, pr.getFf24(), 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,11 +97,11 @@ public class FfgParserTest {
|
|||
Iterator<FfgPrecip> it = ppp.iterator();
|
||||
while (it.hasNext()) {
|
||||
FfgPrecip pr = it.next();
|
||||
assertEquals(3.0, pr.getFf01());
|
||||
assertEquals(4.2, pr.getFf03());
|
||||
assertEquals(4.5, pr.getFf06());
|
||||
assertEquals(4.8, pr.getFf12());
|
||||
assertEquals(6.0, pr.getFf24());
|
||||
assertEquals(3.0f, pr.getFf01(), 0.01);
|
||||
assertEquals(4.2f, pr.getFf03(), 0.01);
|
||||
assertEquals(4.5f, pr.getFf06(), 0.01);
|
||||
assertEquals(4.8f, pr.getFf12(), 0.01);
|
||||
assertEquals(6.0f, pr.getFf24(), 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,13 +114,13 @@ public class FfgParserTest {
|
|||
Iterator<FfgPrecip> it = ppp.iterator();
|
||||
while (it.hasNext()) {
|
||||
FfgPrecip pr = it.next();
|
||||
assertEquals(3.0, pr.getFf01());
|
||||
assertEquals(3.0, pr.getFf01(), 0.01);
|
||||
assertEquals(IDecoderConstantsN.FLOAT_MISSING.doubleValue(),
|
||||
(double) pr.getFf03(), 0.0);
|
||||
assertEquals(4.5, pr.getFf06());
|
||||
assertEquals(4.5, pr.getFf06(), 0.01);
|
||||
assertEquals(IDecoderConstantsN.FLOAT_MISSING.doubleValue(),
|
||||
(double) pr.getFf12(), 0.0);
|
||||
assertEquals(6.0, pr.getFf24());
|
||||
assertEquals(6.0, pr.getFf24(), 0.01);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +133,7 @@ public class FfgParserTest {
|
|||
Iterator<FfgPrecip> it = ppp.iterator();
|
||||
while (it.hasNext()) {
|
||||
FfgPrecip pr = it.next();
|
||||
assertEquals(3.0, pr.getFf01());
|
||||
assertEquals(3.0, pr.getFf01(), 0.01);
|
||||
assertEquals(IDecoderConstantsN.FLOAT_MISSING.doubleValue(),
|
||||
(double) pr.getFf03(), 0.0);
|
||||
assertEquals(IDecoderConstantsN.FLOAT_MISSING.doubleValue(),
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package gov.noaa.nws.ncep.edex.uengine.tasks.profile;
|
||||
|
||||
//import edu.emory.mathcs.backport.java.util.Collections;
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import gov.noaa.nws.ncep.edex.common.sounding.NcSoundingLayer;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -21,7 +21,7 @@ public class MergeSoundingTest {
|
|||
|
||||
@Test
|
||||
public void testMergeObservedSounding() {
|
||||
/* Case I: Good report with a string of five characters*/
|
||||
/* Case I: Good report with a string of five characters */
|
||||
MergeSounding ms = new MergeSounding();
|
||||
|
||||
List<NcSoundingLayer> sls = new ArrayList<NcSoundingLayer>();
|
||||
|
@ -48,25 +48,6 @@ public class MergeSoundingTest {
|
|||
ta.setGeoHeight(11830.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(1000.f);
|
||||
ta.setTemperature(-9999.f);
|
||||
ta.setDewpoint(-9999.f);
|
||||
ta.setWindDirection(-9999.f);
|
||||
ta.setWindSpeed(-9999.f);
|
||||
ta.setGeoHeight(71.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(997.f);
|
||||
ta.setTemperature(17.6f);
|
||||
ta.setDewpoint(9.6f);
|
||||
ta.setWindDirection(0.f);
|
||||
ta.setWindSpeed(3.00f);
|
||||
ta.setGeoHeight(95.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(700.f);
|
||||
ta.setTemperature(0.2f);
|
||||
|
@ -85,6 +66,15 @@ public class MergeSoundingTest {
|
|||
ta.setGeoHeight(5620.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(1000.f);
|
||||
ta.setTemperature(-9999.f);
|
||||
ta.setDewpoint(-9999.f);
|
||||
ta.setWindDirection(-9999.f);
|
||||
ta.setWindSpeed(-9999.f);
|
||||
ta.setGeoHeight(71.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(150.f);
|
||||
ta.setTemperature(-54.5f);
|
||||
|
@ -96,13 +86,22 @@ public class MergeSoundingTest {
|
|||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(925.f);
|
||||
ta.setTemperature(12.f);
|
||||
ta.setDewpoint(7.f);
|
||||
ta.setWindDirection(290.f);
|
||||
ta.setWindSpeed(12.0f);
|
||||
ta.setTemperature(-9999.f);
|
||||
ta.setDewpoint(-9999.f);
|
||||
ta.setWindDirection(-9999.f);
|
||||
ta.setWindSpeed(-9999.f);
|
||||
ta.setGeoHeight(731.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
// ta = new NcSoundingLayer();
|
||||
// ta.setPressure(997.f);
|
||||
// ta.setTemperature(17.6f);
|
||||
// ta.setDewpoint(9.6f);
|
||||
// ta.setWindDirection(0.f);
|
||||
// ta.setWindSpeed(3.00f);
|
||||
// ta.setGeoHeight(95.f);
|
||||
// ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(850.f);
|
||||
ta.setTemperature(7.8f);
|
||||
|
@ -139,6 +138,15 @@ public class MergeSoundingTest {
|
|||
ta.setGeoHeight(7250.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(920.f);
|
||||
ta.setTemperature(17.6f);
|
||||
ta.setDewpoint(9.6f);
|
||||
ta.setWindDirection(0.f);
|
||||
ta.setWindSpeed(3.0f);
|
||||
ta.setGeoHeight(-9999.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
ta = new NcSoundingLayer();
|
||||
ta.setPressure(300.f);
|
||||
ta.setTemperature(-46.1f);
|
||||
|
@ -148,14 +156,34 @@ public class MergeSoundingTest {
|
|||
ta.setGeoHeight(9230.f);
|
||||
ttaa.add(ta);
|
||||
|
||||
NcSoundingLayer trop = new NcSoundingLayer();
|
||||
trop.setPressure(223.f);
|
||||
trop.setTemperature(-59.5f);
|
||||
trop.setDewpoint(-67.5f);
|
||||
trop.setWindDirection(275.f);
|
||||
trop.setWindSpeed(75.0f);
|
||||
trop.setGeoHeight(-9999.f);
|
||||
trop_a.add(trop);
|
||||
NcSoundingLayer tropa;
|
||||
tropa = new NcSoundingLayer();
|
||||
tropa.setPressure(223.f);
|
||||
tropa.setTemperature(-59.5f);
|
||||
tropa.setDewpoint(-67.5f);
|
||||
tropa.setWindDirection(275.f);
|
||||
tropa.setWindSpeed(75.0f);
|
||||
tropa.setGeoHeight(-9999.f);
|
||||
trop_a.add(tropa);
|
||||
|
||||
tropa = new NcSoundingLayer();
|
||||
tropa.setPressure(123.f);
|
||||
tropa.setTemperature(-60.5f);
|
||||
tropa.setDewpoint(-69.5f);
|
||||
tropa.setWindDirection(275.f);
|
||||
tropa.setWindSpeed(80.0f);
|
||||
tropa.setGeoHeight(-9999.f);
|
||||
trop_a.add(tropa);
|
||||
|
||||
NcSoundingLayer tropc;
|
||||
tropc = new NcSoundingLayer();
|
||||
tropc.setPressure(63.f);
|
||||
tropc.setTemperature(-60.5f);
|
||||
tropc.setDewpoint(-69.5f);
|
||||
tropc.setWindDirection(275.f);
|
||||
tropc.setWindSpeed(80.0f);
|
||||
tropc.setGeoHeight(-9999.f);
|
||||
trop_c.add(tropc);
|
||||
|
||||
NcSoundingLayer wmaxa = new NcSoundingLayer();
|
||||
wmaxa.setPressure(252.f);
|
||||
|
@ -167,7 +195,7 @@ public class MergeSoundingTest {
|
|||
wmax_a.add(wmaxa);
|
||||
|
||||
NcSoundingLayer wmaxc = new NcSoundingLayer();
|
||||
wmaxc.setPressure(7.8f);
|
||||
wmaxc.setPressure(5.8f);
|
||||
wmaxc.setTemperature(-9999.f);
|
||||
wmaxc.setDewpoint(-9999.f);
|
||||
wmaxc.setWindDirection(270.f);
|
||||
|
@ -203,6 +231,15 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(920.f);
|
||||
tb.setTemperature(17.6f);
|
||||
tb.setDewpoint(9.6f);
|
||||
tb.setWindDirection(-9999.f);
|
||||
tb.setWindSpeed(-9999.f);
|
||||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(150.f);
|
||||
tb.setTemperature(-54.5f);
|
||||
|
@ -212,10 +249,19 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
// tb = new NcSoundingLayer();
|
||||
// tb.setPressure(922.f);
|
||||
// tb.setTemperature(11.8f);
|
||||
// tb.setDewpoint(6.8f);
|
||||
// tb.setWindDirection(-9999.f);
|
||||
// tb.setWindSpeed(-9999.f);
|
||||
// tb.setGeoHeight(-9999.f);
|
||||
// ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(922.f);
|
||||
tb.setTemperature(11.8f);
|
||||
tb.setDewpoint(6.8f);
|
||||
tb.setPressure(-9999.f);
|
||||
tb.setTemperature(17.6f);
|
||||
tb.setDewpoint(9.6f);
|
||||
tb.setWindDirection(-9999.f);
|
||||
tb.setWindSpeed(-9999.f);
|
||||
tb.setGeoHeight(-9999.f);
|
||||
|
@ -311,14 +357,14 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(965.f);
|
||||
tb.setTemperature(15.f);
|
||||
tb.setDewpoint(7.f);
|
||||
tb.setWindDirection(-9999.f);
|
||||
tb.setWindSpeed(-9999.f);
|
||||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
// tb = new NcSoundingLayer();
|
||||
// tb.setPressure(965.f);
|
||||
// tb.setTemperature(15.f);
|
||||
// tb.setDewpoint(7.f);
|
||||
// tb.setWindDirection(-9999.f);
|
||||
// tb.setWindSpeed(-9999.f);
|
||||
// tb.setGeoHeight(-9999.f);
|
||||
// ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(772.f);
|
||||
|
@ -527,14 +573,14 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(986.f);
|
||||
tb.setTemperature(16.2f);
|
||||
tb.setDewpoint(8.200001f);
|
||||
tb.setWindDirection(-9999.f);
|
||||
tb.setWindSpeed(-9999.f);
|
||||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
// tb = new NcSoundingLayer();
|
||||
// tb.setPressure(986.f);
|
||||
// tb.setTemperature(16.2f);
|
||||
// tb.setDewpoint(8.200001f);
|
||||
// tb.setWindDirection(-9999.f);
|
||||
// tb.setWindSpeed(-9999.f);
|
||||
// tb.setGeoHeight(-9999.f);
|
||||
// ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(601.f);
|
||||
|
@ -545,7 +591,6 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(204.f);
|
||||
tb.setTemperature(-56.9f);
|
||||
|
@ -681,14 +726,14 @@ public class MergeSoundingTest {
|
|||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(997.f);
|
||||
tb.setTemperature(17.6f);
|
||||
tb.setDewpoint(9.6f);
|
||||
tb.setWindDirection(-9999.f);
|
||||
tb.setWindSpeed(-9999.f);
|
||||
tb.setGeoHeight(-9999.f);
|
||||
ttbb.add(tb);
|
||||
// tb = new NcSoundingLayer();
|
||||
// tb.setPressure(997.f);
|
||||
// tb.setTemperature(17.6f);
|
||||
// tb.setDewpoint(9.6f);
|
||||
// tb.setWindDirection(-9999.f);
|
||||
// tb.setWindSpeed(-9999.f);
|
||||
// tb.setGeoHeight(-9999.f);
|
||||
// ttbb.add(tb);
|
||||
|
||||
tb = new NcSoundingLayer();
|
||||
tb.setPressure(585.f);
|
||||
|
@ -960,15 +1005,6 @@ public class MergeSoundingTest {
|
|||
tc.setGeoHeight(33260.f);
|
||||
ttcc.add(tc);
|
||||
|
||||
tc = new NcSoundingLayer();
|
||||
tc.setPressure(10.f);
|
||||
tc.setTemperature(-53.5f);
|
||||
tc.setDewpoint(-9999.f);
|
||||
tc.setWindDirection(265.0f);
|
||||
tc.setWindSpeed(48.0f);
|
||||
tc.setGeoHeight(30950.0f);
|
||||
ttcc.add(tc);
|
||||
|
||||
tc = new NcSoundingLayer();
|
||||
tc.setPressure(20.f);
|
||||
tc.setTemperature(-53.1f);
|
||||
|
@ -987,6 +1023,15 @@ public class MergeSoundingTest {
|
|||
tc.setGeoHeight(23860.0f);
|
||||
ttcc.add(tc);
|
||||
|
||||
tc = new NcSoundingLayer();
|
||||
tc.setPressure(10.f);
|
||||
tc.setTemperature(-53.5f);
|
||||
tc.setDewpoint(-9999.f);
|
||||
tc.setWindDirection(265.0f);
|
||||
tc.setWindSpeed(48.0f);
|
||||
tc.setGeoHeight(30950.0f);
|
||||
ttcc.add(tc);
|
||||
|
||||
tc = new NcSoundingLayer();
|
||||
tc.setPressure(70.f);
|
||||
tc.setTemperature(-56.9f);
|
||||
|
@ -1339,7 +1384,6 @@ public class MergeSoundingTest {
|
|||
pd.setDewpoint(-9999.f);
|
||||
ppdd.add(pd);
|
||||
|
||||
|
||||
pd = new NcSoundingLayer();
|
||||
pd.setWindDirection(210.0f);
|
||||
pd.setWindSpeed(16.0f);
|
||||
|
@ -1520,103 +1564,79 @@ public class MergeSoundingTest {
|
|||
pd.setDewpoint(-9999.f);
|
||||
ppdd.add(pd);
|
||||
|
||||
NcSoundingLayer pa;
|
||||
pa = new NcSoundingLayer();
|
||||
|
||||
pa.setPressure(700.f);
|
||||
pa.setTemperature(-9999.f);
|
||||
pa.setDewpoint(-9999.f);
|
||||
pa.setWindDirection(230.f);
|
||||
pa.setWindSpeed(30.0f);
|
||||
pa.setGeoHeight(-9999.f);
|
||||
ppaa.add(pa);
|
||||
|
||||
pa = new NcSoundingLayer();
|
||||
pa.setPressure(300.f);
|
||||
pa.setWindDirection(250.f);
|
||||
pa.setWindSpeed(50.0f);
|
||||
pa.setTemperature(-9999.f);
|
||||
pa.setDewpoint(-9999.f);
|
||||
pa.setGeoHeight(-9999.f);
|
||||
ppaa.add(pa);
|
||||
|
||||
pa = new NcSoundingLayer();
|
||||
pa.setPressure(850.f);
|
||||
pa.setTemperature(-9999.f);
|
||||
pa.setDewpoint(-9999.f);
|
||||
pa.setGeoHeight(-9999.f);
|
||||
pa.setWindDirection(220.f);
|
||||
pa.setWindSpeed(20.0f);
|
||||
ppaa.add(pa);
|
||||
|
||||
pa = new NcSoundingLayer();
|
||||
pa.setPressure(500.f);
|
||||
pa.setTemperature(-9999.f);
|
||||
pa.setDewpoint(-9999.f);
|
||||
pa.setWindDirection(240.f);
|
||||
pa.setWindSpeed(40.0f);
|
||||
pa.setGeoHeight(-9999.f);
|
||||
ppaa.add(pa);
|
||||
|
||||
NcSoundingLayer pc;
|
||||
pc = new NcSoundingLayer();
|
||||
|
||||
pc.setPressure(30.f);
|
||||
pc.setTemperature(-9999.f);
|
||||
pc.setDewpoint(-9999.f);
|
||||
pc.setWindDirection(230.f);
|
||||
pc.setWindSpeed(30.0f);
|
||||
pc.setGeoHeight(-9999.f);
|
||||
ppcc.add(pc);
|
||||
|
||||
pc = new NcSoundingLayer();
|
||||
pc.setPressure(70.f);
|
||||
pc.setTemperature(-9999.f);
|
||||
pc.setDewpoint(-9999.f);
|
||||
pc.setWindDirection(270.f);
|
||||
pc.setWindSpeed(70.0f);
|
||||
pc.setGeoHeight(-9999.f);
|
||||
ppcc.add(pc);
|
||||
|
||||
pc = new NcSoundingLayer();
|
||||
pc.setPressure(50.f);
|
||||
pc.setTemperature(-9999.f);
|
||||
pc.setDewpoint(-9999.f);
|
||||
pc.setWindDirection(250.f);
|
||||
pc.setWindSpeed(50.0f);
|
||||
pc.setGeoHeight(-9999.f);
|
||||
ppcc.add(pc);
|
||||
|
||||
// Sorting the data
|
||||
Collections.sort(ttaa, new MergeSounding.reverseSortByPressure());
|
||||
Collections.sort(ttbb, new MergeSounding.reverseSortByPressure());
|
||||
Collections.sort(ttcc, new MergeSounding.reverseSortByPressure());
|
||||
Collections.sort(ttdd, new MergeSounding.reverseSortByPressure());
|
||||
if ( ms.checkWindData(ppbb)) {
|
||||
Collections.sort(ppbb, new MergeSounding.sortByHeight());
|
||||
Collections.sort(ppdd, new MergeSounding.sortByHeight());
|
||||
} else {
|
||||
Collections.sort(ppbb, new MergeSounding.reverseSortByPressure());
|
||||
Collections.sort(ppdd, new MergeSounding.reverseSortByPressure());
|
||||
}
|
||||
|
||||
// Remove underground mandatory data
|
||||
List<NcSoundingLayer>man = ms.removeUnderGround(ttaa);
|
||||
|
||||
// Find the surface data
|
||||
float elevation = 95.f;
|
||||
sls.add(0, ms.getSurfaceData(man, ttbb, ppbb, elevation));
|
||||
|
||||
// Merge mandatory data (TTAA, TTCC)
|
||||
ms.mergeMandatory(ttaa,ttcc,sls);
|
||||
|
||||
// Merge mandatory winds (PPAA, PPCC)
|
||||
ppaa= null;
|
||||
ppcc= null;
|
||||
if ( ppaa != null && ppcc !=null ) {
|
||||
ms.mergeMandatoryWinds (ppaa, ppcc, sls);
|
||||
}
|
||||
|
||||
// Merge tropopause
|
||||
ms.mergeTropSigTemp (trop_a, trop_c, sls);
|
||||
|
||||
// Merge Significant temperature and dew point (TTBB)
|
||||
ms.mergeTropSigTemp (ttbb, ttdd, sls);
|
||||
|
||||
// Construct height for TTBB and tropopause
|
||||
ms.constructTtbbHeight(sls);
|
||||
|
||||
// Merge significant winds and max winds on pressure surfaces (PPBB)
|
||||
// and construct the height.
|
||||
if (!ms.checkWindData(ppbb)) {
|
||||
ms.mergeSigMaxWindOnPressure(ppbb,ppdd,sls);
|
||||
}
|
||||
ms.mergeSigMaxWindOnPressure(wmax_a,wmax_c,sls);
|
||||
ms.constructPpbbHeight(sls);
|
||||
|
||||
// Merge significant winds on height surfaces and construct the pressures
|
||||
if (ms.checkWindData(ppbb)) {
|
||||
ms.mergeSigWindOnHeight(ppbb,ppdd,sls);
|
||||
ms.constructPpbbPressure(sls);
|
||||
}
|
||||
|
||||
// Interpolate missing temperature, dew point and winds
|
||||
ms.constructMissing(1, sls);
|
||||
ms.constructMissing(2, sls);
|
||||
ms.constructMissing(3, sls);
|
||||
|
||||
// Add below-ground mandatory levels
|
||||
sls = ms.addUnderGround(ttaa, sls);
|
||||
|
||||
// Print the output as the same format as SNLIST for comparison
|
||||
System.out.println ( " PRES TMPC DWPC " +
|
||||
"DRCT SPED HGHT");
|
||||
|
||||
if ( sls != null ) {
|
||||
for (int kk=0; kk < sls.size(); kk++ ) {
|
||||
System.out.println ( " "
|
||||
+ String.format("%9.2f",sls.get(kk).getPressure())
|
||||
+ String.format("%9.2f", sls.get(kk).getTemperature())
|
||||
+ String.format("%9.2f", sls.get(kk).getDewpoint())
|
||||
+ String.format("%9.2f", sls.get(kk).getWindDirection())
|
||||
+ String.format("%9.2f", sls.get(kk).getWindSpeed())
|
||||
+ String.format("%9.2f", sls.get(kk).getGeoHeight()));
|
||||
sls = ms.mergeUairSounding("", ttaa, ttbb, ttcc, ttdd, ppaa, ppbb,
|
||||
ppcc, ppdd, trop_a, trop_c, wmax_a, wmax_c, 770.f);
|
||||
|
||||
ms.printOut(sls);
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
System.out.println ( " Not found");
|
||||
}
|
||||
// float rmult = (float) ((15544.8 - 15240.) / (15245.68 - 15240.));
|
||||
// System.out.println(119.11*(Math.pow(119.00/119.11,rmult)));
|
||||
|
||||
// Get single level data
|
||||
|
||||
List<NcSoundingLayer> singLevel = ms.getSingLevel (500.f, sls);
|
||||
System.out.println ("\n "
|
||||
+ String.format("%9.2f",singLevel.get(0).getPressure())
|
||||
+ String.format("%9.2f", singLevel.get(0).getTemperature())
|
||||
+ String.format("%9.2f", singLevel.get(0).getDewpoint())
|
||||
+ String.format("%9.2f", singLevel.get(0).getWindDirection())
|
||||
+ String.format("%9.2f", singLevel.get(0).getWindSpeed())
|
||||
+ String.format("%9.2f", singLevel.get(0).getGeoHeight()));
|
||||
// System.out.println ( " last !!! " + Integer.valueOf("900".trim()).floatValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue