Issue #181 integrating ncep edex code

Change-Id: I7f3fd64d1e21d5a82b29b404bb90a62bfa6f79bf

Former-commit-id: 71d87e07ef1d5ce2509fddce9170870a5950ba7b
This commit is contained in:
Nate Jensen 2012-01-24 09:49:27 -06:00
parent ea1c82452b
commit a015cc136b
983 changed files with 359354 additions and 15958 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,452 @@
ALTER TABLE mapdata.marinezones ADD COLUMN fips INTEGER;
update mapdata.marinezones set fips=57081 where name = 'Cape Flattery to Cape Lookout';
update mapdata.marinezones set fips=57082 where name = 'Cape Lookout to Point St. George';
update mapdata.marinezones set fips=57083 where name = 'Point St. George to Point Arena';
update mapdata.marinezones set fips=57084 where name = 'Point Arena to Point Conception';
update mapdata.marinezones set fips=57085 where name = 'Port Conception to Guadalupe Island';
update mapdata.marinezones set fips=57110 where name = 'Grays Harbor Bar';
update mapdata.marinezones set fips=57130 where name = 'West Entrance U.S. Waters Strait Of Juan De Fuca';
update mapdata.marinezones set fips=57131 where name = 'Central U.S. Waters Strait Of Juan De Fuca';
update mapdata.marinezones set fips=57132 where name = 'East Entrance U.S. Waters Strait Of Juan De Fuca';
update mapdata.marinezones set fips=57133 where name = 'Northern Inland Waters Including The San Juan Islands';
update mapdata.marinezones set fips=57134 where name = 'Admiralty Inlet';
update mapdata.marinezones set fips=57135 where name = 'Puget Sound and Hood Canal';
update mapdata.marinezones set fips=57150 where name = 'Coastal Waters From Cape Flattery To James Island Out 20 Nm';
update mapdata.marinezones set fips=57153 where name = 'Coastal Waters From James Island To Point Grenville Out 20 Nm';
update mapdata.marinezones set fips=57156 where name = 'Coastal Waters From Point Grenville To Cape Shoalwater Out 20 Nm';
update mapdata.marinezones set fips=57170 where name = 'Coastal Waters From Cape Flattery To James Island 20 To 60 Nm';
update mapdata.marinezones set fips=57173 where name = 'Waters From James Island To Point Grenville 20 To 60 Nm';
update mapdata.marinezones set fips=57176 where name = 'Coastal Waters From Point Grenville To Cape Shoalwater 20 To 60 Nm';
update mapdata.marinezones set fips=57210 where name = 'Columbia River Bar';
update mapdata.marinezones set fips=57250 where name = 'Coastal waters from Cape Shoalwater WA to Cascade Head OR out 20 nm';
update mapdata.marinezones set fips=57255 where name = 'Coastal waters from Cascade Head to Florence OR out 20 nm';
update mapdata.marinezones set fips=57270 where name = 'Waters from Cape Shoalwater WA to Cascade Head OR from 20 to 60 nm';
update mapdata.marinezones set fips=57275 where name = 'Waters from Cascade Head to Florence OR from 20 to 60 nm';
update mapdata.marinezones set fips=57350 where name = 'Coastal waters from Florence to Cape Blanco OR out 20 nm';
update mapdata.marinezones set fips=57356 where name = 'Coastal waters from Cape Blanco OR to Pt. St. George CA out 20 nm';
update mapdata.marinezones set fips=57370 where name = 'Waters from Florence to Cape Blanco OR from 20 to 60 nm';
update mapdata.marinezones set fips=57376 where name = 'Waters from Cape Blanco OR to Pt. St. George CA from 20 to 60 nm';
update mapdata.marinezones set fips=57410 where name = 'Humboldt Bay Bar';
update mapdata.marinezones set fips=57410 where name = 'Humboldt Bay Bar';
update mapdata.marinezones set fips=57450 where name = 'Coastal waters from Pt. St. George to Cape Mendocino CA out 20 nm';
update mapdata.marinezones set fips=57455 where name = 'Coastal waters from Cape Mendocino to Pt. Arena CA out 20 nm';
update mapdata.marinezones set fips=57470 where name = 'Waters from Pt. St. George to Cape Mendocino CA from 20 to 60 nm';
update mapdata.marinezones set fips=57475 where name = 'Waters from Cape Mendocino to Pt. Arena CA from 20 to 60 nm';
update mapdata.marinezones set fips=57530 where name = 'San Francisco/San Pablo/Suisun Bays and the West Delta';
update mapdata.marinezones set fips=57535 where name = 'Monterey Bay';
update mapdata.marinezones set fips=57540 where name = 'Coastal Waters from Point Arena to Point Reyes California out to 20 nm';
update mapdata.marinezones set fips=57545 where name = 'Coastal Waters from Point Reyes to Pigeon Point California out to 20 nm';
update mapdata.marinezones set fips=57560 where name = 'Coastal Waters from Pigeon Point to Point Pinos California out to 20 nm';
update mapdata.marinezones set fips=57565 where name = 'Coastal Waters from Point Pinos to Point Piedras Blancas California out to 20 nm';
update mapdata.marinezones set fips=57570 where name = 'Waters from Pt. Arena to Pigeon Pt. CA from 20 to 60 nm';
update mapdata.marinezones set fips=57575 where name = 'Waters from Pigeon Pt. to Pt. Piedras Blancas CA from 20 to 60 nm';
update mapdata.marinezones set fips=57650 where name = 'East Santa Barbara Channel from Pt. Conception to Pt. Mugu including Santa Cruz and Anacapa Islands';
update mapdata.marinezones set fips=57655 where name = 'Inner waters from Point Mugu to San Mateo Pt. CA including Santa Catalina and Santa Barbara Islands';
update mapdata.marinezones set fips=57670 where name = 'The Waters from Pt. Piedras Blancas to Pt. Arguello and Westward 60 nm';
update mapdata.marinezones set fips=57673 where name = 'Waters from Pt. Arguello to Santa Cruz Island CA and westward 60 nm including San Miguel and Santa Rosa Islands';
update mapdata.marinezones set fips=57676 where name = 'Outer waters from Santa Cruz Island to San Clemente Island to 60 nm offshore including San Nicolas Island';
update mapdata.marinezones set fips=57750 where name = 'Coastal Waters from San Mateo Point to the Mexican Border and out to 30 nm';
update mapdata.marinezones set fips=57775 where name = 'Waters from San Mateo point to the Mexican Border Extending 30 to 60 nm out including San Clemente Island';
update mapdata.marinezones set fips=58011 where name = 'Glacier Bay';
update mapdata.marinezones set fips=58012 where name = 'Northern Lynn Canal';
update mapdata.marinezones set fips=58013 where name = 'Southern Lynn Canal';
update mapdata.marinezones set fips=58021 where name = 'Icy Strait';
update mapdata.marinezones set fips=58022 where name = 'Cross Sound';
update mapdata.marinezones set fips=58031 where name = 'Stephens Passage';
update mapdata.marinezones set fips=58032 where name = 'Northern Chatham Strait';
update mapdata.marinezones set fips=58033 where name = 'Southern Chatham Strait';
update mapdata.marinezones set fips=58034 where name = 'Frederick Sound';
update mapdata.marinezones set fips=58035 where name = 'Sumner Strait';
update mapdata.marinezones set fips=58036 where name = 'Clarence Strait';
update mapdata.marinezones set fips=58041 where name = 'Dixon Entrance to Cape Decision';
update mapdata.marinezones set fips=58042 where name = 'Cape Decision to Cape Edgecumbe';
update mapdata.marinezones set fips=58043 where name = 'Southeast Alaska Outside Waters From Cape Edgecumbe to Cape Fairweather';
update mapdata.marinezones set fips=58051 where name = 'Cape Fairweather to Icy Cape';
update mapdata.marinezones set fips=58052 where name = 'Icy Cape to Cape Suckling';
update mapdata.marinezones set fips=58053 where name = 'Yakutat Bay';
update mapdata.marinezones set fips=58120 where name = 'Cape Suckling to Gore Point';
update mapdata.marinezones set fips=58121 where name = 'Resurrection Bay';
update mapdata.marinezones set fips=58125 where name = 'Prince William Sound';
update mapdata.marinezones set fips=58126 where name = 'Port of Valdez';
update mapdata.marinezones set fips=58127 where name = 'Valdez Narrows';
update mapdata.marinezones set fips=58128 where name = 'Valdez Arm';
update mapdata.marinezones set fips=58129 where name = 'Passage Canal';
update mapdata.marinezones set fips=58130 where name = 'Barren Islands And Kamishak Bay Waters';
update mapdata.marinezones set fips=58132 where name = 'Gore Point To Sitkinak';
update mapdata.marinezones set fips=58136 where name = 'Chiniak Bay';
update mapdata.marinezones set fips=58137 where name = 'Marmot Bay';
update mapdata.marinezones set fips=58138 where name = 'Shelikof Strait';
update mapdata.marinezones set fips=58140 where name = 'Cook Inlet North of Kamishak Bay and English Bay';
update mapdata.marinezones set fips=58141 where name = 'Kachemak Bay';
update mapdata.marinezones set fips=58150 where name = 'Sitkinak to Castle Cape';
update mapdata.marinezones set fips=58155 where name = 'Castle Cape to Cape Sarichef';
update mapdata.marinezones set fips=58160 where name = 'Cape Newenham to Port Heiden';
update mapdata.marinezones set fips=58165 where name = 'Port Heiden to Cape Sarichef';
update mapdata.marinezones set fips=58170 where name = 'Cape Sarichef to Nikoski';
update mapdata.marinezones set fips=58171 where name = 'Unalaska Bay';
update mapdata.marinezones set fips=58172 where name = 'Nikolski to Adak';
update mapdata.marinezones set fips=58175 where name = 'Adak to Kiska';
update mapdata.marinezones set fips=58175 where name = 'Adak to Kiska';
update mapdata.marinezones set fips=58176 where name = 'Kiska to Attu';
update mapdata.marinezones set fips=58179 where name = 'Pribilof Islands Nearshore Waters';
update mapdata.marinezones set fips=58180 where name = 'Cape Newenham to Dall Point';
update mapdata.marinezones set fips=58185 where name = 'St Matthew Island Waters';
update mapdata.marinezones set fips=58185 where name = 'St Matthew Island Waters';
update mapdata.marinezones set fips=58200 where name = 'Norton Sound';
update mapdata.marinezones set fips=58210 where name = 'Dall Point to Wales';
update mapdata.marinezones set fips=58215 where name = 'Kotzebue Sound';
update mapdata.marinezones set fips=58220 where name = 'Wales to Cape Thompson';
update mapdata.marinezones set fips=58225 where name = 'Cape Thompson to Cape Beaufort';
update mapdata.marinezones set fips=58230 where name = 'Cape Beaufort to Point Franklin';
update mapdata.marinezones set fips=58235 where name = 'Point Franklin to Cape Halkett';
update mapdata.marinezones set fips=58240 where name = 'Cape Halkett to Flaxman Island';
update mapdata.marinezones set fips=58245 where name = 'Flaxman Island to Demarcation Point';
update mapdata.marinezones set fips=58310 where name = 'Gulf of Alaska North of 55 Degrees North and East of 144 Degrees West';
update mapdata.marinezones set fips=58351 where name = 'Gluf of Alaska Offshore North of 57N and West of 144W';
update mapdata.marinezones set fips=58352 where name = 'Gulf of Alaska Offshore South of 57N North of 55N and West of 144W';
update mapdata.marinezones set fips=58411 where name = 'Bering Sea Offshore West of 180 and East of the International Dateline';
update mapdata.marinezones set fips=58412 where name = 'Bering Sea Offshore 171W to 180 and North of 56N';
update mapdata.marinezones set fips=58413 where name = 'Bering Sea Offshore 171W to 180 and South of 56N';
update mapdata.marinezones set fips=58414 where name = 'Bering Sea Offshore East of 171W';
update mapdata.marinezones set fips=59110 where name = 'Kauai Northwest Waters';
update mapdata.marinezones set fips=59111 where name = 'Kauai Windward Waters';
update mapdata.marinezones set fips=59112 where name = 'Kauai Leeward Waters';
update mapdata.marinezones set fips=59113 where name = 'Kauai Channel';
update mapdata.marinezones set fips=59114 where name = 'Oahu Windward Waters';
update mapdata.marinezones set fips=59115 where name = 'Oahu Leeward Waters';
update mapdata.marinezones set fips=59115 where name = 'Oahu Leeward Waters';
update mapdata.marinezones set fips=59115 where name = 'Oahu Leeward Waters';
update mapdata.marinezones set fips=59116 where name = 'Kaiwi Channel';
update mapdata.marinezones set fips=59117 where name = 'Maui County Windward Waters';
update mapdata.marinezones set fips=59118 where name = 'Maui County Leeward Waters';
update mapdata.marinezones set fips=59119 where name = 'Maalaea Bay';
update mapdata.marinezones set fips=59120 where name = 'Pailolo Channel';
update mapdata.marinezones set fips=59121 where name = 'Alenuihaha Channel';
update mapdata.marinezones set fips=59122 where name = 'Big Island Windward Waters';
update mapdata.marinezones set fips=59123 where name = 'Big Island Leeward Waters';
update mapdata.marinezones set fips=59124 where name = 'Big Island Southeast Waters';
update mapdata.marinezones set fips=59180 where name = 'Offshore Waters Within 240 nm of Honolulu';
update mapdata.marinezones set fips=61150 where name = 'Coastal waters of Tututila and Aunuu';
update mapdata.marinezones set fips=61151 where name = 'Coastal waters of Manua';
update mapdata.marinezones set fips=61152 where name like 'Coastal waters of Swain%';
update mapdata.marinezones set fips=65151 where name = 'Guam Coastal Waters';
update mapdata.marinezones set fips=65152 where name = 'Rota Coastal Waters';
update mapdata.marinezones set fips=65153 where name = 'Tinian Coastal Waters';
update mapdata.marinezones set fips=65154 where name = 'Saipan Coastal Waters';
update mapdata.marinezones set fips=65161 where name = 'Koror Palau Coastal Waters';
update mapdata.marinezones set fips=65171 where name = 'Yap Coastal Waters';
update mapdata.marinezones set fips=65172 where name = 'Chuuk Coastal Waters';
update mapdata.marinezones set fips=65173 where name = 'Pohnpei Coastal Waters';
update mapdata.marinezones set fips=65174 where name = 'Kosrae Coastal Waters';
update mapdata.marinezones set fips=65181 where name = 'Majuro Coastal Waters';
update mapdata.marinezones set fips=65191 where name = 'Waters out to 40 Nautical Miles';
update mapdata.marinezones set fips=73050 where name = 'Coastal Waters from Eastport, ME to Schoodic Point, ME out 25 NM';
update mapdata.marinezones set fips=73051 where name = 'Coastal Waters from Schoodic Point, ME to Stonington, ME out 25 NM';
update mapdata.marinezones set fips=73052 where name = 'Intra Coastal Waters from Schoodic Point, ME to Stonington, ME';
update mapdata.marinezones set fips=73070 where name = 'Waters from Eastport ME to Stonington (Deer Isle) ME from 25 to 40 nm';
update mapdata.marinezones set fips=73081 where name = 'Gulf of Maine';
update mapdata.marinezones set fips=73082 where name = 'Georges Bank';
update mapdata.marinezones set fips=73083 where name = 'South of New England';
update mapdata.marinezones set fips=73084 where name = 'Hudson Canyon to Baltimore Canyon';
update mapdata.marinezones set fips=73085 where name = 'Baltimore Canyon to Hatteras Canyon';
update mapdata.marinezones set fips=73086 where name = 'Hatteras Canyon to Cape Fear';
update mapdata.marinezones set fips=73088 where name = 'Cape Fear to 31 N';
update mapdata.marinezones set fips=73150 where name = 'Coastal Waters from Stonington, ME to Port Clyde, ME out 25 NM';
update mapdata.marinezones set fips=73151 where name = 'Penobscot Bay';
update mapdata.marinezones set fips=73152 where name = 'Coastal Waters from Port Clyde, ME to Cape Elizabeth, ME out 25 NM';
update mapdata.marinezones set fips=73153 where name = 'Casco Bay';
update mapdata.marinezones set fips=73154 where name = 'Coastal Waters from Cape Elizabeth, ME to Merrimack River, MA out 25 NM';
update mapdata.marinezones set fips=73170 where name = 'Waters from Stonington (Deer Isle) ME to Merrimack River MA from 25 to 40 nm';
update mapdata.marinezones set fips=73230 where name = 'Boston Harbor';
update mapdata.marinezones set fips=73231 where name = 'Cape Cod Bay';
update mapdata.marinezones set fips=73232 where name = 'Nantucket Sound';
update mapdata.marinezones set fips=73233 where name = 'Vineyard Sound';
update mapdata.marinezones set fips=73234 where name = 'Buzzards Bay';
update mapdata.marinezones set fips=73235 where name = 'Rhode Island Sound';
update mapdata.marinezones set fips=73236 where name = 'Narragansett Bay';
update mapdata.marinezones set fips=73237 where name = 'Block Island Sound';
update mapdata.marinezones set fips=73250 where name = 'Coastal waters from Merrimack River MA out 25 nm to Plymouth MA out 40 nm';
update mapdata.marinezones set fips=73254 where name = 'Coastal waters from Provincetown MA to Chatham MA to Nantucket MA out 20 nm';
update mapdata.marinezones set fips=73255 where name = 'Coastal waters from Nantucket MA to Marthas Vineyard MA to Block Island RI to Montauk NY Southeast to 20 nm';
update mapdata.marinezones set fips=73270 where name = 'Waters from Merrimack River MA to Watch Hill RI from 25 to 40 nm';
update mapdata.marinezones set fips=73330 where name = 'Long Island Sound East of New Haven CT/Port Jefferson NY';
update mapdata.marinezones set fips=73335 where name = 'Long Island Sound West of New Haven CT/Port Jefferson NY';
update mapdata.marinezones set fips=73338 where name = 'New York Harbor';
update mapdata.marinezones set fips=73340 where name = 'Peconic and Gardiners Bays';
update mapdata.marinezones set fips=73345 where name = 'South Shore Bays from Jones Inlet through Shinnecock Bay';
update mapdata.marinezones set fips=73350 where name = 'Moriches Inlet NY to Montauk Point NY out 20 nm';
update mapdata.marinezones set fips=73353 where name = 'Fire Island Inlet NY to Moriches Inlet NY out 20 nm';
update mapdata.marinezones set fips=73355 where name = 'Sandy Hook NJ to Fire Island Inlet NY out 20 nm';
update mapdata.marinezones set fips=73370 where name = 'Waters from Montauk Point NY to Sandy Hook NJ from 20 to 40 nm';
update mapdata.marinezones set fips=73430 where name = 'Delaware Bay waters north of East Point NJ to Slaughter Beach DE';
update mapdata.marinezones set fips=73431 where name = 'Delaware Bay waters south of East Point NJ to Slaughter Beach DE';
update mapdata.marinezones set fips=73450 where name = 'Coastal waters from Sandy Hook to Manasquan Inlet NJ out 20 nm';
update mapdata.marinezones set fips=73451 where name = 'Coastal waters from Manasquan Inlet to Little Egg Inlet NJ out 20 nm';
update mapdata.marinezones set fips=73452 where name = 'Coastal waters from Little Egg Inlet to Great Egg Inlet NJ out 20 nm';
update mapdata.marinezones set fips=73453 where name = 'Coastal waters from Great Egg Inlet to Cape May NJ out 20 nm';
update mapdata.marinezones set fips=73454 where name = 'Coastal waters from Cape May NJ to Cape Henlopen DE out 20 nm';
update mapdata.marinezones set fips=73455 where name = 'Coastal waters from Cape Henlopen to Fenwick Island DE out 20 nm';
update mapdata.marinezones set fips=73470 where name = 'Waters from Sandy Hook NJ to Fenwick Island DE from 20 to 40 nm';
update mapdata.marinezones set fips=73530 where name = 'Chesapeake Bay north of Pooles Island MD';
update mapdata.marinezones set fips=73531 where name = 'Chesapeake Bay from Pooles Island to Sandy Point MD';
update mapdata.marinezones set fips=73532 where name = 'Chesapeake Bay from Sandy Point to North Beach MD';
update mapdata.marinezones set fips=73533 where name = 'Chesapeake Bay from North Beach to Drum Point MD';
update mapdata.marinezones set fips=73534 where name = 'Chesapeake Bay from Drum Point MD to Smith Point VA';
update mapdata.marinezones set fips=73535 where name = 'Tidal Potomac from Key Bridge to Indian Head MD';
update mapdata.marinezones set fips=73536 where name = 'Tidal Potomac from Indian Head to Cobb Island MD';
update mapdata.marinezones set fips=73537 where name = 'Tidal Potomac from Cobb Island MD to Smith Point VA';
update mapdata.marinezones set fips=73630 where name = 'Chesapeake Bay from Smith Point to Windmill Point VA';
update mapdata.marinezones set fips=73631 where name = 'Chesapeake Bay from Windmill Point to New Point Comfort VA';
update mapdata.marinezones set fips=73632 where name = 'Chesapeake Bay from New Point Comfort to Cape Henry VA';
update mapdata.marinezones set fips=73633 where name = 'Currituck Sound';
update mapdata.marinezones set fips=73650 where name = 'Coastal waters from Fenwick Island DE to Chincoteague VA out 20 nm';
update mapdata.marinezones set fips=73652 where name = 'Coastal waters from Chincoteague to Parramore Island VA out 20 nm';
update mapdata.marinezones set fips=73654 where name = 'Coastal waters from Parramore Island to Cape Charles Light VA out 20 nm';
update mapdata.marinezones set fips=73656 where name = 'Coastal waters from Cape Charles Light VA to NC VA border out 20 nm';
update mapdata.marinezones set fips=73658 where name = 'Coastal waters from NC VA border to Currituck Beach Light NC out 20 nm';
update mapdata.marinezones set fips=73670 where name = 'Waters from Fenwick Island DE to Currituck Beach Light NC from 20 to 40 nm';
update mapdata.marinezones set fips=75080 where name = 'Southwest North Atlantic South of 31 North and West of 65 West';
update mapdata.marinezones set fips=75082 where name = 'NW Caribbean North of 15 North and West of 75 West';
update mapdata.marinezones set fips=75084 where name = 'SW Caribbean South of 15 North and West of 75 West';
update mapdata.marinezones set fips=75086 where name = 'East Caribbean East of 75 West';
update mapdata.marinezones set fips=75087 where name = 'Tropical North Atlantic from the coastal waters of South America to 22N Between 55W and 65W Including Waters North and East of the Leeward and Windward Islands';
update mapdata.marinezones set fips=75130 where name = 'Albemarle Sound';
update mapdata.marinezones set fips=75135 where name = 'Pamlico Sound';
update mapdata.marinezones set fips=75150 where name = 'Coastal waters from Currituck Beach Light to Oregon Inlet NC out 20 nm';
update mapdata.marinezones set fips=75152 where name = 'Coastal waters from Oregon Inlet to Cape Hatteras NC out 20 nm';
update mapdata.marinezones set fips=75154 where name = 'Coastal waters from Cape Hatteras to Ocracoke Inlet NC out 20 nm';
update mapdata.marinezones set fips=75156 where name = 'Coastal waters from Ocracoke Inlet to Cape Lookout NC out 20 nm';
update mapdata.marinezones set fips=75158 where name = 'Coastal waters from Cape Lookout to Surf City NC out 20 nm';
update mapdata.marinezones set fips=75170 where name = 'Waters from Currituck Beach Light to Surf City NC from 20 to 40 nm';
update mapdata.marinezones set fips=75250 where name = 'Coastal waters from Surf City to Cape Fear NC out 20 nm';
update mapdata.marinezones set fips=75252 where name = 'Coastal waters from Cape Fear NC to Little River Inlet SC out 20 nm';
update mapdata.marinezones set fips=75254 where name = 'Coastal waters from Little River Inlet to Murrells Inlet SC out 20 nm';
update mapdata.marinezones set fips=75256 where name = 'Coastal waters from Murrells Inlet to South Santee River SC out 20 nm';
update mapdata.marinezones set fips=75270 where name = 'Waters from Surf City NC to South Santee River SC from 20 to 40 nm';
update mapdata.marinezones set fips=75330 where name = 'Charleston Harbor';
update mapdata.marinezones set fips=75350 where name = 'Coastal waters from South Santee River to Edisto Beach SC out 20 nm';
update mapdata.marinezones set fips=75352 where name = 'Coastal waters from Edisto Beach SC to Savannah GA out 20 nm';
update mapdata.marinezones set fips=75354 where name = 'Coastal waters from Savannah GA to Altamaha Sound GA out 20 nm ...including Grays Reef National Marine Sanctuary';
update mapdata.marinezones set fips=75370 where name = 'Waters from South Santee River SC to Savannah GA extending from 20 nm to 40 nm';
update mapdata.marinezones set fips=75374 where name = 'Waters from Savannah GA to Altamaha Sound GA extending from 20 to 60 nm';
update mapdata.marinezones set fips=75450 where name = 'Coastal waters from Altamaha Sound to Fernandina Beach FL out 20 NM';
update mapdata.marinezones set fips=75452 where name = 'Coastal waters from Fernandina Beach to St. Augustine FL out 20 NM';
update mapdata.marinezones set fips=75454 where name = 'Coastal waters from St. Augustine to Flagler Beach FL out 20 NM';
update mapdata.marinezones set fips=75470 where name = 'Waters from Altamaha Sound GA to Fernandina Beach FL from 20 to 60 NM';
update mapdata.marinezones set fips=75472 where name = 'Waters from Fernandina Beach to St. Augustine FL from 20 to 60 NM';
update mapdata.marinezones set fips=75474 where name = 'Waters from St. Augustine to Flagler Beach FL from 20 to 60 NM';
update mapdata.marinezones set fips=75550 where name = 'Flagler Beach to Volusia-Brevard County Line 0-20 nm';
update mapdata.marinezones set fips=75552 where name = 'Volusia-Brevard County Line to Sebastian Inlet 0-20 nm';
update mapdata.marinezones set fips=75555 where name = 'Sebastian Inlet to Jupiter Inlet 0-20 nm';
update mapdata.marinezones set fips=75570 where name = 'Flagler Beach to Volusia-Brevard County Line 20-60 nm';
update mapdata.marinezones set fips=75572 where name = 'Volusia-Brevard County Line to Sebastian Inlet 20-60 nm';
update mapdata.marinezones set fips=75575 where name = 'Sebastian Inlet to Jupiter Inlet 20-60 nm';
update mapdata.marinezones set fips=75610 where name = 'Lake Okeechobee';
update mapdata.marinezones set fips=75630 where name = 'Biscayne Bay';
update mapdata.marinezones set fips=75650 where name = 'Coastal waters from Jupiter Inlet to Deerfield Beach FL out 20 NM';
update mapdata.marinezones set fips=75651 where name = 'Coastal waters from Deerfield Beach to Ocean Reef FL out 20 NM';
update mapdata.marinezones set fips=75670 where name = 'Waters from Jupiter Inlet to Deerfield Beach FL from 20 to 60 NM';
update mapdata.marinezones set fips=75671 where name = 'Waters from Deerfield Beach to Ocean Reef FL from 20 to 60 NM excluding the territorial waters of Bahamas';
update mapdata.marinezones set fips=75710 where name = 'Atlantic waters northward to 19.5N and between 64N and 68W from northwest coast of Puerto Rico at Punta Cadena eastward to mouth of Rio Guajataca extending beyond 100 fathom line to the Anegada Passage';
update mapdata.marinezones set fips=75720 where name = 'Atlantic nearshore waters from mouth of Rio Guajataca eastward to Cabo San Juan then eastward to Culebra St. Thomas St. John and adjacent islands out to 100 fathom line.';
update mapdata.marinezones set fips=75730 where name = 'Caribbean waters from Punta Viento to Cabo San Juan extending southward to 17N and eastward to 64W including the Caribbean waters of Culebra and Vieques and of the U.S. Virgin Islands.';
update mapdata.marinezones set fips=75740 where name = 'Caribbean waters from Punta Viento to Punta Melones and the waters outside of 12 NM from Punta Melones to Punta Cadena extending southward of to 17N and westward to 68W';
update mapdata.marinezones set fips=75750 where name = 'Nearshore waters of west coast of Puerto Rico from Punta Cadena to Punta Melones westward out 12 NM.';
update mapdata.marinezones set fips=77031 where name = 'Florida Bay';
update mapdata.marinezones set fips=77032 where name = 'Gulf Side of the Lower Keys out 20 NM';
update mapdata.marinezones set fips=77033 where name = 'Waters from East Cape Sable to Chokoloskee 20 to 60 NM';
update mapdata.marinezones set fips=77052 where name = 'Coastal waters from Ocean Reef to Craig Key out 20 NM';
update mapdata.marinezones set fips=77053 where name = 'Coastal waters from Craig Key to the west end of the Seven Mile Bridge out 20 NM';
update mapdata.marinezones set fips=77054 where name = 'Coastal waters from the west end of the Seven Mile Bridge to Key West out 20 NM';
update mapdata.marinezones set fips=77072 where name = 'Waters from Ocean Reef to Craig Key from 20 to 60 NM';
update mapdata.marinezones set fips=77073 where name = 'Waters from Craig Key to the west end of the Seven Mile Bridge 20 to 60 NM';
update mapdata.marinezones set fips=77074 where name = 'Waters from the west end of the Seven Mile Bridge to Key West 20 to 60 NM';
update mapdata.marinezones set fips=77075 where name = 'Waters from Key West to 20 NM west of Dry Tortugas north 20 NM and south 60 nm';
update mapdata.marinezones set fips=77080 where name = 'Northwest Gulf North of 25 North and West of 90 West';
update mapdata.marinezones set fips=77082 where name = 'Southwest Gulf South of 25 North and West of 90 West';
update mapdata.marinezones set fips=77084 where name = 'Middle Gulf between 85 West and 90 West';
update mapdata.marinezones set fips=77086 where name = 'East Gulf between 81 West and 85 West';
update mapdata.marinezones set fips=77130 where name = 'Laguna Madre From the Port Of Brownsville to the Arroyo Colorado';
update mapdata.marinezones set fips=77132 where name = 'Laguna Madre From The Arroyo Coloardo To 5 NM North Of Port Mansfield TX';
update mapdata.marinezones set fips=77135 where name = 'Laguna Madre From 5 nm North Of Port Mansfield To Baffin Bay TX';
update mapdata.marinezones set fips=77150 where name = 'Coastal waters from Port Mansfield TX to the Rio Grande River out 20 NM';
update mapdata.marinezones set fips=77155 where name = 'Coastal waters from Baffin Bay to Port Mansfield TX out 20 NM';
update mapdata.marinezones set fips=77170 where name = 'Waters from Port Mansfield TX to the Rio Grande River from 20 to 60 NM';
update mapdata.marinezones set fips=77175 where name = 'Waters from Baffin Bay to Port Mansfield TX from 20 to 60 NM';
update mapdata.marinezones set fips=77230 where name = 'Bays and Waterways from Baffin Bay to Port Aransas';
update mapdata.marinezones set fips=77235 where name like 'Bays and Waterways from Port Aransas to Port O%';
update mapdata.marinezones set fips=77250 where name = 'Coastal waters from Baffin Bay to Port Aransas out 20 NM';
update mapdata.marinezones set fips=77255 where name = 'Coastal waters from Port Aransas to Matagorda Ship Channel out 20 NM';
update mapdata.marinezones set fips=77270 where name = 'Waters from Baffin Bay to Port Aransas from 20 to 60 NM';
update mapdata.marinezones set fips=77275 where name = 'Waters from Port Aransas to Matagorda Ship Channel from 20 to 60 NM';
update mapdata.marinezones set fips=77330 where name = 'Matagorda Bay';
update mapdata.marinezones set fips=77335 where name = 'Galveston Bay';
update mapdata.marinezones set fips=77350 where name = 'Coastal waters from Freeport to Matagorda Ship Channel TX out 20 NM';
update mapdata.marinezones set fips=77355 where name = 'Coastal waters from High Island to Freeport TX out 20 NM';
update mapdata.marinezones set fips=77370 where name = 'Waters from Freeport to Matagorda Ship Channel TX from 20 to 60 NM';
update mapdata.marinezones set fips=77375 where name = 'Waters from High Island to Freeport TX from 20 to 60 NM';
update mapdata.marinezones set fips=77450 where name = 'Coastal waters from Cameron LA to High Island TX out 20 NM';
update mapdata.marinezones set fips=77452 where name = 'Coastal waters from Intracoastal City to Cameron LA out 20 NM';
update mapdata.marinezones set fips=77455 where name = 'Coastal waters from Lower Atchafalaya River to Intracoastal City LA out 20 NM';
update mapdata.marinezones set fips=77470 where name = 'Waters from Cameron LA to High Island TX from 20 to 60 NM';
update mapdata.marinezones set fips=77472 where name = 'Waters from Intracoastal City to Cameron LA from 20 to 60 NM';
update mapdata.marinezones set fips=77475 where name = 'Waters from Lower Atchafalaya River to Intracoastal City LA from 20 to 60 NM';
update mapdata.marinezones set fips=77530 where name = 'Lake Pontchartrain and Lake Maurepas';
update mapdata.marinezones set fips=77550 where name = 'Coastal waters from the southwest pass of the Mississippi River to Lower Atchafalaya River LA out 20 NM';
update mapdata.marinezones set fips=77555 where name = 'Coastal waters from Pascagoula MS to the Southwest Pass of the Mississippi River out 20 NM';
update mapdata.marinezones set fips=77570 where name = 'Waters from the Southwest Pass of the Mississippi River to Lower Atchafalaya River LA from 20 to 60 NM';
update mapdata.marinezones set fips=77575 where name = 'Waters from Pascagoula MS to the Southwest Pass of the Mississippi River from 20 to 60 NM';
update mapdata.marinezones set fips=77630 where name = 'Mobile Bay';
update mapdata.marinezones set fips=77650 where name = 'Coastal waters from Pensacola FL to Pascagoula MS out 20 NM';
update mapdata.marinezones set fips=77655 where name = 'Coastal waters from Destin to Pensacola FL out 20 NM';
update mapdata.marinezones set fips=77656 where name = 'Coastal waters from Chokoloskee to Bonita Beach FL out 20 NM';
update mapdata.marinezones set fips=77657 where name = 'Coastal waters from East Cape Sable to Chokoloskee FL out 20 NM';
update mapdata.marinezones set fips=77670 where name = 'Waters from Pensacola FL to Pascagoula MS from 20 to 60 NM';
update mapdata.marinezones set fips=77675 where name = 'Waters from Destin to Pensacola FL from 20 to 60 NM';
update mapdata.marinezones set fips=77676 where name = 'Waters from Chokoloskee to Bonita Beach FL from 20 to 60 NM';
update mapdata.marinezones set fips=77730 where name = 'Apalachee Bay or Coastal Waters From Keaton Beach to Ochlockonee River Fl out to 20 Nm';
update mapdata.marinezones set fips=77750 where name = 'Coastal waters from Apalachicola to Destin FL out 20 NM';
update mapdata.marinezones set fips=77755 where name = 'Coastal waters from Suwannee River to Apalachicola FL out 20 NM';
update mapdata.marinezones set fips=77755 where name = 'Coastal Waters From Ochlockonee River to Apalachicola Fl out to 20 Nm';
update mapdata.marinezones set fips=77765 where name = 'Coastal waters from Suwannee River to Keaton Beach out 20 NM';
update mapdata.marinezones set fips=77770 where name = 'Waters from Apalachicola to Destin FL from 20 to 60 NM';
update mapdata.marinezones set fips=77775 where name = 'Waters from Suwannee River to Apalachicola FL from 20 to 60 NM';
update mapdata.marinezones set fips=77830 where name = 'Tampa Bay waters';
update mapdata.marinezones set fips=77850 where name = 'Coastal waters from Tarpon Springs to Suwannee River FL out 20 NM';
update mapdata.marinezones set fips=77853 where name = 'Coastal waters from Englewood to Tarpon Springs FL out 20 NM';
update mapdata.marinezones set fips=77856 where name = 'Coastal waters from Bonita Beach to Englewood FL out 20 NM';
update mapdata.marinezones set fips=77870 where name = 'Waters from Tarpon Springs to Suwannee River FL out 20 to 60 NM';
update mapdata.marinezones set fips=77873 where name = 'Waters from Englewood to Tarpon Springs FL out 20 to 60 NM';
update mapdata.marinezones set fips=77876 where name = 'Waters from Bonita Beach to Englewood FL out 20 to 60 NM';
update mapdata.marinezones set fips=91121 where name = 'Chequamegon Bay-Bayfield to Oak Point WI';
update mapdata.marinezones set fips=91140 where name = 'Grand Portage to Grand Marais MN';
update mapdata.marinezones set fips=91141 where name = 'Grand Marais to Taconite Harbor MN';
update mapdata.marinezones set fips=91142 where name = 'Taconite Harbor to Silver Bay Harbor MN';
update mapdata.marinezones set fips=91143 where name = 'Silver Bay Harbor to Two Harbors MN';
update mapdata.marinezones set fips=91144 where name = 'Two Harbors to Duluth MN';
update mapdata.marinezones set fips=91145 where name = 'Duluth MN to Port Wing WI';
update mapdata.marinezones set fips=91146 where name = 'Port Wing to Sand Island WI';
update mapdata.marinezones set fips=91147 where name = 'Sand Island to Bayfield WI';
update mapdata.marinezones set fips=91148 where name = 'Oak Point to Saxon Harbor WI';
update mapdata.marinezones set fips=91162 where name = 'Lake Superior west of a line from Saxon Harbor WI to Grand Portage MN beyond 5NM';
update mapdata.marinezones set fips=91240 where name = 'Saxon Harbor WI to Black River MI';
update mapdata.marinezones set fips=91241 where name = 'Black River To Ontonagon MI';
update mapdata.marinezones set fips=91242 where name = 'Ontonagon to Upper Entrance of Portage Canal MI';
update mapdata.marinezones set fips=91243 where name = 'Upper Entrance of Portage Canal to Eagle River MI';
update mapdata.marinezones set fips=91244 where name = 'Eagle River to Manitou Island MI';
update mapdata.marinezones set fips=91245 where name = 'Manitou Island to Point Isabelle MI';
update mapdata.marinezones set fips=91246 where name = 'Point Isabelle to Lower Entrance of Portage Canal MI';
update mapdata.marinezones set fips=91247 where name = 'Portage Lake to Huron Island MI to Lower Entrance of Portage Canal To Huron Islands MI Including Keweenaw and Huron Bays';
update mapdata.marinezones set fips=91248 where name = 'Huron Islands to Marquette MI';
update mapdata.marinezones set fips=91249 where name = 'Marquette to Munising MI';
update mapdata.marinezones set fips=91250 where name = 'Munising to Grand Marais MI';
update mapdata.marinezones set fips=91251 where name = 'Grand Marais to Whitefish Point MI';
update mapdata.marinezones set fips=91263 where name = 'Lake Superior from Saxon Harbor WI to Upper Entrance to Portage Canal MI 5NM off shore to the US/Canadian border including Isle Royal National Park';
update mapdata.marinezones set fips=91264 where name = 'Lake Superior from Upper Entrance to Portage Canal to Manitou Island MI 5NM off shore to the US/Canadian Border';
update mapdata.marinezones set fips=91265 where name = 'Lake Superior West of Line from Manitou Island to Marquette MI Beyond 5NM from shore';
update mapdata.marinezones set fips=91266 where name = 'Lake Superior East of a line from Manitou Island to Marquette MI and West of a line from Grand Marais MI to the US/Canadian Border Beyond 5NM from shore';
update mapdata.marinezones set fips=91267 where name = 'Lake Superior from Grand Marais MI to Whitefish Point MI 5NM off shore to the US/Canadian border';
update mapdata.marinezones set fips=91321 where name = 'Whitefish Bay (U.S. Portion)/Whitefish Point to Point Iroquois MI';
update mapdata.marinezones set fips=91322 where name = 'St. Marys River Point Iroquois to E. Potagannissing Bay';
update mapdata.marinezones set fips=92043 where name = 'New Buffalo MI to St Joseph MI';
update mapdata.marinezones set fips=92046 where name = 'Michigan City IN to New Buffalo MI';
update mapdata.marinezones set fips=92080 where name = 'Lake Michigan Michigan City IN to St. Joseph MI 5 NM off shore to Mid Lake';
update mapdata.marinezones set fips=92221 where name = 'Green Bay North of line from Cedar River MI to Rock Island Passage';
update mapdata.marinezones set fips=92248 where name = 'Seul Choix Point to Point Detour MI';
update mapdata.marinezones set fips=92250 where name = '5NM East of a line from Fairport MI to Rock Island Passage';
update mapdata.marinezones set fips=92261 where name = 'Lake Michigan from Seul Choix Point to Rock Island Passage 5NM off shore to the Mid Line of the Lake';
update mapdata.marinezones set fips=92323 where name = 'Grand Traverse Bay south of a line Grand Traverse Light to Norwood MI';
update mapdata.marinezones set fips=92341 where name = 'Seul Choix Point to 5NM West of Mackinac Bridge';
update mapdata.marinezones set fips=92342 where name = 'Norwood MI to 5NM West of Mackinac Bridge including Little Traverse Bay';
update mapdata.marinezones set fips=92344 where name = 'Sleeping Bear Point to Grand Traverse Light MI';
update mapdata.marinezones set fips=92345 where name = 'Point Betsie to Sleeping Bear Point MI';
update mapdata.marinezones set fips=92346 where name = 'Manistee to Point Betsie MI';
update mapdata.marinezones set fips=92362 where name = 'Lake Michigan South of a line from Seul Choix Point to the Mackinac Bridge and North of a line from Charlevoix MI to South Fox Island 5NM off shore';
update mapdata.marinezones set fips=92364 where name = 'Lake Michigan from Charlevoix to Point Betsie MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92366 where name = 'Lake Michigan from Point Betsie to Manistee MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92521 where name = 'Green Bay south of line from Cedar River to Rock Island Passage and north of a line from Oconto WI to Little Sturgeon Bay WI';
update mapdata.marinezones set fips=92522 where name = 'Green Bay south of line from Oconto WI to Little Sturgeon Bay WI';
update mapdata.marinezones set fips=92541 where name = 'Rock Island Passage to Sturgeon Bay WI';
update mapdata.marinezones set fips=92542 where name = 'Sturgeon Bay to Two Rivers WI';
update mapdata.marinezones set fips=92543 where name = 'Two Rivers to Sheboygan WI';
update mapdata.marinezones set fips=92563 where name = 'Lake Michigan from Rock Island Passage to Sturgeon Bay WI 5NM off shore to mid lake';
update mapdata.marinezones set fips=92565 where name = 'Lake Michigan from Sturgeon Bay to Two Rivers WI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92567 where name = 'Lake Michigan from Two Rivers to Sheboygan WI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92643 where name = 'Sheboygan to Port Washington WI';
update mapdata.marinezones set fips=92644 where name = 'Port Washington to North Point Light WI';
update mapdata.marinezones set fips=92645 where name = 'North Point Light to Wind Point WI';
update mapdata.marinezones set fips=92646 where name = 'Wind Point WI to Winthrop Harbor IL';
update mapdata.marinezones set fips=92669 where name = 'Lake Michigan from Sheboygan to Port Washington WI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92671 where name = 'Lake Michigan from Port Washington to North Point Light WI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92673 where name = 'Lake Michigan from North Point Light to Wind Point WI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92675 where name = 'Lake Michigan from Wind Point WI to Winthrop Harbor IL 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92740 where name = 'Winthrop Harbor to Wilmette Harbor IL';
update mapdata.marinezones set fips=92741 where name = 'Wilmette Harbor to Northerly Island IL';
update mapdata.marinezones set fips=92742 where name = 'Northerly Island to Calumet Harbor IL';
update mapdata.marinezones set fips=92743 where name = 'Calumet Harbor IL to Gary IN';
update mapdata.marinezones set fips=92744 where name = 'Gary to Burns Harbor IN';
update mapdata.marinezones set fips=92745 where name = 'Burns Harbor to Michigan City IN';
update mapdata.marinezones set fips=92777 where name = 'Lake Michigan from Winthrop Harbor to Wilmette Harbor IL 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92779 where name = 'Lake Michigan from Wilmette Harbor to Michigan City in 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92844 where name = 'St Joseph to South Haven MI';
update mapdata.marinezones set fips=92845 where name = 'South Haven to Holland MI';
update mapdata.marinezones set fips=92846 where name = 'Holland to Grand Haven MI';
update mapdata.marinezones set fips=92847 where name = 'Grand Haven to Whitehall MI';
update mapdata.marinezones set fips=92848 where name = 'Whitehall to Pentwater MI';
update mapdata.marinezones set fips=92849 where name = 'Pentwater to Manistee MI';
update mapdata.marinezones set fips=92868 where name = 'Lake Michigan from Pentwater to Manistee MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92870 where name = 'Lake Michigan from Whitehall to Pentwater MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92872 where name = 'Lake Michigan from Grand Haven to Whitehall MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92874 where name = 'Lake Michigan from Holland to Grand Haven MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=92876 where name = 'Lake Michigan from South Haven to Holland MI 5NM off shore to Mid lake';
update mapdata.marinezones set fips=92878 where name = 'Lake Michigan from St Joseph to South Haven MI 5NM off shore to Mid Lake';
update mapdata.marinezones set fips=93345 where name = 'Straits of Mackinac within 5NM of Mackinac Bridge including Mackinac Island';
update mapdata.marinezones set fips=93346 where name = 'St Ignace to False Detour Channel';
update mapdata.marinezones set fips=93347 where name = '5NM East of Mackinac Bridge to Presque Isle Light MI including Bois Blanc Island';
update mapdata.marinezones set fips=93348 where name = 'Presque Isle Light to Sturgeon Pt MI Including Thunder Bay National Marine Sanctuary';
update mapdata.marinezones set fips=93349 where name = 'Sturgeon Point to Alabaster MI';
update mapdata.marinezones set fips=93361 where name = 'Lake Huron from 5NM east of Mackinac Bridge to Presque Isle Lt to the US/Canadian border beyond 5 NM from shore';
update mapdata.marinezones set fips=93362 where name = 'Lake Huron from Presque Isle Light to Sturgeon Point MI 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=93363 where name = 'Lake Huron from Sturgeon Point to Alabaster MI 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=93421 where name = 'Outer Saginaw Bay SW of Alabaster to Port Austin MI to Inner Saginaw Bay';
update mapdata.marinezones set fips=93422 where name = 'Inner Saginaw Bay SW of Point Au Gres to Bay Port MI';
update mapdata.marinezones set fips=93441 where name = 'Port Austin to Harbor Beach MI';
update mapdata.marinezones set fips=93442 where name = 'Harbor Beach to Port Sanilac MI';
update mapdata.marinezones set fips=93443 where name = 'Port Sanilac to Port Huron MI';
update mapdata.marinezones set fips=93462 where name = 'Lake Huron from Port Austin to Harbor Beach 5NM Off Shore to the US/Canadian border';
update mapdata.marinezones set fips=93463 where name = 'Lake Huron from Harbor Beach to Port Sanilac 5NM Off Shore to US/Canadian border';
update mapdata.marinezones set fips=93464 where name = 'Lake Huron from Port Sanilac to Port Huron 5NM Off Shore to US/Canadian border';
update mapdata.marinezones set fips=94422 where name = 'St. Clair River';
update mapdata.marinezones set fips=94423 where name = 'Detroit River';
update mapdata.marinezones set fips=94460 where name = 'Lake St. Clair Open Lake (U.S. Portion)';
update mapdata.marinezones set fips=96020 where name = 'Buffalo Harbor and the Upper Niagara River';
update mapdata.marinezones set fips=96040 where name = 'Ripley to Dunkirk NY';
update mapdata.marinezones set fips=96041 where name = 'Dunkirk to Buffalo NY';
update mapdata.marinezones set fips=96061 where name = 'Ripley to Buffalo NY extending from 5NM off shoreline to US/Canadian border';
update mapdata.marinezones set fips=96142 where name = 'Maumee Bay to Reno Beach OH';
update mapdata.marinezones set fips=96143 where name = 'Reno Beach to The Islands OH';
update mapdata.marinezones set fips=96144 where name = 'The Islands to Vermilion OH';
update mapdata.marinezones set fips=96145 where name = 'Vermilion to Avon Point OH';
update mapdata.marinezones set fips=96146 where name = 'Avon Point to Willowick OH';
update mapdata.marinezones set fips=96147 where name = 'Willowick to Geneva-on-the Lake OH';
update mapdata.marinezones set fips=96148 where name = 'Geneva-on-the-Lake to Conneaut OH';
update mapdata.marinezones set fips=96149 where name = 'Conneaut OH to Ripley NY';
update mapdata.marinezones set fips=96162 where name = 'Detroit River Lt. to Maumee Bay OH to Reno Beach OH beyond 5NM offshore to US/Canadian border';
update mapdata.marinezones set fips=96163 where name = 'Reno Beach to The Islands OH beyond 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=96164 where name = 'The Islands to Vermilion OH beyond 5NMm off shoreto US/Canadian border';
update mapdata.marinezones set fips=96165 where name = 'Vermilion to Avon Point OH beyond 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=96166 where name = 'Avon Point to Willowick OH beyond 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=96167 where name = 'Willowick to Geneva-on-the-Lake OH beyond 5NM off shoreline to US-Canadian border';
update mapdata.marinezones set fips=96168 where name = 'Geneva-on-the-Lake to Conneaut OH beyond 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=96169 where name = 'Conneaut OH to Ripley NY beyond 5NM off shore to US/Canadian border';
update mapdata.marinezones set fips=96444 where name = 'Michigan Waters of Lake Erie from Detroit River to North Cape MI';
update mapdata.marinezones set fips=97042 where name = 'Niagara River to Hamlin Beach NY';
update mapdata.marinezones set fips=97043 where name = 'Hamlin Beach to Sodus Bay NY';
update mapdata.marinezones set fips=97044 where name = 'Sodus Bay to Mexico Bay NY';
update mapdata.marinezones set fips=97045 where name = 'Mexico Bay NY to the St. Lawrence River';
update mapdata.marinezones set fips=97062 where name = 'Niagara River to Hamlin Beach NY beyond 5NM off shoreline to US/Canadian border';
update mapdata.marinezones set fips=97063 where name = 'Hamlin Beach to Sodus Bay NY beyond 5NM off shoreline to US/Canadian border';
update mapdata.marinezones set fips=97064 where name = 'Sodus Bay to Mexico Bay NY beyond 5NM off shoreline to US/Canadian border';
update mapdata.marinezones set fips=97065 where name = 'Mexico Bay NY to the St. Lawrence River beyond 5NM off shoreline to US/Canadian border';
update mapdata.marinezones set fips=98022 where name = 'St. Lawrence River above Ogdensburg NY';
update mapdata.marinezones set fips=98024 where name = 'St. Lawrence River from Ogdensburg to St. Regis NY';

File diff suppressed because it is too large Load diff

View file

@ -1,15 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bufrsgwh Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.bufrsgwh
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: NOAA/NWS/NCEP/NCO/SIB
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: javax.persistence;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.11.31",
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
org.apache.commons.logging;bundle-version="1.0.4"
Export-Package: gov.noaa.nws.ncep.common.dataplugin.bufrsgwh,
gov.noaa.nws.ncep.common.dataplugin.bufrsgwh.dao
Import-Package: gov.noaa.nws.ncep.edex.common.dao

View file

@ -1 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.bufrsgwh.BufrSgwhRecord

View file

@ -1,11 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.bufrsgwh">
<available file="../../edexOsgi/build.edex"
property="build.dir.location"
value="../../edexOsgi/build.edex"/>
<available file="../../../../../build.edex"
property="build.dir.location"
value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,4 +0,0 @@
/**
* Contains utility classes for BufrsSgwh plugin
*/
package gov.noaa.nws.ncep.common.dataplugin.bufrsgwh;

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,15 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bufrsgwhv Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: NOAA/NWS/NCEP/NCO/SIB
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: javax.persistence;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.12.1142",
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.0.0"
Export-Package: gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv,
gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv.dao
Import-Package: gov.noaa.nws.ncep.edex.common.dao

View file

@ -1 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv.BufrSgwhvRecord

View file

@ -1,10 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv">
<available file="../../edexOsgi/build.edex"
property="build.dir.location"
value="../../edexOsgi/build.edex"/>
<available file="../../../../../build.edex"
property="build.dir.location"
value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,74 +0,0 @@
/**
* Set of DAO methods for BUFRSGWHV data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ----------- ----------- --------------------------
* 11/17/10 208 F. J. Yen Initial Coding (based on BUFRSGWH)
* </pre>
*
* @author fjyen
* @version 1.0
**/
package gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv.dao;
import java.util.List;
import gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv.BufrSgwhvRecord;
import gov.noaa.nws.ncep.edex.common.dao.NcepDefaultPluginDao;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.database.DataAccessLayerException;
public class BufrsgwhvDao extends NcepDefaultPluginDao {
/**
* Creates a new ReccoDao
* @throws PluginException
*/
public BufrsgwhvDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves a BUFRSGWHV report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public BufrSgwhvRecord queryByDataURI(String dataURI) {
BufrSgwhvRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if((obs != null)&&(obs.size() > 0)) {
report = (BufrSgwhvRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the Bufrsgwhv table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.bufrsgwhv where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
}

View file

@ -1,4 +0,0 @@
/**
* Contains utility classes for BufrSgwhv plugin
*/
package gov.noaa.nws.ncep.common.dataplugin.bufrsgwhv;

View file

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.bufrssha</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.bufrssha.BufrSshaRecord

View file

@ -1,11 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.bufrssha">
<available file="../../edexOsgi/build.edex"
property="build.dir.location"
value="../../edexOsgi/build.edex"/>
<available file="../../../../../build.edex"
property="build.dir.location"
value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,75 +0,0 @@
/**
* Set of DAO methods for BUFRSSHA data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ----------- ----------- --------------------------
* 01/26/11 209 F. J. Yen Initial Coding
* </pre>
*
* @author fjyen
* @version 1.0
**/
package gov.noaa.nws.ncep.common.dataplugin.bufrssha.dao;
import java.util.List;
import gov.noaa.nws.ncep.common.dataplugin.bufrssha.BufrSshaRecord;
import gov.noaa.nws.ncep.edex.common.dao.NcepDefaultPluginDao;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.edex.database.DataAccessLayerException;
public class BufrsshaDao extends NcepDefaultPluginDao {
/**
* Creates a new BufrsshaDao
* @throws PluginException
*/
public BufrsshaDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves a BUFRSSHA report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public BufrSshaRecord queryByDataURI(String dataURI) {
BufrSshaRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if((obs != null)&&(obs.size() > 0)) {
report = (BufrSshaRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the Bufrssha table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.bufrssha where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
}

View file

@ -1 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.h5scd.H5ScdRecord

View file

@ -1,10 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.edex.plugin.h5scd">
<available file="../../edexOsgi/build.edex"
property="build.dir.location"
value="../../edexOsgi/build.edex"/>
<available file="../../../../../build.edex"
property="build.dir.location"
value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,7 +0,0 @@
/**
* SCD implementation of the plug-in pattern.
*
* Package includes classes to decode the SCD message and persist the data.
*
*/
package gov.noaa.nws.ncep.common.dataplugin.h5scd;

View file

@ -1,5 +0,0 @@
gov.noaa.nws.ncep.common.dataplugin.h5uair.H5UairRecord
gov.noaa.nws.ncep.common.dataplugin.h5uair.H5ObsLevels
gov.noaa.nws.ncep.common.dataplugin.h5uair.H5Tropopause
gov.noaa.nws.ncep.common.dataplugin.h5uair.H5MaxWind
gov.noaa.nws.ncep.common.dataplugin.h5uair.H5LiftedIndex

View file

@ -1,10 +0,0 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.edex.plugin.h5uair">
<available file="../../edexOsgi/build.edex"
property="build.dir.location"
value="../../edexOsgi/build.edex"/>
<available file="../../../../../build.edex"
property="build.dir.location"
value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,4 +0,0 @@
/**
* Contains table record for decoder plug-ins
*/
package gov.noaa.nws.ncep.common.dataplugin.h5uair;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.ncairep</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,4 +1,4 @@
#Tue Nov 09 17:59:07 EST 2010
#Thu Dec 10 11:10:30 EST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6

View file

@ -0,0 +1,39 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ncpirep Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncairep
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
com.raytheon.uf.common.status;bundle-version="1.12.1174",
net.sf.cglib;bundle-version="2.1.3",
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
javax.measure,
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.12.1174"
Import-Package: com.raytheon.edex.db.dao,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.time,
com.raytheon.uf.edex.database,
com.raytheon.uf.edex.database.dao,
com.raytheon.uf.edex.database.plugin,
com.raytheon.uf.edex.decodertools.aircraft,
com.raytheon.uf.edex.pointdata,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.common.tools,
javax.measure.unit,
javax.persistence,
org.springframework.orm.hibernate3
Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncairep,
gov.noaa.nws.ncep.common.dataplugin.ncairep.dao

View file

@ -0,0 +1 @@
gov.noaa.nws.ncep.common.dataplugin.ncairep.NcAirepRecord

View file

@ -0,0 +1,8 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.ncairep">
<!-- property name="component.name" value="plugin-mcidas" /-->
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -0,0 +1,263 @@
package gov.noaa.nws.ncep.common.dataplugin.ncairep;
/**
* 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.
**/
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import gov.noaa.nws.ncep.common.dataplugin.ncairep.dao.NcAirepDao;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.time.DataTime;
/**
* Provides a transform from NcAirepRecords to PointDataContainer and vice versa.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/27/2011 F. J. Yen Initial creation from MetarPointDataTransform
* 06/28/2011 F. J. Yen Updated for OB11.5
* 09/19/2011 286 Q.Zhou Modified populateRecord to add 8 new fields for TB, IC and SK.
* 10/18/2011 286 Q.Zhou Fixed datarui in db
* </pre>
*
* @author f j yen
* @version 1.0
*/
public class NcAirepPointDataTransform {
private static final String WIND_SPEED = "windSpeed";
private static final String WIND_DIR = "windDir";
// WIND_SPEED, WIND_DIR
// ------------------
private static final String TEMPERATURE = "temperature";
// TEMPERATURE
// ------------------
private static final String FLIGHT_HAZARD = "flightHazard";
private static final String FLIGHT_WEATHER = "flightWeather";
private static final String FLIGHT_CONDITIONS = "flightConditions";
// FLIGHT_HAZARD, FLIGHT_WEATHER, FLIGHT_CONDITIONS
// ------------------
private static final String WMO_HEADER = "wmoHeader";
private static final String STATION_ID = "stationId";
private static final String REPORT_TYPE = "reportType";
private static final String TIME_OBS = "timeObs";
private static final String OBS_ID = "obsId";
// WMO_HEADER, STATION_ID, REPORT_TYPE, TIME_OBS, OBS_ID
// ------------------
private static final String LONGITUDE = "longitude";
private static final String LATITUDE = "latitude";
private static final String FLIGHT_LEVEL = "flightLevel";
// LONGITUDE, LATITUDE, FLIGHT_LEVEL
// ------------------
private static final String CORRECTION_CODE = "correctionCode";
private static final String DATAURI = "dataURI";
private static final String TURB_INTEN = "turbInten";
private static final String TURB_TYPE = "turbType";
private static final String TURB_FREQ = "turbFreq";
private static final String ICE_INTEN = "iceInten";
private static final String ICE_TYPE = "iceType";
private static final String SKY_COVER = "skyCover";
private static final String SKY_BASE_HEIGHT = "skyBaseHeight";
private static final String SKY_TOP_HEIGHT = "skyTopHeight";
private static final String SUSPECT_TIME_FLAG = "suspectTimeFlag";
// CORRECTION_CODE, DATAURI,
// ------------------
/**
* It is important to keep this up to date or risk breaking backwards
* compatibility
*/
private static final String[] ALL_PARAMS = { DATAURI, TIME_OBS, OBS_ID, REPORT_TYPE,
STATION_ID, WMO_HEADER, FLIGHT_HAZARD, FLIGHT_WEATHER,
FLIGHT_CONDITIONS, LONGITUDE, LATITUDE, FLIGHT_LEVEL,
CORRECTION_CODE, TEMPERATURE, WIND_SPEED, WIND_DIR,
TURB_INTEN, TURB_TYPE, TURB_FREQ, ICE_INTEN, ICE_TYPE, SKY_COVER,
SKY_BASE_HEIGHT, SKY_TOP_HEIGHT, SUSPECT_TIME_FLAG};
public static final String ALL_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (String s : ALL_PARAMS) {
if (!first) {
sb.append(", ");
} else {
first = false;
}
sb.append(s);
}
ALL_PARAMS_LIST = sb.toString();
}
private NcAirepDao dao;
private PointDataDescription description;
public NcAirepPointDataTransform() {
try {
this.dao = new NcAirepDao("ncairep");
this.description = dao.getPointDataDescription(null);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public PluginDataObject[] toPointData(PluginDataObject[] pdo) {
long t0 =System.currentTimeMillis();
System.out.println("===============>toPointData"); // in NcAirepPointDataTransform t0=" + t0);
/* 999 */
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof NcAirepRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
if (pdc == null) {
pdc = PointDataContainer.build(this.description);
pointMap.put(f, pdc);
}
NcAirepRecord nar = (NcAirepRecord) p;
PointDataView pdv = buildView(pdc, nar);
nar.setPointDataView(pdv);
}
}
long t1 =System.currentTimeMillis();
return pdo;
}
private PointDataView buildView(PointDataContainer container,
NcAirepRecord record) {
PointDataView pdv = container.append();
// pdv.setString(STATION_ID, record.getStationId());
if (record.getCorIndicator() != null) {
pdv.setString(CORRECTION_CODE, record.getCorIndicator());
}else{
pdv.setString(CORRECTION_CODE," ");
}
// pdv.setFloat(LATITUDE, (float) record.getLatitude());
// pdv.setFloat(LONGITUDE, (float) record.getLongitude());
pdv.setFloat(FLIGHT_LEVEL, record.getFlightLevel());
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
// pdv.setString(DATAURI, record.getDataURI());
// pdv.setString(REPORT_TYPE, record.getReportType());
pdv.setFloat(TEMPERATURE,(float) record.getTemp());
pdv.setFloat(WIND_DIR, (float) record.getWindDirection());
pdv.setFloat(WIND_SPEED, (float) record.getWindSpeed());
pdv.setString(TURB_INTEN, record.getTurbInten());
pdv.setString(TURB_TYPE, record.getTurbType());
pdv.setString(TURB_FREQ, record.getTurbFreq());
pdv.setString(ICE_INTEN, record.getIceInten());
pdv.setString(ICE_TYPE, record.getIceType());
pdv.setString(SKY_COVER, record.getSkyCover());
pdv.setInt(SKY_BASE_HEIGHT, record.getSkyBaseHeight());
pdv.setInt(SKY_TOP_HEIGHT, record.getSkyTopHeight());
pdv.setString(SUSPECT_TIME_FLAG, record.getSuspectTimeFlag());
return pdv;
}
public static NcAirepRecord toNcAirepRecord(PointDataView pdv) {
NcAirepRecord nar = new NcAirepRecord();
nar.setObsId(pdv.getInt(OBS_ID));
nar.setCorIndicator(pdv.getString(CORRECTION_CODE));
nar.setDataTime(new DataTime(new Date(pdv.getNumber(TIME_OBS)
.longValue())));
AircraftObsLocation loc = new AircraftObsLocation(
pdv.getString(STATION_ID));
Double lat = pdv.getNumber(LATITUDE).doubleValue();
Double lon = pdv.getNumber(LONGITUDE).doubleValue();
loc.setLocation(lat, lon);
loc.setFlightLevel(pdv.getNumber(FLIGHT_LEVEL).intValue());
nar.setLocation(loc);
nar.setDataURI(pdv.getString(DATAURI));
nar.setReportType(pdv.getString(REPORT_TYPE));
nar.setTemp(pdv.getNumber(TEMPERATURE).floatValue());
nar.setPluginName("ncairep");
nar.setFlightHazard(pdv.getInt(FLIGHT_HAZARD));
nar.setFlightWeather(pdv.getInt(FLIGHT_WEATHER));
nar.setFlightConditions(pdv.getInt(FLIGHT_CONDITIONS));
// AIREP Wind data
nar.setWindDirection(pdv.getNumber(WIND_DIR).floatValue());
nar.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue());
//nar.setSuspectTimeFlag(pdv.getString(SUSPECT_TIME_FLAG));
return nar;
}
public static NcAirepRecord[] toNcAirepRecords(PointDataContainer container) {
List<NcAirepRecord> records = new ArrayList<NcAirepRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
records.add(toNcAirepRecord(pdv));
}
return records.toArray(new NcAirepRecord[records.size()]);
}
}

View file

@ -0,0 +1,858 @@
package gov.noaa.nws.ncep.common.dataplugin.ncairep;
/**
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import javax.measure.converter.UnitConverter;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
* NcAirepRecord is the Data Access component for pirep observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20110421 F. J. Yen Initial creation from Raytheon's pirep.
* Change temp, windSpeed from Double to Float.
* Change windDirection from Integer to Float
* 08/30/2011 286 qzhou Use IDecoderConstantsN.INTEGER_MISSING instead -9999 in visibility.
* 08/31/2011 286 qzhou Moved this from ~edex.plugin.airep
* 9/20/2011 286 qzhou Change reportType to String
* </pre>
*
* @author jkorman
* @version 1.0
*/
@Entity
@Table(name = "ncairep", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcAirepRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
// public static final String PLUGIN_NAME = "ncairep";
//
// public static final String STATION_ID = "stationId";
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.CELSIUS;
public static final Unit<Velocity> WIND_SPEED_UNIT = NonSI.KNOT;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Length> ALTITUDE_UNIT = NonSI.FOOT;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static UnitConverter ftToHft = NonSI.FOOT.getConverterTo(SI
.HECTO(NonSI.FOOT));
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
// private static final HashMap<Integer, String> WX_MAP = new
// HashMap<Integer, String>();
static {
PARM_MAP.put("T", SFC_TEMP);
PARM_MAP.put("WS", SFC_WNDSPD);
PARM_MAP.put("WD", SFC_WNDDIR);
PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("FLT_LVL", UA_FLTLVL);
// WX_MAP.put(0, "CLR");
// WX_MAP.put(1, "SCT");
// WX_MAP.put(2, "BKN");
// WX_MAP.put(3, "CONT");
// WX_MAP.put(4, "LIGHTNING");
// WX_MAP.put(5, "DZRA");
// WX_MAP.put(6, "CONT RA");
// WX_MAP.put(7, "CONT SN");
// WX_MAP.put(8, "SH");
// WX_MAP.put(9, "TSRA");
}
@Transient
@DynamicSerializeElement
@XmlAttribute
private Integer obsId;
// Time of the observation.
@Transient
@DynamicSerializeElement
@XmlAttribute
private Calendar timeObs;
// Time of the observation to the nearest hour.
@Column
@DynamicSerializeElement
@XmlAttribute
private Calendar refHour;
//
@DataURI(position = 1)
@Column(length = 8)
@DynamicSerializeElement
@XmlAttribute
private String reportType;
// Text of the WMO header
@Transient
@DynamicSerializeElement
@XmlElement
private String wmoHeader;
// Correction indicator from wmo header
@DataURI(position = 2)
@Column(length = 8)
@DynamicSerializeElement
@XmlElement
private String corIndicator;
// Observation air temperature in degrees Celsius.
// Decimal(5,2)
@Transient
@DynamicSerializeElement
@XmlElement
private Float temp;
// Observation wind direction in angular degrees. Integer
@Transient
@DynamicSerializeElement
@XmlElement
private Float windDirection;
// Observation wind speed in knots.
// Decimal(5,2)
@Transient
//@Column
@DynamicSerializeElement
@XmlElement
private Float windSpeed;
@Transient
@DynamicSerializeElement
@XmlElement
private Integer flightHazard;
@Transient
@DynamicSerializeElement
@XmlElement
private Integer flightWeather;
@Transient
@DynamicSerializeElement
@XmlElement
private Integer flightConditions;
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private Float latitude;
//
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private Float longitude;
//
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private String stationId;
// @Transient
// @DynamicSerializeElement
// @XmlElement
// private String dataURI;
@Transient
@DynamicSerializeElement
//@XmlElement
@XmlAttribute
private String turbInten;
@Transient
@DynamicSerializeElement
@XmlElement
private String iceInten;
@Transient
@DynamicSerializeElement
@XmlElement
private String skyCover;
@Transient
@DynamicSerializeElement
@XmlElement
private String turbType;
@Transient
@DynamicSerializeElement
@XmlElement
private String iceType;
@Transient
@DynamicSerializeElement
@XmlElement
private String turbFreq;
@Transient
@DynamicSerializeElement
@XmlElement
private int skyBaseHeight;
@Transient
@DynamicSerializeElement
@XmlElement
private int skyTopHeight;
@Transient
@DynamicSerializeElement
@XmlElement
private String suspectTimeFlag;
@Embedded
@DataURI(position = 3, embedded = true)
@XmlElement
@DynamicSerializeElement
private AircraftObsLocation location;
@Embedded
private PointDataView pdv;
/**
*
*/
public NcAirepRecord() {
}
/**
* Constructor for DataURI construction through base class. This is used by
* the notification service.
*
* @param uri
* A data uri applicable to this class.
* @param tableDef
* The table definitions for this class.
*/
public NcAirepRecord(String uri) {
super(uri);
}
public Integer getObsId() {
return obsId;
}
public void setObsId(Integer obsId) {
this.obsId = obsId;
}
/**
* @return the wmoHeader
*/
public String getWmoHeader() {
return wmoHeader;
}
/**
* @param wmoHeader
* the wmoHeader to set
*/
public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader;
}
/**
* Get the report correction indicator.
*
* @return The corIndicator
*/
public String getCorIndicator() {
return corIndicator;
}
/**
* Set the report correction indicator.
*
* @param corIndicator
* The corIndicator.
*/
public void setCorIndicator(String corIndicator) {
this.corIndicator = corIndicator;
}
/**
* Get the report data for this observation.
*
* @return The Report data.
*/
public String getReportData() {
String s = null;
if (messageData != null && messageData instanceof String) {
s = (String) messageData;
} else {
s = buildMessageData();
}
return s;
}
/**
* Set the report data for this observation.
*
* @param reportData
* The Report data.
*/
public void setReportData(String reportData) {
messageData = reportData;
}
/**
* Get this observation's geometry.
*
* @return The geometry for this observation.
*/
public Geometry getGeometry() {
return location.getGeometry();
}
/**
* Get the geometry latitude.
*
* @return The geometry latitude.
*/
public double getLatitude() {
return location.getLatitude();
}
/**
* Get the geometry longitude.
*
* @return The geometry longitude.
*/
public double getLongitude() {
return location.getLongitude();
}
/**
* Boolean for whether location is defined in the spatial tables.
*
* @return true or false (Is location defined in the spatial tables?)
*/
public Boolean getLocationDefined() {
return location.getLocationDefined();
}
/**
* Get the station identifier for this observation.
*
* @return the stationId
*/
public String getStationId() {
return location.getStationId();
}
/**
* Get the elevation, in meters, of the observing platform or location.
*
* @return The observation elevation, in meters.
*/
public Integer getFlightLevel() {
return location.getFlightLevel();
}
/**
* @return the reportType
*/
public String getReportType() {
return reportType;
}
/**
* @param reportType
* the reportType to set
*/
public void setReportType(String reportType) {
this.reportType = reportType;
}
/**
* @return the timeObs
*/
public Calendar getTimeObs() {
if (this.dataTime == null)
return null;
return this.dataTime.getRefTimeAsCalendar();
}
/**
* @param timeObs
* the timeObs to set
*/
public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs;
}
/**
* @return the refHour
*/
public Calendar getRefHour() {
return refHour;
}
/**
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;
}
/**
* @return the temp
*/
public float getTemp() {
return temp;
}
/**
* @param temp
* the temp to set
*/
public void setTemp(float temp) {
this.temp = temp;
}
/**
* @return the windDirection
*/
public float getWindDirection() {
return windDirection;
}
/**
* @param windDirection
* the windDirection to set
*/
public void setWindDirection(float windDirection) {
this.windDirection = windDirection;
}
/**
* @return the windspeed
*/
public float getWindSpeed() {
return windSpeed;
}
/**
* @param windspeed
* the windspeed to set
*/
public void setWindSpeed(float windSpeed) {
this.windSpeed = windSpeed;
}
/**
* @return the flightHazard
*/
public Integer getFlightHazard() {
return flightHazard;
}
/**
* @param flightHazard
* the wx_past_1 to set
*/
public void setFlightHazard(Integer flightHazard) {
this.flightHazard = flightHazard;
}
/**
* @return the flightWeather
*/
public Integer getFlightWeather() {
return flightWeather;
}
/**
* @param flightWeather
* the getFlightWeather to set
*/
public void setFlightWeather(Integer flightWeather) {
this.flightWeather = flightWeather;
}
/**
* @return the flightConditions
*/
public Integer getFlightConditions() {
return flightConditions;
}
/**
* @param flightConditions
* the flightConditions to set
*/
public void setFlightConditions(Integer flightConditions) {
this.flightConditions = flightConditions;
}
/**
* @return the wmoHeader
*/
public String getTurbInten() {
return turbInten;
}
public void setTurbInten(String turbInten) {
this.turbInten = turbInten;
}
public String getIceInten() {
return iceInten;
}
public void setIceInten(String iceInten) {
this.iceInten = iceInten;
}
public String getSkyCover() {
return skyCover;
}
public void setSkyCover(String skyCover) {
this.skyCover = skyCover;
}
public String getTurbType() {
return turbType;
}
public void setTurbType(String turbType) {
this.turbType = turbType;
}
public String getIceType() {
return iceType;
}
public void setIceType(String iceType) {
this.iceType = iceType;
}
public String getTurbFreq() {
return turbFreq;
}
public void setTurbFreq(String turbFreq) {
this.turbFreq = turbFreq;
}
public int getSkyBaseHeight() {
return skyBaseHeight;
}
public void setSkyBaseHeight(int skyBaseHeight) {
this.skyBaseHeight = skyBaseHeight;
}
public int getSkyTopHeight() {
return skyTopHeight;
}
public void setSkyTopHeight(int skyTopHeight) {
this.skyTopHeight = skyTopHeight;
}
public String getSuspectTimeFlag() {
return suspectTimeFlag;
}
public void setSuspectTimeFlag(String suspectTimeFlag) {
this.suspectTimeFlag = suspectTimeFlag;
}
@Override
public void setDataURI(String dataURI) {
identifier = dataURI;
}
/**
* Get the IDecoderGettable reference for this record.
*
* @return The IDecoderGettable reference for this record.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return this;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public String getString(String paramName) {
if ("STA".matches(paramName)) {
return this.getStationId();
}
return null;
}
/**
* Get the value and units of a named parameter within this observation.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return An Amount with value and units. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Amount getValue(String paramName) {
Amount a = null;
String pName = PARM_MAP.get(paramName);
if (SFC_TEMP.equals(pName) && (temp != null)) {
a = new Amount(temp, TEMPERATURE_UNIT);
} else if (SFC_WNDSPD.equals(pName) && (windSpeed != null)) {
a = new Amount(windSpeed, WIND_SPEED_UNIT);
} else if (SFC_WNDDIR.equals(pName) && (windDirection != null)) {
a = new Amount(windDirection, WIND_DIR_UNIT);
} else if (STA_LAT.equals(pName)) {
a = new Amount(this.getLatitude(), LOCATION_UNIT);
} else if (STA_LON.equals(pName)) {
a = new Amount(this.getLongitude(), LOCATION_UNIT);
} else if (UA_FLTLVL.equals(pName) && getFlightLevel() != null) {
a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT);
}
return a;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
@Override
public String[] getStrings(String paramName) {
if ("FLT_HZD".matches(paramName) && flightHazard != null) {
String[] flightHazards = { flightHazard.toString() };
return flightHazards;
}
return null;
}
@Override
public AircraftObsLocation getSpatialObject() {
return location;
}
public AircraftObsLocation getLocation() {
return location;
}
public void setLocation(AircraftObsLocation location) {
this.location = location;
}
@Override
public String getMessageData() {
return getReportData();
}
private String buildMessageData() {
String s = "";
String lat = String.valueOf(location.getLatitude());
String lon = String.valueOf(location.getLongitude());
String latDir = location.getLatitude() > 0 ? "N" : "S";
String lonDir = location.getLongitude() > 0 ? "E" : "W";
String hour = "";
String minute = "";
if (timeObs != null) {
hour = String.valueOf(timeObs.get(Calendar.HOUR_OF_DAY));
minute = String.valueOf(timeObs.get(Calendar.MINUTE));
}
String flightLevel = String.valueOf((int) ftToHft.convert(location
.getFlightLevel()));
String wind = windDirection != null?
String.valueOf(windDirection.intValue()) + "/"
+ String.valueOf(windSpeed.intValue()) + "KT" : "";
// String wx = flightWeather != null? WX_MAP.get(flightWeather) : "";
lat = formatLatLon(lat);
lon = formatLatLon(lon);
String temperature = "";
if (temp != null) {
if (temp > 0) {
temperature = "P" + temp.intValue();
} else {
temperature = "M"
+ String.valueOf(temp.intValue()).substring(1);
}
}
if (hour.length() < 2) {
hour = "0" + hour;
}
if (minute.length() < 2) {
minute = "0" + minute;
}
s = "ARP " + location.getStationId() + " " + lat + latDir + " " + lon
+ lonDir + " " + hour + minute + " F" + flightLevel + " "
+ temperature + " " + wind + "TB";
return s;
}
private String formatLatLon(String str) {
str = str.startsWith("-") ? str.substring(1) : str;
int decimalIndex = str.indexOf(".");
if (decimalIndex != -1) {
String temp = str.substring(decimalIndex + 1);
if (temp.length() > 3) {
temp = temp.substring(0, 3);
} else if (temp.length() != 3) {
while (temp.length() != 3) {
temp += "0";
}
}
str = str.substring(0, decimalIndex) + temp;
}
return str;
}
/**
* Returns the hashCode for this object. This implementation returns the
* hashCode of the generated dataURI.
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((getDataURI() == null) ? 0 : getDataURI().hashCode());
return result;
}
/**
* Checks if this record is equal to another by checking the generated
* dataURI.
*
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NcAirepRecord other = (NcAirepRecord) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
return false;
return true;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public void setHdfFileId(Integer hdfFileId) {
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView()
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon
* .uf.common.pointdata.PointDataView)
*/
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
}

View file

@ -0,0 +1,135 @@
package gov.noaa.nws.ncep.common.dataplugin.ncairep.dao;
/**
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO to order to output point data in HDF5.
**/
//uf.common.status.IUFStatusHandler cannot be resolved. It is indirectly
//referenced from required .class files
import gov.noaa.nws.ncep.common.dataplugin.ncairep.NcAirepRecord;
import java.util.List;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
/**
* Set of DAO methods for Surface Observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/28/2011 F. J. Yen Initial creation from airep
* 08/31/2011 286 qzhou Moved this from ~edex.plugin.pirep
* </pre>
*
* @author qzhou
* @version 1.0
*/
public class NcAirepDao extends PointDataPluginDao<NcAirepRecord> {
private PointDataDescription pdd;
/**
* Creates a new NcAirepDao
*
* @throws PluginException
*/
public NcAirepDao(String pluginName) throws PluginException {
super(pluginName);
}
@Override
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
return null;
}
/**
* Retrieves an NcAirep report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public NcAirepRecord queryByDataURI(String dataURI) {
NcAirepRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (NcAirepRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the sfcobs table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.ncairep where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
@Override
public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime" };
}
@Override
public NcAirepRecord newObject() {
return new NcAirepRecord();
}
@Override
public String getPointDataFileName(NcAirepRecord p) {
return "ncairep.h5";
}
/*
@Override
public String[] getParameters(File file) throws StorageException,
FileNotFoundException {
try {
// This should be faster than hitting the datastore.
return getPointDataDescription().getParameterNames();
} catch (Exception e) {
// let super handle it
return super.getParameters(file);
}
}
*/
public PointDataDescription getPointDataDescription() throws JAXBException {
if (pdd == null) {
pdd = PointDataDescription.fromStream(this.getClass()
.getResourceAsStream("/res/pointdata/ncairep.xml"));
}
return pdd;
}
}

View file

@ -0,0 +1,234 @@
package gov.noaa.nws.ncep.common.dataplugin.ncgrib.ncdatatree;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
//import com.raytheon.uf.common.derivparam.tree.DataTree;
//import com.raytheon.uf.common.derivparam.tree.LevelNode;
//import com.raytheon.uf.common.derivparam.tree.ParameterNode;
//import com.raytheon.uf.common.derivparam.tree.SourceNode;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class NcDataTree implements ISerializableObject,
Cloneable {
@DynamicSerializeElement
private Map<String, NcSourceNode> ncSourceNodes = new HashMap<String, NcSourceNode>();
public Map<String, NcSourceNode> getNcSourceNodes() {
return ncSourceNodes;
}
public void setNcSourceNodes(Map<String, NcSourceNode> ncSourceNodes) {
this.ncSourceNodes = ncSourceNodes;
}
public NcDataTree clone() {
NcDataTree tree = new NcDataTree();
Map<String, NcSourceNode> clonedNodes = tree.getNcSourceNodes();
for (NcSourceNode node : ncSourceNodes.values()) {
clonedNodes.put(node.getValue(), node.clone());
}
return tree;
}
// public int mergeGridTree(NcDataTree tree) {
// for (NcSourceNode sourceNode : tree.getNcSourceNodes().values()) {
// NcSourceNode thisNcSourceNode = ncSourceNodes.get(sourceNode.getValue());
//
// if (thisNcSourceNode == null) {
// ncSourceNodes.put(sourceNode.getValue(), (NcSourceNode) ncSourceNodes);
// } else {
// thisNcSourceNode.mergeNode(ncSourceNodes);
// }
// }
//
// return tree.getNcSourceNodes().size();
// }
// public void addBranch(String source,
// String parameterName,
// String levelName, String levelValue, Map<String, RequestConstraint> rcMap) {
// addBranch(source, null, parameterName,
// levelName, levelValue, null, rcMap);
// }
/**
* A convenience method that adds a new branch to the grid tree. This is for
* the GridCatalog script task and expects the list to contain the following
* metadata parameters in the same order:
* <p>
* modelName, parameterAbbreviation, parameterName, parameterUnit, level.id
* </p>
*
* @param gridInfo
* A List object that contains the above list
*/
public void addBranch(String source, String eventName,
String parameterName, String levelName,
String level1Value, String level2Value, Map<String, RequestConstraint> rcMap) {
NcSourceNode sourceNode = ncSourceNodes.get(source);
if (sourceNode == null) {
sourceNode = new NcSourceNode();
sourceNode.setValue(source);
ncSourceNodes.put(source, sourceNode);
}
NcEventNode eventNode = sourceNode.getChildNode(eventName);
if (eventNode == null) {
eventNode = new NcEventNode();
eventNode.setValue(eventName);
sourceNode.addChildNode(eventNode);
}
NcParameterNode paramNode = eventNode
.getChildNode(parameterName);
if (paramNode == null) {
paramNode = new NcParameterNode();
paramNode.setValue(parameterName);
eventNode.addChildNode(paramNode);
}
String levelId = null;
if ( level2Value.equals("-9999") )
levelId = levelName + ":" + level1Value;
else
levelId = levelName + ":" + level1Value + ":" + level2Value;
NcLevelNode levelNode = paramNode.getChildNode(levelId);
if (levelNode == null) {
levelNode = new NcLevelNode();
levelNode.setValue(levelId);
//levelNode.setLevelName(levelName);
levelNode.setRcmap(rcMap);
paramNode.addChildNode(levelNode);
}
}
/**
* Returns a list of available model names.
*
* @return The center id
*/
public Set<String> getNcSources() {
return ncSourceNodes.keySet();
}
/**
* Returns the specified model name node.
*
* @param modelNameId
* @return The center node
*/
public NcSourceNode getNcSourceNode(String modelNameId) {
return ncSourceNodes.get(modelNameId);
}
public Set<String> getNcEvents(String modelName) {
NcSourceNode node = getNcSourceNode(modelName);
return node != null ? node.getChildNodeIds() : new HashSet<String>();
}
public NcEventNode getNcEventNode(String modelName, String event) {
NcEventNode rval = null;
NcSourceNode node = getNcSourceNode(modelName);
if (node != null) {
rval = node.getChildNode(event);
}
return rval;
}
/**
* Returns a list of available parameters for the specified criteria. If not
* found, an empty string array is returned.
*
* @param modelName
* The target model name
* @return A string array of available parameter nodes
*/
public Set<String> getNcParameters(String modelName, String eventName) {
NcEventNode node = getNcEventNode(modelName, eventName);
return node != null ? node.getChildNodeIds() : new HashSet<String>();
}
/**
* Returns the specified parameter node.
*
* @param modelName
* The target model name
* @param param
* The target parameter
* @return The parameter node
*/
public NcParameterNode getNcParameterNode(String modelName, String eventName, String parameterName) {
NcParameterNode rval = null;
NcEventNode node = getNcEventNode(modelName, eventName);
if (node != null) {
rval = node.getChildNode(parameterName);
}
return rval;
}
/**
* Returns a list of available levels for the specified criteria. If not
* found, an empty string array is returned.
*
* @param modelName
* The target model name
* @param param
* The target parameter
* @return A string array of available level nodes
*/
public Set<String> getNcLevels(String modelName, String eventName, String paramName) {
NcParameterNode parameter = getNcParameterNode(modelName, eventName, paramName);
return parameter != null ? parameter.getChildNodeIds()
: new HashSet<String>();
}
/**
* Returns the specified level node.
*
* @param modelName
* The target model name
* @param param
* The target parameter
* @param level
* The target level
* @return The level node or null if not found
*/
public NcLevelNode getNcLevelNode(String modelName, String eventName, String paramName, String level) {
NcLevelNode rval = null;
NcParameterNode parameter = getNcParameterNode(modelName, eventName, paramName);
if (parameter != null) {
rval = parameter.getChildNode(level);
}
return rval;
}
@Override
public String toString() {
StringBuilder tmp = new StringBuilder();
for (NcSourceNode node : ncSourceNodes.values()) {
tmp.append(node.toString());
}
return tmp.toString();
}
}

View file

@ -0,0 +1,37 @@
package gov.noaa.nws.ncep.common.dataplugin.ncgrib.ncdatatree;
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class NcEventNode extends AbstractNode<NcParameterNode> {
@DynamicSerializeElement
private String eventName;
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
@Override
public NcEventNode clone() {
NcEventNode node = new NcEventNode();
node.setValue(this.getValue());
node.setEventName(eventName);
for (NcParameterNode child : this.getChildNodes().values()) {
node.addChildNode((NcParameterNode) child.clone());
}
return node;
}
}

View file

@ -0,0 +1,61 @@
package gov.noaa.nws.ncep.common.dataplugin.ncgrib.ncdatatree;
import java.util.Map;
import com.raytheon.uf.common.dataquery.requests.RequestConstraint;
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class NcLevelNode extends AbstractNode<NcLevelNode> {
@DynamicSerializeElement
private String levelName;
@DynamicSerializeElement
private Map<String, RequestConstraint> rcmap;
public Map<String, RequestConstraint> getRcmap() {
return rcmap;
}
public void setRcmap(Map<String, RequestConstraint> rcmap) {
this.rcmap = rcmap;
}
public String getLevelName() {
return levelName;
}
public void setLevelName(String levelName) {
this.levelName = levelName;
}
// public NcLevelNode(NcLevelNode that) {
// this.value = that.value;
// this.levelName = that.levelName;
//
// for (NcLevelNode child : that.getChildNodes().values()) {
// addChildNode((NcLevelNode) child.clone());
// }
// }
public NcLevelNode() {
}
@Override
public NcLevelNode clone() {
NcLevelNode node = new NcLevelNode();
node.setValue(this.getValue());
node.setLevelName(levelName);
node.setRcmap(rcmap);
for (NcLevelNode child : this.getChildNodes().values()) {
node.addChildNode((NcLevelNode) child.clone());
}
return node;
}
}

View file

@ -0,0 +1,35 @@
package gov.noaa.nws.ncep.common.dataplugin.ncgrib.ncdatatree;
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
@DynamicSerialize
public class NcParameterNode extends AbstractNode<NcLevelNode> {
@DynamicSerializeElement
private String parameterName;
public String getParameterName() {
return parameterName;
}
public void setParameterName(String parameterName) {
this.parameterName = parameterName;
}
@Override
public NcParameterNode clone() {
NcParameterNode node = new NcParameterNode();
node.setValue(this.getValue());
node.setParameterName(parameterName);
for (NcLevelNode child : this.getChildNodes().values()) {
node.addChildNode((NcLevelNode) child.clone());
}
return node;
}
}

View file

@ -0,0 +1,20 @@
package gov.noaa.nws.ncep.common.dataplugin.ncgrib.ncdatatree;
import com.raytheon.uf.common.derivparam.tree.AbstractNode;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
@DynamicSerialize
public class NcSourceNode extends AbstractNode<NcEventNode> {
@Override
public NcSourceNode clone() {
NcSourceNode node = new NcSourceNode();
node.setValue(this.getValue());
for (NcEventNode child : this.getChildNodes().values()) {
node.addChildNode((NcEventNode) child.clone());
}
return node;
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.h5uair</name>
<name>gov.noaa.nws.ncep.common.dataplugin.ncpafm</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Pafm Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.pafm
Bundle-Name: NcPafm Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncpafm
Bundle-Version: 1.0.0.qualifier
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Bundle-Vendor: NOAA/NWS/NCEP/NCO/SIB
@ -12,5 +12,9 @@ Require-Bundle: javax.persistence;bundle-version="1.0.0",
org.apache.log4j;bundle-version="1.0.0",
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
gov.noaa.nws.ncep.edex.common;bundle-version="1.0.0"
Export-Package: gov.noaa.nws.ncep.common.dataplugin.pafm,
gov.noaa.nws.ncep.common.dataplugin.pafm.dao
Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncpafm,
gov.noaa.nws.ncep.common.dataplugin.ncpafm.dao
Import-Package: com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.status,
com.raytheon.uf.edex.pointdata

View file

@ -0,0 +1 @@
gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmRecord

View file

@ -0,0 +1,7 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.ncpafm">
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -0,0 +1,310 @@
/*
*
* NcPafmBulletin
*
* This class performs the mapping to the database tables for the Point/Area
* Forecast Matrices (PAFM) Decoder Plug-In
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ----------- -------------- -----------------------------------
* 08/05/2009 126 F. J. Yen Initial creation
* 01/06/2010 126 F. J. Yen Migrated and refactored from to11dr3 to to11dr11
* *
* This code has been develped by the SIB for use in the AWIPS2 system.
* </pre>
*
* @author F. J. Yen, SIB
* @version 1
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.time.DataTime;
/**
* NcPafmBulletin is the highest level class for PAFM
* (Point/Area Forecast Matrices) data. Each instance holds
* all of the data parsed from one bulletin. Children
* (NcPafmUgc) hold data from individual segments.
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 23Jun2009 126 F. J. Yen Initial Coding.
* 22Sep2009 126 F. J. Yen Increase size of column bullMessage
* 28Sep2009 126 F. J. Yen Delete column bullMessage
* 30Sep2011 126 B. Hebbard PafmRecord (old PDO) becomes NcPafmBulletin
* -- still representing decoded content of a
* whole bulletin, but no longer the PDO.
* Removed persistence annotations.
* 12Oct2011 126 G. Hull use a surfaceObsLocation object for the lat/lon/stationId.
* </pre>
*
* @author F. J. Yen, SIB
* @version 1.0
*/
public class NcPafmBulletin {
private static final long serialVersionUID = 1L;
/** Report type */
private String reportType;
// WMO header
private String wmoHeader;
// The issue office where the report from
private String issueOffice;
private Calendar issueTime;
private Calendar initialTime;
private String designatorBBB;
// The mndTime
private String mndTime;
/** Matrix type */
private String matrixType;
/** PAFM UGC Child Table */
private Set<NcPafmUgc> pafmUGC = new HashSet<NcPafmUgc>();
/**
* Default Constructor
*/
public NcPafmBulletin() {
this.issueOffice=null;
this.reportType="PAFM";
this.matrixType=" ";
this.issueTime=null;
this.wmoHeader=null;
this.designatorBBB=" ";
this.mndTime=null;
}
/**
* Constructs a pafm record from a dataURI
*
* @param uri
* The dataURI
*/
/**
* Constructs an array of NcPafmRecord PDOs from this one bulletin
* record. (Each bulletin record contain data from a whole
* bulletin, while each NcPafmRecord is more fine-grained
* -- representing the values for a single forecast hour of a
* single location [NcPafmFips] of a single segment [NcPafmUgc]
* of the entire bulletin [NcPafmBulletin]). We do this "reshuffle"
* because the NcPafmBulletin/NcPafmUgc/NcPafmFips hierarchy
* efficiently represents the original structure as parsed from
* the text, but we want the persistent PDO (NcPafmRecord) to be
* optimized for efficient access.
*/
public NcPafmRecord[] split() {
List<NcPafmRecord> records = new ArrayList<NcPafmRecord>();
for (NcPafmUgc ugc : getPafmUGC()) {
for (NcPafmFips fips : ugc.getPafmFIPS()) {
for (NcPafmParameters params : ugc.getPafmParms()) {
// Create a new PDO
NcPafmRecord npr = new NcPafmRecord();
// Copy some fields from the bulletin level...
npr.setReportType(getReportType());
npr.setWmoHeader(getWmoHeader());
npr.setIssueOffice(getIssueOffice());
npr.setIssueTime(getIssueTime());
//npr.setDataTime(getDataTime()); //NO!! Must be DataTime of forecast hour
npr.setDesignatorBBB(getDesignatorBBB());
npr.setMndTime(getMndTime());
npr.setMatrixType(getMatrixType());
// ...some fields from the UGC (group of locations) level...
npr.setUgc(ugc.getUgc()); //TODO: Needed?
npr.setProdPurgeTime(ugc.getProdPurgeTime());
//TODO: Needed? npr.setSegment(ugc.getSegment());
// ...some from the FIPS (individual location) level...
// create a surfaceObsLocation object and set the lat/lon/stationId and elev.
// Note that we will use the fips here for the station id instead of the
// issuing station id.
//
SurfaceObsLocation loc = new SurfaceObsLocation( fips.getFips() );
// npr.setFips(fips.getFips());
// npr.setElev(fips.getElev());
// npr.setLat(fips.getLat());
// npr.setLon(fips.getLon());
loc.setLatitude( fips.getLat().doubleValue() );
loc.setLongitude( fips.getLon().doubleValue() );
loc.setElevation( fips.getElev().intValue() );
npr.setLocation( loc );
// ...and finally the set of parameters for a
// single forecast hour, at that location
npr.setPafmParms(params);
// A (forecast-component) DataTime needs to be
// constructed from the inferred initial time for
// this bulletin and the absolute forecast time
npr.setDataTime( constructDataTime( params.getForecastTimeUtc() ) );
// Add to records list
records.add(npr);
}
}
}
return records.toArray(new NcPafmRecord[0]);
}
private DataTime constructDataTime(Calendar forecastTimeUtc) {
// Given an absolute forecast valid time, construct a
// (initial-plus-forecast-delta style) DataTime
// based on the initialTime deduced for this bulletin.
int fcstTime = 0; // seconds from initialTime to forecastTimeUtc
fcstTime = (int) (forecastTimeUtc.getTimeInMillis() - initialTime.getTimeInMillis());
fcstTime /= 1000; //TODO: Round in case off a few millis, somehow? Sanity?
return new DataTime (initialTime, fcstTime);
}
private Calendar inferInitialTime(Calendar issueTime) {
// Given the issue time on the bulletin, infer a reasonable
// initial time on which to base forecast-component DataTime's.
// Algorithm: First UTC multiple of 3 hours greater than or
// exactly equal to the issue time.
// TODO: Check against PFM/AFM product spec if
// necessary to ensure this is reasonable. For
// example, is it possible that this issue time
// is (slightly) after the first (or even more)
// forecast hour in the product? If so, we'd
// wind up with a DataTime with negative fcstTime!
// Maybe we should find the earliest forecast hour
// that appears in the bulletin, instead of
// inferring from the issueTime?
// Check this................
final long threeHoursInMillis = 3 * 60 * 60 * 1000;
long issueTimeInMillis = issueTime.getTimeInMillis();
long initialTimeInMillis = 0;
if (issueTimeInMillis % threeHoursInMillis == 0) {
initialTimeInMillis = issueTimeInMillis;
}
else {
initialTimeInMillis = issueTimeInMillis / threeHoursInMillis * threeHoursInMillis + threeHoursInMillis;
}
Calendar initialTime = (Calendar) issueTime.clone();
initialTime.setTimeInMillis(initialTimeInMillis);
return initialTime ;
}
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public String getMatrixType() {
return matrixType;
}
public void setMatrixType(String matrixType) {
this.matrixType = matrixType;
}
public String getWmoHeader(){
return wmoHeader;
}
public void setWmoHeader(String wmoHeader){
this.wmoHeader=wmoHeader;
}
public String getIssueOffice() {
return issueOffice;
}
public void setIssueOffice(String issueOffice) {
this.issueOffice = issueOffice;
}
public Calendar getIssueTime(){
return issueTime;
}
public void setIssueTime(Calendar issueTime){
this.issueTime=issueTime;
this.initialTime=inferInitialTime(issueTime);
}
public Calendar getInitialTime() {
return initialTime;
}
public void setInitialTime(Calendar initialTime) {
this.initialTime = initialTime;
}
public String getDesignatorBBB(){
return designatorBBB;
}
public void setDesignatorBBB(String designatorBBB){
this.designatorBBB=designatorBBB;
}
public String getMndTime() {
return mndTime;
}
public void setMndTime(String mndTime) {
this.mndTime = mndTime;
}
public Set<NcPafmUgc> getPafmUGC() {
return pafmUGC;
}
public void setPafmUgc(Set<NcPafmUgc> pafmUgcs) {
this.pafmUGC = pafmUgcs;
}
/*
* Add pafmUgc to set
*/
public void addPafmUGC(NcPafmUgc pugc) {
pafmUGC.add(pugc);
pugc.setParentID(this);
}
/**
* Override existing set method to modify any
* classes that use the dataURI as a foreign key
*/
//public void setIdentifier(Object dataURI){
// this.identifier = dataURI;
// if(this.getPafmUGC() != null && this.getPafmUGC().size() > 0)
// {
// for (Iterator<NcPafmUgc> iter = this.getPafmUGC().iterator(); iter.hasNext();) {
// NcPafmUgc ws = iter.next();
// ws.setParentID(this);
// }
// }
//}
}

View file

@ -0,0 +1,171 @@
/**
* NcPafmFips
*
* This java class represents the county FIPS for a PAFM record.
*
* HISTORY
*
* Date Ticket # Author Description
* ------------ -------- ---------- ----------- --------------------------
* 08/05/09 126 F. J. Yen Initial creation based on AWW Decoder
* 12/11/09 126 F. J. Yen Migrated from to11d3 to to11d6
* 01/06/10 126 F. J. Yen Migrated and refactored from to11dr3 to to11dr11
* 09/30/11 126 B. Hebbard PafmFips becomes new NcPafmFips. Same data,
* but no longer persisted to database.
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import java.io.Serializable;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
public class NcPafmFips implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
private Integer recordId = null;
// The PAFM record this object belongs to.
private NcPafmUgc parentID;
// The county FIPS
private String fips;
// The elevation
private Float elev;
// The latitude
private Float lat;
// The longitude
private Float lon;
/**
* No-Arg Constructor.
*/
public NcPafmFips() {
this.fips = null;
this.elev = IDecoderConstantsN.FLOAT_MISSING;
this.lat = IDecoderConstantsN.FLOAT_MISSING;
this.lon = IDecoderConstantsN.FLOAT_MISSING;
// this.ugc=null;
}
/**
* @return the serialVersionUID
*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
/**
* Get the record id.
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
* @param record
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* @return the parentID
*/
public NcPafmUgc getParentID() {
return parentID;
}
/**
* @param parentID the parentID to set
*/
public void setParentID(NcPafmUgc parentID) {
this.parentID = parentID;
}
/**
* @return the fips
*/
public String getFips() {
return fips;
}
/**
* @param fips to set
*/
public void setFips(String fips) {
this.fips = fips;
}
/**
* @return the elev
*/
public Float getElev() {
return elev;
}
/**
* @param elev to set
*/
public void setElev(Float elev) {
this.elev = elev;
}
/**
* @return the lat
*/
public Float getLat() {
return lat;
}
/**
* @param lat to set
*/
public void setLat(Float lat) {
this.lat = lat;
}
/**
* @return the lon
*/
public Float getLon() {
return lon;
}
/**
* @param lon to set
*/
public void setLon(Float lon) {
this.lon = lon;
}
/**
* Set FIPS record.
*/
public static NcPafmFips setFIPS(String countyFips) {
// New NcPafmFips record to hold county FIPS
NcPafmFips currentFips = new NcPafmFips();
currentFips.setFips(countyFips);
return currentFips;
}
}

View file

@ -0,0 +1,573 @@
/**
*
* NcPafmParameters
*
* This class represents the parameters for the PAFM record. This contains the
* setters and getters for the grandchild table.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 08/21/2009 126 F. J. Yen Initial Creation
* 12/11/2009 126 F. J. Yen Migrated from to11d3 to to11d6
* 01/06/2010 126 F. J. Yen Migrated and refactored from to11dr3 to to11dr11
* 09/29/2011 126 B. Hebbard Refactored decoder to persist to HDF5.
* Old PafmParameters becomes new NcPafmParameters,
* with (main data) persistence annotations removed.
* 10/14/2011 126 B. Hebbard Change windDir and pwindDir from String to Float;
* decoder will do conversion (vs. resource) per GH/SJ
*
* </pre>
*
* @author Fee Jing Yen, SIB
* @version 1
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Transient;
import com.raytheon.uf.common.serialization.ISerializableObject;
public class NcPafmParameters implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
private static final float RMISSD = IDecoderConstantsN.FLOAT_MISSING;
private static final Integer IMISSD = IDecoderConstantsN.INTEGER_MISSING;
private static final Calendar CMISSD = IDecoderConstantsN.CALENDAR_MISSING;
private Integer recordId = null;
/** The pafm record this object belongs to **/
@Transient
private NcPafmUgc parentID;
/** The UTC forecast time **/
private Calendar forecastTimeUtc;
/** The local forecast time **/
private Integer forecastTimeLocal;
/** The local forecast time zone **/
@Transient
private String forecastTimeZone;
private Float avgMxTmpf;
private Float hiMxTmpf;
private Float loMxTmpf;
private Float avgMnTmpf;
private Float hiMnTmpf;
private Float loMnTmpf;
private Float tmpf;
private Float dwpf;
private Float relh;
private Float windDir;
private String windSmph;
private String gust_Mph;
private Float pwindDir;
private String windChar;
private String skyCover;
private Float pop12;
private Float qpf12Mn;
private Float qpf12Mx;
private Float highestMaxQpf;
private Float lowestMaxQpf;
private Float snow12Mn;
private Float snow12Mx;
private String avgSkyCover;
private String obvis;
private Float windChill;
private Float heatIndex;
private Float minChill;
private Float maxHeat;
private String rain;
private String rainShwrs;
private String sprinkles;
private String tstms;
private String drizzle;
private String snow;
private String snowShwrs;
private String flurries;
private String sleet;
private String frzgRain;
private String frzgDrzl;
private String hazards;
/**
* No-Arg Constructor.
*/
public NcPafmParameters() {
this.avgMxTmpf = RMISSD;
this.hiMxTmpf = RMISSD;
this.loMxTmpf = RMISSD;
this.avgMnTmpf = RMISSD;
this.loMnTmpf = RMISSD;
this.hiMnTmpf = RMISSD;
this.tmpf = RMISSD;
this.dwpf = RMISSD;
this.relh = RMISSD;
this.windSmph = " ";
this.gust_Mph = " ";
this.pop12 = RMISSD;
this.qpf12Mn = RMISSD;
this.qpf12Mx = RMISSD;
this.highestMaxQpf = RMISSD;
this.lowestMaxQpf = RMISSD;
this.snow12Mn = RMISSD;
this.snow12Mx = RMISSD;
this.windChill = RMISSD;
this.heatIndex = RMISSD;
this.minChill = RMISSD;
this.maxHeat = RMISSD;
//this.forecastTimeUtc = null;
this.forecastTimeUtc = CMISSD;
//this.forecastTimeLocal = null;
this.forecastTimeLocal = IMISSD;
this.forecastTimeZone = " ";
this.windDir = RMISSD;
this.pwindDir = RMISSD;
this.windChar = " ";
this.skyCover = " ";
this.avgSkyCover = " ";
this.obvis = " ";
this.rain = " ";
this.rainShwrs = " ";
this.sprinkles = " ";
this.tstms = " ";
this.drizzle = " ";
this.snow = " ";
this.snowShwrs = " ";
this.flurries = " ";
this.sleet = " ";
this.frzgRain = " ";
this.frzgDrzl = " ";
this.hazards = " ";
}
private enum Direction {
// (PFM/AFM only needs 8-point compass, but what the heck...)
N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW;
private final float degrees;;
Direction() { degrees = ordinal() * 22.5f; } // Constructor
static Float getDegreesFromLetters(String s) {
if ((s = s.trim()).isEmpty()) {
return RMISSD;
}
try {
return valueOf(s).degrees;
}
catch (IllegalArgumentException e) { // string not among above
//TODO: Log parsing error -- invalid direction string
return RMISSD;
}
}
}
/**
* @return the serialVersionUID
*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
/**
* @return the parentID
*/
public NcPafmUgc getParentID() {
return parentID;
}
/**
* @param parentID the parentID to set
*/
public void setParentID(NcPafmUgc parentID) {
this.parentID = parentID;
}
/**
* @return The recordId. If not set returns to null.
*/
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
* @param record
*/
@SuppressWarnings("unused")
private void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* @return the forecastTimeUtc
*/
public Calendar getForecastTimeUtc() {
return forecastTimeUtc;
}
/**
* @param forecastTimeUtc the forecastTimeUtc to set
*/
public void setForecastTimeUtc(Calendar forecastTimeUtc) {
this.forecastTimeUtc = forecastTimeUtc;
}
public Integer getForecastTimeLocal() {
return forecastTimeLocal;
}
/**
* @param forecastTimeLocal the local forecast hour
*/
public void setForecastTimeLocal(Integer forecastTimeLocal) {
this.forecastTimeLocal = forecastTimeLocal;
}
public String getForecastTimeZone() {
return forecastTimeZone;
}
/**
* @param forecastTimeZone the local time zone (for forecastTimeLocal)
*/
public void setForecastTimeZone(String forecastTimeZone) {
this.forecastTimeZone = forecastTimeZone;
}
public float getAvgMxTmpf() {
return avgMxTmpf;
}
public void setAvgMxTmpf(float avgMxTmpf) {
this.avgMxTmpf = avgMxTmpf;
}
public float getHiMxTmpf() {
return hiMxTmpf;
}
public void setHiMxTmpf(float hiMxTmpf) {
this.hiMxTmpf = hiMxTmpf;
}
public float getLoMxTmpf() {
return loMxTmpf;
}
public void setLoMxTmpf(float loMxTmpf) {
this.loMxTmpf = loMxTmpf;
}
public float getAvgMnTmpf() {
return avgMnTmpf;
}
public void setAvgMnTmpf(float avgMnTmpf) {
this.avgMnTmpf = avgMnTmpf;
}
public float getHiMnTmpf() {
return hiMnTmpf;
}
public void setHiMnTmpf(float hiMnTmpf) {
this.hiMnTmpf = hiMnTmpf;
}
public float getLoMnTmpf() {
return loMnTmpf;
}
public void setLoMnTmpf(float loMnTmpf) {
this.loMnTmpf = loMnTmpf;
}
public float getTmpf() {
return tmpf;
}
public void setTmpf(float tmpf) {
this.tmpf = tmpf;
}
public float getDwpf() {
return dwpf;
}
public void setDwpf(float dwpf) {
this.dwpf = dwpf;
}
public float getRelh() {
return relh;
}
public void setRelh(float relh) {
this.relh = relh;
}
public float getWindDir() {
return windDir;
}
public void setWindDir(float windDir) {
this.windDir = windDir;
}
public void setWindDir(String windDir) {
this.windDir = Direction.getDegreesFromLetters(windDir);
}
/*
* Getter and setter for Wind Speed in mph
*
*/
public String getWindSmph() {
return windSmph;
}
public void setWindSmph(String windSmph) {
this.windSmph = windSmph;
}
public String getGust_Mph() {
return gust_Mph;
}
public void setGust_Mph(String gust_Mph) {
this.gust_Mph = gust_Mph;
}
public String getWindChar() {
return windChar;
}
public void setWindChar(String windChar) {
this.windChar = windChar;
}
public float getPwindDir() {
return pwindDir;
}
public void setPwindDir(float pwindDir) {
this.pwindDir = pwindDir;
}
public void setPwindDir(String pwindDir) {
this.pwindDir = Direction.getDegreesFromLetters(pwindDir);
}
public String getSkyCover() {
return skyCover;
}
public void setSkyCover(String skyCover) {
this.skyCover = skyCover;
}
public float getPop12() {
return pop12;
}
public void setPop12(float pop12) {
this.pop12 = pop12;
}
public float getQpf12Mn() {
return qpf12Mn;
}
public void setQpf12Mn(float qpf12Mn) {
this.qpf12Mn = qpf12Mn;
}
public float getQpf12Mx() {
return qpf12Mx;
}
public void setQpf12Mx(float qpf12Mx) {
this.qpf12Mx = qpf12Mx;
}
public float getHighestMaxQpf() {
return highestMaxQpf;
}
public void setHighestMaxQpf(float highestMaxQpf) {
this.highestMaxQpf = highestMaxQpf;
}
public float getLowestMaxQpf() {
return lowestMaxQpf;
}
public void setLowestMaxQpf(float lowestMaxQpf) {
this.lowestMaxQpf = lowestMaxQpf;
}
public Float getSnow12Mn() {
return snow12Mn;
}
public void setSnow12Mn(Float snow12Mn) {
this.snow12Mn = snow12Mn;
}
public Float getSnow12Mx() {
return snow12Mx;
}
public void setSnow12Mx(Float snow12Mx) {
this.snow12Mx = snow12Mx;
}
public String getAvgSkyCover() {
return avgSkyCover;
}
public void setAvgSkyCover(String avgSkyCover) {
this.avgSkyCover = avgSkyCover;
}
public String getObvis() {
return obvis;
}
public void setObvis(String obvis) {
this.obvis = obvis;
}
public float getWindChill() {
return windChill;
}
public void setWindChill(float windChill) {
this.windChill = windChill;
}
public float getHeatIndex() {
return heatIndex;
}
public void setHeatIndex(float heatIndex) {
this.heatIndex = heatIndex;
}
public float getMinChill() {
return minChill;
}
public void setMinChill(float minChill) {
this.minChill = minChill;
}
public float getMaxHeat() {
return maxHeat;
}
public void setMaxHeat(float maxHeat) {
this.maxHeat = maxHeat;
}
public String getRain() {
return rain;
}
public void setRain(String rain) {
this.rain = rain;
}
public String getRainShwrs() {
return rainShwrs;
}
public void setRainShwrs(String rainShwrs) {
this.rainShwrs = rainShwrs;
}
public String getSprinkles() {
return sprinkles;
}
public void setSprinkles(String sprinkles) {
this.sprinkles = sprinkles;
}
public String getTstms() {
return tstms;
}
public void setTstms(String tstms) {
this.tstms = tstms;
}
public String getDrizzle() {
return drizzle;
}
public void setDrizzle(String drizzle) {
this.drizzle = drizzle;
}
public String getSnow() {
return snow;
}
public void setSnow(String snow) {
this.snow = snow;
}
public String getSnowShwrs() {
return snowShwrs;
}
public void setSnowShwrs(String snowShwrs) {
this.snowShwrs = snowShwrs;
}
public String getFlurries() {
return flurries;
}
public void setFlurries(String flurries) {
this.flurries = flurries;
}
public String getSleet() {
return sleet;
}
public void setSleet(String sleet) {
this.sleet = sleet;
}
public String getFrzgRain() {
return frzgRain;
}
public void setFrzgRain(String frzgRain) {
this.frzgRain = frzgRain;
}
public String getFrzgDrzl() {
return frzgDrzl;
}
public void setFrzgDrzl(String frzgDrzl) {
this.frzgDrzl = frzgDrzl;
}
public String getHazards() {
return hazards;
}
public void setHazards(String hazards) {
this.hazards = hazards;
}
}

View file

@ -0,0 +1,282 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.dao.NcPafmDao;
//import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmLayerData;
import com.raytheon.uf.common.pointdata.Dimension;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.time.DataTime;
/**
* Provides a transform from NcPafmRecords to PointDataContainer and vice versa.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 30 Sep 2011 126 B. Hebbard Initial creation (from ncpirep)
* 14 Oct 2011 126 B. Hebbard Change windDir and pwindDir from String to Float;
* decoder will do conversion (vs. resource) per GH/SJ
* </pre>
*
* @author bhebbard
* @version 1.0
*/
public class NcPafmPointDataTransform {
private static final String DATAURI = "dataURI";
private static final String WMO_HEADER = "wmoHeader";
private static final String STATION_ID = "stationId";
private static final String REPORT_TYPE = "reportType";
private static final String FORECAST_TIME_UTC = "forecastTimeUtc";
private static final String FORECAST_TIME_LOCAL = "forecastTimeLocal";
private static final String FORECAST_TIME_ZONE = "forecastTimeZone";
private static final String AVG_MX_TMPF = "avgMxTmpf";
private static final String HI_MX_TMPF = "hiMxTmpf";
private static final String LO_MX_TMPF = "loMxTmpf";
private static final String AVG_MN_TMPF = "avgMnTmpf";
private static final String HI_MN_TMPF = "hiMnTmpf";
private static final String LO_MN_TMPF = "loMnTmpf";
private static final String TMPF = "tmpf";
private static final String DWPF = "dwpf";
private static final String RELH = "relh";
private static final String WIND_DIR = "windDir";
private static final String WIND_S_MPH = "windSmph";
private static final String GUST_MPH = "gust_Mph";
private static final String P_WIND_DIR = "pwindDir";
private static final String WIND_CHAR = "windChar";
private static final String SKY_COVER = "skyCover";
private static final String POP12 = "pop12";
private static final String QPF_12_MN = "qpf12Mn";
private static final String QPF_12_MX = "qpf12Mx";
private static final String HIGHEST_MAX_QPF = "highestMaxQpf";
private static final String LOWEST_MAX_QPF = "lowestMaxQpf";
private static final String SNOW_12_MN = "snow12Mn";
private static final String SNOW_12_MX = "snow12Mx";
private static final String AVG_SKY_COVER = "avgSkyCover";
private static final String OBVIS = "obvis";
private static final String WIND_CHILL = "windChill";
private static final String HEAT_INDEX = "heatIndex";
private static final String MIN_CHILL = "minChill";
private static final String MAX_HEAT = "maxHeat";
private static final String RAIN = "rain";
private static final String RAIN_SHWRS = "rainShwrs";
private static final String SPRINKLES = "sprinkles";
private static final String TSTMS = "tstms";
private static final String DRIZZLE = "drizzle";
private static final String SNOW = "snow";
private static final String SNOW_SHWRS = "snowShwrs";
private static final String FLURRIES = "flurries";
private static final String SLEET = "sleet";
private static final String FRZGRAIN = "frzgRain";
private static final String FRZGDRZL = "frzgDrzl";
private static final String HAZARDS = "hazards";
/**
* It is important to keep this up to date or risk breaking backwards
* compatibility
*/
private static final String[] ALL_PARAMS = {
DATAURI, WMO_HEADER, STATION_ID, REPORT_TYPE,
FORECAST_TIME_UTC, FORECAST_TIME_LOCAL, FORECAST_TIME_ZONE,
AVG_MX_TMPF, HI_MX_TMPF, LO_MX_TMPF,
AVG_MN_TMPF, HI_MN_TMPF, LO_MN_TMPF, TMPF, DWPF, RELH,
WIND_DIR, WIND_S_MPH, GUST_MPH, P_WIND_DIR, WIND_CHAR, SKY_COVER,
POP12, QPF_12_MN, QPF_12_MX, HIGHEST_MAX_QPF, LOWEST_MAX_QPF,
SNOW_12_MN, SNOW_12_MX, AVG_SKY_COVER, OBVIS,
WIND_CHILL, HEAT_INDEX, MIN_CHILL, MAX_HEAT,
RAIN, RAIN_SHWRS, SPRINKLES, TSTMS, DRIZZLE, SNOW,
SNOW_SHWRS, FLURRIES, SLEET, FRZGRAIN, FRZGDRZL, HAZARDS };
public static final String ALL_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (String s : ALL_PARAMS) {
if (!first) {
sb.append(", ");
} else {
first = false;
}
sb.append(s);
}
ALL_PARAMS_LIST = sb.toString();
}
private NcPafmDao dao;
private PointDataDescription pdd;
public NcPafmPointDataTransform() {
try {
this.dao = new NcPafmDao("ncpafm");
this.pdd = dao.getPointDataDescription();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public PluginDataObject[] toPointData(PluginDataObject[] pdo) {
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof NcPafmRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
if (pdc == null) {
pdc = PointDataContainer.build(this.pdd);
pointMap.put(f, pdc);
}
NcPafmRecord npr = (NcPafmRecord) p;
PointDataView pdv = buildView(pdc, npr);
npr.setPointDataView(pdv);
}
}
return pdo;
}
private PointDataView buildView(PointDataContainer container,
NcPafmRecord record) {
PointDataView pdv = container.append();
pdv.setString(DATAURI, record.getDataURI());
pdv.setString(REPORT_TYPE, record.getReportType());
NcPafmParameters npp = record.getPafmParms();
//TODO: check times
pdv.setLong(FORECAST_TIME_UTC, npp.getForecastTimeUtc().getTimeInMillis());
pdv.setLong(FORECAST_TIME_LOCAL, npp.getForecastTimeLocal()); //TODO: Needed?
pdv.setString(FORECAST_TIME_ZONE, npp.getForecastTimeZone());
pdv.setFloat(AVG_MX_TMPF, npp.getAvgMxTmpf());
pdv.setFloat(HI_MX_TMPF, npp.getHiMxTmpf());
pdv.setFloat(LO_MX_TMPF, npp.getLoMxTmpf());
pdv.setFloat(AVG_MN_TMPF, npp.getAvgMnTmpf());
pdv.setFloat(HI_MN_TMPF, npp.getHiMnTmpf());
pdv.setFloat(LO_MN_TMPF, npp.getLoMnTmpf());
pdv.setFloat(TMPF, npp.getTmpf());
pdv.setFloat(DWPF, npp.getDwpf());
pdv.setFloat(RELH, npp.getRelh());
pdv.setFloat(WIND_DIR, npp.getWindDir());
pdv.setString(WIND_S_MPH, npp.getWindSmph());
pdv.setString(GUST_MPH, npp.getGust_Mph());
pdv.setFloat(P_WIND_DIR, npp.getPwindDir());
pdv.setString(WIND_CHAR, npp.getWindChar());
pdv.setString(SKY_COVER, npp.getSkyCover());
pdv.setFloat(POP12, npp.getPop12());
pdv.setFloat(QPF_12_MN, npp.getQpf12Mn());
pdv.setFloat(QPF_12_MX, npp.getQpf12Mx());
pdv.setFloat(HIGHEST_MAX_QPF, npp.getHighestMaxQpf());
pdv.setFloat(LOWEST_MAX_QPF, npp.getLowestMaxQpf());
pdv.setFloat(SNOW_12_MN, npp.getSnow12Mn());
pdv.setFloat(SNOW_12_MX, npp.getSnow12Mx());
pdv.setString(AVG_SKY_COVER, npp.getAvgSkyCover());
pdv.setString(OBVIS, npp.getObvis());
pdv.setFloat(WIND_CHILL, npp.getWindChill());
pdv.setFloat(HEAT_INDEX, npp.getHeatIndex());
pdv.setFloat(MIN_CHILL, npp.getMinChill());
pdv.setFloat(MAX_HEAT, npp.getMaxHeat());
pdv.setString(RAIN, npp.getRain());
pdv.setString(RAIN_SHWRS, npp.getRainShwrs());
pdv.setString(SPRINKLES, npp.getSprinkles());
pdv.setString(TSTMS, npp.getTstms());
pdv.setString(DRIZZLE, npp.getDrizzle());
pdv.setString(SNOW, npp.getSnow());
pdv.setString(SNOW_SHWRS, npp.getSnowShwrs());
pdv.setString(FLURRIES, npp.getFlurries());
pdv.setString(SLEET, npp.getSleet());
pdv.setString(FRZGRAIN, npp.getFrzgRain());
pdv.setString(FRZGDRZL, npp.getFrzgDrzl());
pdv.setString(HAZARDS, npp.getHazards());
return pdv;
}
public static NcPafmRecord toNcPafmRecord(PointDataView pdv) {
//TODO: Needs retrieval testing for hooking up to display resource!
NcPafmRecord npr = new NcPafmRecord();
NcPafmParameters npp = new NcPafmParameters();
////npp.setForecastTimeUtc(pdv.getLong(FORECAST_TIME_UTC).getRefTime().getTime());
////npp.setForecastTimeLocal(pdv.getLong(FORECAST_TIME_LOCAL));
npp.setForecastTimeZone(pdv.getString(FORECAST_TIME_ZONE));
npp.setAvgMxTmpf(pdv.getFloat(AVG_MX_TMPF));
npp.setHiMxTmpf(pdv.getFloat(HI_MX_TMPF));
npp.setLoMxTmpf(pdv.getFloat(LO_MX_TMPF));
npp.setAvgMnTmpf(pdv.getFloat(AVG_MN_TMPF));
npp.setHiMnTmpf(pdv.getFloat(HI_MN_TMPF));
npp.setLoMnTmpf(pdv.getFloat(LO_MN_TMPF));
npp.setTmpf(pdv.getFloat(TMPF));
npp.setDwpf(pdv.getFloat(DWPF));
npp.setRelh(pdv.getFloat(RELH));
npp.setWindDir(pdv.getFloat(WIND_DIR));
npp.setWindSmph(pdv.getString(WIND_S_MPH));
npp.setGust_Mph(pdv.getString(GUST_MPH));
npp.setPwindDir(pdv.getFloat(P_WIND_DIR));
npp.setWindChar(pdv.getString(WIND_CHAR));
npp.setSkyCover(pdv.getString(SKY_COVER));
npp.setPop12(pdv.getFloat(POP12));
npp.setQpf12Mn(pdv.getFloat(QPF_12_MN));
npp.setQpf12Mx(pdv.getFloat(QPF_12_MX));
npp.setHighestMaxQpf(pdv.getFloat(HIGHEST_MAX_QPF));
npp.setLowestMaxQpf(pdv.getFloat(LOWEST_MAX_QPF));
npp.setSnow12Mn(pdv.getFloat(SNOW_12_MN));
npp.setSnow12Mx(pdv.getFloat(SNOW_12_MX));
npp.setAvgSkyCover(pdv.getString(AVG_SKY_COVER));
npp.setObvis(pdv.getString(OBVIS));
npp.setWindChill(pdv.getFloat(WIND_CHILL));
npp.setHeatIndex(pdv.getFloat(HEAT_INDEX));
npp.setMinChill(pdv.getFloat(MIN_CHILL));
npp.setMaxHeat(pdv.getFloat(MAX_HEAT));
npp.setRain(pdv.getString(RAIN));
npp.setRainShwrs(pdv.getString(RAIN_SHWRS));
npp.setSprinkles(pdv.getString(SPRINKLES));
npp.setTstms(pdv.getString(TSTMS));
npp.setDrizzle(pdv.getString(DRIZZLE));
npp.setSnow(pdv.getString(SNOW));
npp.setSnowShwrs(pdv.getString(SNOW_SHWRS));
npp.setFlurries(pdv.getString(FLURRIES));
npp.setSleet(pdv.getString(SLEET));
npp.setFrzgRain(pdv.getString(FRZGRAIN));
npp.setFrzgDrzl(pdv.getString(FRZGDRZL));
npp.setHazards(pdv.getString(HAZARDS));
npr.setPafmParms(npp);
return npr;
}
public static NcPafmRecord[] toNcPafmRecords(PointDataContainer container) {
List<NcPafmRecord> records = new ArrayList<NcPafmRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
records.add(toNcPafmRecord(pdv));
}
return records.toArray(new NcPafmRecord[records.size()]);
}
}

View file

@ -0,0 +1,407 @@
/*
*
* NcPafmRecord
*
* This class performs the mapping to the database tables for the Point/Area
* Forecast Matrices (PAFM) Decoder Plug-In
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ----------- -------------- -----------------------------------
* 08/05/2009 126 F. J. Yen Initial creation
* 01/06/2010 126 F. J. Yen Migrated and refactored from to11dr3 to to11dr11
* *
* This code has been developed by the SIB for use in the AWIPS2 system.
* </pre>
*
* @author F. J. Yen, SIB
* @version 1
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmUgc;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
/**
* NcPafmRecord is the Data Access component for PAFM Point/Area Forecast Matrices data.
* This contains getters and setters for the main table "ncpafm".
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 30 Sep 2011 126 B. Hebbard Initial version in refactored NcPafm decoder.
* This new (fine-grain) PDO contains data associated
* with one location / forecast hour pair only, for
* efficiency of retrieval. It also implements
* IPointData -- that is, presents a PointDataView
* object suitable for HDF5 persistence.
* 10 Oct 2011 126 G. Hull replace stnid,lat&lon with the SurfaceObsLocation.
* </pre>
*
* @author B. Hebbard, SIB
* @version 1.0
*/
@Entity
@Table(name = "ncpafm", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcPafmRecord extends PluginDataObject implements
//TODO: Make absolutely sure these are NO LONGER required... ISpatialEnabled, IDecoderGettable,
IPointData, IPersistable{
private static final long serialVersionUID = 1L;
/** Report type */
@Column(length=32)
@XmlElement
@DynamicSerializeElement
private String reportType;
// WMO header
@DataURI(position = 4)
@Column(length=32)
@XmlElement
@DynamicSerializeElement
private String wmoHeader;
// The issue office where the report from
@Column(length=32)
@DataURI(position=1)
@XmlElement
@DynamicSerializeElement
private String issueOffice;
@Column
@DataURI(position = 2)
@DynamicSerializeElement
@XmlElement
private Calendar issueTime;
// The stationId here is the FIPS code and not the issuing office
@Embedded
@DataURI(position = 3, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
@Column(length = 8)
@DynamicSerializeElement
@XmlElement
private String designatorBBB;
// The mndTime
@Column(length=72)
@XmlElement
@DynamicSerializeElement
private String mndTime;
/** Matrix type */
@DataURI(position = 5)
@Column(length=32)
@XmlElement
@DynamicSerializeElement
private String matrixType;
// The universal geographic code
@Column(length=640)
@XmlElement
@DynamicSerializeElement
private String ugc;
// The product purge time
@XmlElement
@DynamicSerializeElement
private Calendar prodPurgeTime;
// Text information for this segment
//@Column(length=12000)
//@XmlElement
//@DynamicSerializeElement
private String segment;
// // The county FIPS : this is the stationId in the SurfaceObsLocation
// @Column(length=16)
// @XmlElement
// @DynamicSerializeElement
// private String fips;
// The group of parameter values associated with the above combination.
@Transient
private NcPafmParameters pafmParms;
// The PointDataView representation of data associated with this PDO
// to be persisted as HDF5
@Embedded
private PointDataView pdv;
private Integer hdfFileId;
/**
* Default Constructor
*/
public NcPafmRecord() {
this.location = null;
this.issueOffice=null;
this.reportType="PAFM";
this.matrixType=" ";
this.issueTime=null;
this.wmoHeader=null;
this.designatorBBB=" ";
this.mndTime=null;
}
/**
* Constructs a pafm record from a dataURI
*
* @param uri
* The dataURI
*/
public NcPafmRecord(String uri) {
super(uri);
}
@Override
public IDecoderGettable getDecoderGettable() {
// TODO Auto-generated method stub
return null;
}
public String getReportType() {
return reportType;
}
public void setReportType(String reportType) {
this.reportType = reportType;
}
public String getMatrixType() {
return matrixType;
}
public void setMatrixType(String matrixType) {
this.matrixType = matrixType;
}
public String getWmoHeader(){
return wmoHeader;
}
public void setWmoHeader(String wmoHeader){
this.wmoHeader=wmoHeader;
}
public String getIssueOffice() {
return issueOffice;
}
public void setIssueOffice(String issueOffice) {
this.issueOffice = issueOffice;
}
public Calendar getIssueTime(){
return issueTime;
}
public void setIssueTime(Calendar issueTime){
this.issueTime=issueTime;
}
public String getDesignatorBBB(){
return designatorBBB;
}
public void setDesignatorBBB(String designatorBBB){
this.designatorBBB=designatorBBB;
}
public String getMndTime() {
return mndTime;
}
public void setMndTime(String mndTime) {
this.mndTime = mndTime;
}
/**
* @return the ugc
*/
public String getUgc() {
return ugc;
}
/**
* @param ugc to set
*/
public void setUgc(String ugc) {
this.ugc = ugc;
}
/**
* @return the prodPurgeTime
*/
public Calendar getProdPurgeTime() {
return prodPurgeTime;
}
/**
* @param prodPurgeTime to set
*/
public void setProdPurgeTime(Calendar prodPurgeTime) {
this.prodPurgeTime = prodPurgeTime;
}
/**
* @return the segment
*/
public String getSegment() {
return segment;
}
/**
* @param segment to set
*/
public void setSegment(String segment) {
this.segment = segment;
}
// public String getFips() {
// return fips;
// }
public String getStationId() {
return location.getStationId();
}
// if this needs to be an ISpatialObject
// @Override
// public SurfaceObsLocation getSpatialObject() {
// return location;
// }
public SurfaceObsLocation getLocation() {
return location;
}
public void setLocation( SurfaceObsLocation obsLoc ){
this.location = obsLoc;
}
public double getLatitude() {
return location.getLatitude();
}
public double getLongitude() {
return location.getLongitude();
}
public Integer getElevation() {
return location.getElevation();
}
// public void setFips(String fips) {
// this.fips = fips;
// }
/**
* @return the set of Parameters
*/
public NcPafmParameters getPafmParms() {
return pafmParms;
}
/**
* @param pafmParameters-the set of Parmameters to set
*/
public void setPafmParms(NcPafmParameters pafmParams) {
this.pafmParms = pafmParams;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView()
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon
* .uf.common.pointdata.PointDataView)
*/
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public Date getPersistenceTime() {
// return this.dataTime.getRefTime();
return null;
}
@Override
public void setHdfFileId(Integer hdfFileId) {
this.hdfFileId = hdfFileId;
}
@Override
public void setPersistenceTime(Date persistTime) {
// TODO Auto-generated method stub
}
/**
* Override existing set method to modify any
* classes that use the dataURI as a foreign key
*/
public void setIdentifier(Object dataURI){
this.identifier = dataURI;
}
}

View file

@ -0,0 +1,202 @@
/**
* NcPafmUgc
*
* This java class represents the UGC for an Pafm record.
*
* HISTORY
*
* Date Ticket # Author Description
* ------------ --------- ----------- --------------------------
* 08/21/09 126 F. J. Yen Initial creation based on AWW Decoder
* 01/06/10 126 F. J. Yen Migrated and refactored from to11dr3 to to11dr11
*
* This code has been developed by the SIB for use in the AWIPS2 system.
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;
import java.io.Serializable;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import com.raytheon.uf.common.serialization.ISerializableObject;
public class NcPafmUgc implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
private Integer recordId = null;
// The PAFM record this object belongs to
private NcPafmBulletin parentID;
// The universal geographic code
private String ugc;
// The product purge time
private Calendar prodPurgeTime;
// Text information for this segment
private String segment;
/**
* Pafm FIPS Table
*/
private Set<NcPafmFips> pafmFIPS = new HashSet<NcPafmFips>();
/**
* Pafm Parameters Table
*/
private Set<NcPafmParameters> pafmParms = new HashSet<NcPafmParameters>();
/**
* No-Arg Constructor.
*/
public NcPafmUgc() {
this.ugc=null;
this.prodPurgeTime=null;
this.segment=null;
//System.out.println("IN UGC constructor.....");
//Thread.dumpStack();
}
/**
* Get the record id.
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
* @param record
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* @return the serialVersionUID
*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
/**
* @return the parentID
*/
public NcPafmBulletin getParentID() {
return parentID;
}
/**
* @param parentID the parentID to set
*/
public void setParentID(NcPafmBulletin parentID) {
this.parentID = parentID;
if (this.getPafmFIPS() !=null && this.getPafmFIPS().size() >0 )
{
for (Iterator<NcPafmFips> iter = this.getPafmFIPS().iterator(); iter.hasNext();) {
NcPafmFips cond = iter.next();
cond.setParentID(this);
//cond.setUgc(ugc);
}
}
if (this.getPafmParms() !=null && this.getPafmParms().size() >0 )
{
for (Iterator<NcPafmParameters> iter = this.getPafmParms().iterator(); iter.hasNext();) {
NcPafmParameters cond = iter.next();
cond.setParentID(this);
}
}
}
/**
* @return the ugc
*/
public String getUgc() {
return ugc;
}
/**
* @param ugc to set
*/
public void setUgc(String ugc) {
this.ugc = ugc;
}
/**
* @return the set of pafmFIPS
*/
public Set<NcPafmFips> getPafmFIPS() {
return pafmFIPS;
}
/**
* @param pafmFIPS-the set of pafmFIPS to set
*/
public void setPafmFIPS(Set<NcPafmFips> ncPafmFips) {
this.pafmFIPS = ncPafmFips;
}
/**
* Add NcPafmFips to set
*/
public void addPafmFIPS(NcPafmFips pfips){
pafmFIPS.add(pfips);
}
/**
* @return the set of Parameters
*/
public Set<NcPafmParameters> getPafmParms() {
return pafmParms;
}
/**
* @param pafmParameters-the set of Parmameters to set
*/
public void setPafmParms(Set<NcPafmParameters> pafmParams) {
this.pafmParms = pafmParams;
}
/**
* Add NcPafmParameters to set
*/
public void addPafmParms(NcPafmParameters pparms){
pafmParms.add(pparms);
}
/**
* @return the prodPurgeTime
*/
public Calendar getProdPurgeTime() {
return prodPurgeTime;
}
/**
* @param prodPurgeTime to set
*/
public void setProdPurgeTime(Calendar prodPurgeTime) {
this.prodPurgeTime = prodPurgeTime;
}
/**
* @return the segment
*/
public String getSegment() {
return segment;
}
/**
* @param segment to set
*/
public void setSegment(String segment) {
this.segment = segment;
}
}

View file

@ -1,101 +1,97 @@
/**
* H5UairDao
*
* This java class defines data access object for upper air sounding
* data.
*
* Set of DAO methods for PAFM data.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 4/2011 T. Lee Persisted to HDF5
*
* Date Ticket# Engineer Description
* ------------ ----------- ----------- --------------------------
* 23 Sep 2011 B. Hebbard Initial Coding (Following NcUairDao and FJY's instructions)
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
* @author T. Lee
* @version 1.0
*/
* @author fjyen
* @version 1.0
**/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm.dao;
import java.util.List;
package gov.noaa.nws.ncep.common.dataplugin.h5uair.dao;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.datastorage.StorageException;
import gov.noaa.nws.ncep.common.dataplugin.ncpafm.NcPafmRecord;
import gov.noaa.nws.ncep.edex.common.dao.NcepDefaultPluginDao;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
import gov.noaa.nws.ncep.common.dataplugin.h5uair.H5UairRecord;
public class NcPafmDao extends PointDataPluginDao<NcPafmRecord> {
public class H5UairDao extends PointDataPluginDao<H5UairRecord> {
private PointDataDescription pdd;
/**
* Creates a new ReccoDao
*
* @throws PluginException
*/
public H5UairDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves an sfcobs report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public H5UairRecord queryByDataURI(String dataURI) {
H5UairRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (H5UairRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the sfcobs table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.h5uair where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
private PointDataDescription pdd;
/**
* Creates a new ReccoDao
* @throws PluginException
*/
public NcPafmDao(String pluginName) throws PluginException {
super(pluginName);
}
/**
* Retrieves a pafm report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public NcPafmRecord queryByDataURI(String dataURI) {
NcPafmRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if((obs != null)&&(obs.size() > 0)) {
report = (NcPafmRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the PAFM table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.ncpafm where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
@Override
public String[] getKeysRequiredForFileName() {
public String[] getKeysRequiredForFileName() { //TODO: See if this is correct/complete
return new String[] { "dataTime.refTime" };
}
@Override
public String getPointDataFileName(H5UairRecord p) {
return "h5uairs.h5";
public String getPointDataFileName(NcPafmRecord p) {
return "ncpafm.h5"; //TODO: "s"? or no "s"?
}
@Override
public H5UairRecord newObject() {
return new H5UairRecord();
public NcPafmRecord newObject() {
return new NcPafmRecord();
}
/*
@ -115,10 +111,8 @@ public class H5UairDao extends PointDataPluginDao<H5UairRecord> {
public PointDataDescription getPointDataDescription() throws JAXBException {
if (pdd == null) {
pdd = PointDataDescription.fromStream(this.getClass()
.getResourceAsStream("/res/pointdata/h5uair.xml"));
.getResourceAsStream("/res/pointdata/ncpafm.xml"));
}
return pdd;
}
}
}

View file

@ -4,4 +4,4 @@
* Package includes classes to decode the IDFT message and persist the data.
*
*/
package gov.noaa.nws.ncep.common.dataplugin.pafm.dao;
package gov.noaa.nws.ncep.common.dataplugin.ncpafm.dao;

View file

@ -0,0 +1,4 @@
/**
* Contains utility classes for ncpafm plugin
*/
package gov.noaa.nws.ncep.common.dataplugin.ncpafm;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.ncpirep</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,4 +1,4 @@
#Mon May 24 15:10:35 EDT 2010
#Thu Dec 10 11:10:30 EST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6

View file

@ -0,0 +1,39 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Ncpirep Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncpirep
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
com.raytheon.uf.common.status;bundle-version="1.12.1174",
net.sf.cglib;bundle-version="2.1.3",
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
javax.measure,
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.12.1174"
Import-Package: com.raytheon.edex.db.dao,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.time,
com.raytheon.uf.edex.database,
com.raytheon.uf.edex.database.dao,
com.raytheon.uf.edex.database.plugin,
com.raytheon.uf.edex.decodertools.aircraft,
com.raytheon.uf.edex.pointdata,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.common.tools,
javax.measure.unit,
javax.persistence,
org.springframework.orm.hibernate3
Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncpirep,
gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao

View file

@ -0,0 +1,2 @@
gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord
gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepLayerData

View file

@ -0,0 +1,8 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.ncpirep">
<!-- property name="component.name" value="plugin-mcidas" /-->
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -0,0 +1,705 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
/**
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftCloudLayer;
import com.raytheon.uf.edex.decodertools.aircraft.AircraftFlightCondition;
/**
* This structure holds information about layer type data contained within a
* pirep observation. For turbulence and icing data each layer must have a layer
* type (i.e. icing) and at least one height to be considered valid. Cloud data
* must have at least one cloud cover amount and a height to be considered
* valid. These rules are enforced by using the getLayerData and
* getCloudLayerData factory methods. The user may enforce their own rules by
* setting the data directly.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 05/02/2011 F. J. Yen Initial creation from Raytheon's pirep
* 08/30/2011 286 qzhou Added fields for TB, IC, SK. Remove general fileds.
* Append intensity2 to intensity1 for TB, IC, SK.
* Created getTurbLayerData and getIceLayerData method.
* 08/31/2011 286 qzhou Created project and moved this from ~edex.plugin.pirep
*
* </pre>
*
* @author qzhou
* @version 1.0
*/
@Entity
@Table(name="ncpirep_anc_data")
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class NcPirepLayerData implements Serializable, ISerializableObject {
private static final long serialVersionUID = 1L;
public static final String LAYER_TYP_ICING = "ICING";
public static final String LAYER_TYP_TURBC = "TURBC";
public static final String LAYER_TYP_CLOUD = "CLOUD";
//public static final Integer INDETERMINATE = 99999; //use IDecoderConstantsN.INTEGER_MISSING
@Id
@GeneratedValue
private Integer recordId = null;
@Column
private Integer obsId;
@ManyToOne
@JoinColumn(name="parent", nullable=false)
private NcPirepRecord parent = null;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String hazardType;
// @Column(length=8)
// @XmlAttribute
// @DynamicSerializeElement
// private String dataType;
//
// @Column(length=8)
// @XmlAttribute
// @DynamicSerializeElement
// private String frequency;
//
// @Column
// @XmlAttribute
// @DynamicSerializeElement
// private Integer baseLayerHeight;
//
// @Column
// @XmlAttribute
// @DynamicSerializeElement
// private Integer topLayerHeight;
//
// @Column(length=8)
// @XmlAttribute
// @DynamicSerializeElement
// private String firstValue;
//
// @Column(length=8)
// @XmlAttribute
// @DynamicSerializeElement
// private String secondValue;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String turbInten;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String turbFreq;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String turbType;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String iceInten;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String iceType;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String skyCover1;
@Column(length=8)
@XmlAttribute
@DynamicSerializeElement
private String skyCover2;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer turbBaseHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer turbTopHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer iceBaseHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer iceTopHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer skyBaseHeight;
@Column
@XmlAttribute
@DynamicSerializeElement
private Integer skyTopHeight;
/**
* Construct an empty base.
*/
public NcPirepLayerData() {
}
/**
* Constructor with known parent.
*
* @param parent
* The parent of this class.
*/
public NcPirepLayerData(NcPirepRecord parent) {
this.parent = parent;
}
/**
* Constructor with known parent and observation type.
*
* @param parent
* The parent of this class.
* @param type
* The observation type for this data.
*/
public NcPirepLayerData(NcPirepRecord parent, String type) {
this(parent);
hazardType = type;
}
/**
* Get the record id.
*
* @return The recordId. If not set returns null.
*/
public Integer getRecordId() {
return recordId;
}
/**
* Set the record id.
*
* @param recordId
* The recordId.
*/
public void setRecordId(Integer recordId) {
this.recordId = recordId;
}
/**
* Get the observation id. This is the foreign key to the parent.
*
* @return The observation id. If not set returns null.
*/
public Integer getObsId() {
return obsId;
}
/**
* Set the observation id. This is the foreign key to the parent.
*
* @param obsId
* The observation id.
*/
public void setObsId(Integer obsId) {
this.obsId = obsId;
}
/**
* Get the parent for this class.
*
* @return the parent
*/
public NcPirepRecord getParent() {
return parent;
}
/**
* Set the parent for this class.
*
* @param parent
* The parent to set.
*/
public void setParent(NcPirepRecord parent) {
this.parent = parent;
}
/**
* @return the layerType
*/
public String getLayerType() {
return hazardType;
}
/**
* @param layerType
* the layerType to set
*/
public void setLayerType(String hazardType) {
this.hazardType = hazardType;
}
/**
* @return the baseLayerHeight
*/
public Integer getTurbBaseHeight() {
return turbBaseHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setTurbBaseHeight(Integer turbBaseHeight) {
this.turbBaseHeight = turbBaseHeight;
}
/**
* @return the baseLayerHeight
*/
public Integer getTurbTopHeight() {
return turbTopHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setTurbTopHeight(Integer turbTopHeight) {
this.turbTopHeight = turbTopHeight;
}
/**
* @return the baseLayerHeight
*/
public Integer getIceBaseHeight() {
return iceBaseHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setIceBaseHeight(Integer iceBaseHeight) {
this.iceBaseHeight = iceBaseHeight;
}
/**
* @return the baseLayerHeight
*/
public Integer getIceTopHeight() {
return iceTopHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setIceTopHeight(Integer iceTopHeight) {
this.iceTopHeight = iceTopHeight;
}
/**
* @return the baseLayerHeight
*/
public Integer getSkyBaseHeight() {
return skyBaseHeight;
}
/**
* @param baseLayerHeight
* the baseLayerHeight to set
*/
public void setSkyBaseHeight(Integer skyBaseHeight) {
this.skyBaseHeight = skyBaseHeight;
}
/**
* @return the topLayerHeight
*/
public Integer getSkyTopHeight() {
return skyTopHeight;
}
/**
* @param topLayerHeight
* the topLayerHeight to set
*/
public void setSkyTopHeight(Integer skyTopHeight) {
this.skyTopHeight = skyTopHeight;
}
// /**
// * @return the firstValue
// */
// public String getFirstValue() {
// return firstValue;
// }
//
// /**
// * @param firstValue
// */
// public void setFirstValue(String firstValue) {
// this.firstValue = firstValue;
// }
//
// /**
// * @return the secondValue
// */
// public String getSecondValue() {
// return secondValue;
// }
//
// /**
// * @param secondValue
// */
// public void setSecondValue(String secondValue) {
// this.secondValue = secondValue;
// }
// /**
// * @return the dataType
// */
// public String getDataType() {
// return dataType;
// }
//
// /**
// * @param dataType
// * the dataType to set
// */
// public void setDataType(String dataType) {
// this.dataType = dataType;
// }
//
// /**
// * @return the frequency
// */
// public String getFrequency() {
// return frequency;
// }
//
// /**
// * @param frequency the frequency to set
// */
// public void setFrequency(String frequency) {
// this.frequency = frequency;
// }
//
// /**
// * @return the baseLayerHeight
// */
// public Integer getBaseLayerHeight() {
// return baseLayerHeight;
// }
//
// /**
// * @param baseLayerHeight
// * the baseLayerHeight to set
// */
// public void setBaseLayerHeight(Integer baseLayerHeight) {
// this.baseLayerHeight = baseLayerHeight;
// }
//
// /**
// * @return the topLayerHeight
// */
// public Integer getTopLayerHeight() {
// return topLayerHeight;
// }
//
// /**
// * @param topLayerHeight
// * the topLayerHeight to set
// */
// public void setTopLayerHeight(Integer topLayerHeight) {
// this.topLayerHeight = topLayerHeight;
// }
/**
* @return the turbInten
*/
public String getTurbInten() {
return turbInten;
}
/**
* @param turbInten
*/
public void setTurbInten(String turbInten) {
this.turbInten = turbInten;
}
/**
* @return the turbFreq
*/
public String getTurbFreq() {
return turbFreq;
}
/**
* @param turbFreq
*/
public void setTurbFreq(String turbFreq) {
this.turbFreq = turbFreq;
}
/**
* @return the turbType
*/
public String getTurbType() {
return turbType;
}
/**
* @param turbType
*/
public void setTurbType(String turbType) {
this.turbType = turbType;
}
/**
* @return the skyInten
*/
public String getIceInten() {
return iceInten;
}
/**
* @param skyInten
*/
public void setIceInten(String iceInten) {
this.iceInten = iceInten;
}
/**
* @return the skyInten
*/
public String getIceType() {
return iceType;
}
/**
* @param skyInten
*/
public void setIceType(String iceType) {
this.iceType = iceType;
}
/**
* @return the skyInten
*/
public String getSkyInten1() {
return skyCover1;
}
/**
* @param skyInten
*/
public void setSkyInten1(String skyCover1) {
this.skyCover1 = skyCover1;
}
/**
* @return the skyInten
*/
public String getSkyInten2() {
return skyCover2;
}
/**
* @param skyInten
*/
public void setSkyInten2(String skyCover2) {
this.skyCover2 = skyCover2;
}
/**
* Factored out code that creates icing or turbulence layer data.
*
* @param layer
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static NcPirepLayerData getTurbLayerData(AircraftFlightCondition layer) {
NcPirepLayerData dataLayer = new NcPirepLayerData(); //null;
boolean isValid = false;
String intensity = layer.getIntensity1();
if (intensity != null) {
dataLayer.setTurbInten(intensity);
isValid = true;
}
String intensity2 = layer.getIntensity2();
if (intensity2 != null) {
dataLayer.setTurbInten(intensity+intensity2);
isValid = true;
}
String type = layer.getType();
if (type != null) {
dataLayer.setTurbType(type);
isValid = true;
}
if (layer.getFrequency() != null) {
dataLayer.setTurbFreq(layer.getFrequency());
isValid = true;
}
// if we have at least one intensity and/or type get the height info.
if (isValid) {
// reset so we can ensure at least one height.
//isValid = false;
Integer hgt = layer.getBaseHeight();
if (hgt != null) {
dataLayer.setTurbBaseHeight(hgt);
isValid = true;
}
hgt = layer.getTopHeight();
if (hgt != null) {
dataLayer.setTurbTopHeight(hgt);
isValid = true;
}
}
if (!isValid) {
dataLayer = null;
}
if (dataLayer != null) {
dataLayer.setLayerType(NcPirepLayerData.LAYER_TYP_TURBC);
}
return dataLayer;
}
public static NcPirepLayerData getIceLayerData(AircraftFlightCondition layer) {
NcPirepLayerData dataLayer = new NcPirepLayerData(); //null;
boolean isValid = false;
String intensity = layer.getIntensity1();
if (intensity != null) {
dataLayer.setIceInten(intensity);
isValid = true;
}
String intensity2 = layer.getIntensity2();
if (intensity2 != null) {
dataLayer.setIceInten(intensity+intensity2);
isValid = true;
}
String type = layer.getType();
if (type != null) {
dataLayer.setIceType(type);
isValid = true;
}
// if we have at least one intensity and/or type get the height info.
if (isValid) {
// reset so we can ensure at least one height.
//isValid = false;
Integer hgt = layer.getBaseHeight();
if (hgt != null) {
dataLayer.setIceBaseHeight(hgt);
isValid = true;
}
hgt = layer.getTopHeight();
if (hgt != null) {
dataLayer.setIceTopHeight(hgt);
isValid = true;
}
}
if (!isValid) {
dataLayer = null;
}
if (dataLayer != null) {
dataLayer.setLayerType(NcPirepLayerData.LAYER_TYP_ICING);
}
return dataLayer;
}
/**
* Factored out code that creates icing or turbulence layer data.
*
* @param layer
* Decoded flight conditions data (Turbulence or icing)
* @return A populated entry.
*/
public static NcPirepLayerData getCloudLayerData(AircraftCloudLayer layer) {
NcPirepLayerData cloudLayer = new NcPirepLayerData();
boolean isValid = false;
String intensity = layer.getCloudCover1();
if (intensity != null) {
cloudLayer.setSkyInten1(intensity);
isValid = true;
}
String intensity2 = layer.getCloudCover2();
if (intensity2 != null) {
cloudLayer.setSkyInten1(intensity +intensity2);
cloudLayer.setSkyInten2(intensity2);
isValid = true;
}
// if we have at least one cloud coverage
if (isValid) {
// reset so we can ensure at least one height.
//isValid = false;
Integer hgt = layer.getCloudBaseHeight();
if (hgt != null) {
cloudLayer.setSkyBaseHeight(hgt);
isValid = true;
}
hgt = layer.getCloudTopHeight();
if (hgt != null) {
cloudLayer.setSkyTopHeight(hgt);
isValid = true;
}
}
if (!isValid) {
cloudLayer = null;
}
if (cloudLayer != null) {
//cloudLayer.setDataType(null);
cloudLayer.setLayerType(NcPirepLayerData.LAYER_TYP_CLOUD);
}
return cloudLayer;
}
}

View file

@ -0,0 +1,380 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
/**
* 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.
**/
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao.NcPirepDao;
import com.raytheon.uf.common.pointdata.Dimension;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.time.DataTime;
/**
* Provides a transform from NcPirepRecords to PointDataContainer and vice versa.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/27/2011 F. J. Yen Initial creation
* 08/30/2011 286 qzhou Added fields for TB, IC, SK. Remove general fields.
* 08/31/2011 286 qzhou Created project and moved this from ~edex.plugin.pirep
* 09/27/2011 286 qzhou Make TB, IC, SK records all start from 0 in the arrays.
* Fixed visibility .
* </pre>
*
* @author qzhou
* @version 1.0
*/
public class NcPirepPointDataTransform {
private static final String CORRECTION_CODE = "correctionCode";
private static final String DATAURI = "dataURI";
private static final String OBS_TEXT = "obsText";
private static final String WMO_HEADER = "wmoHeader";
private static final String STATION_ID = "stationId";
private static final String REPORT_TYPE = "reportType";
private static final String TIME_OBS = "timeObs";
private static final String OBS_ID = "obsId";
private static final String AIRCRAFT_TYPE = "aircraftType";
private static final String LONGITUDE = "longitude";
private static final String LATITUDE = "latitude";
private static final String FLIGHT_LEVEL = "flightLevel";
private static final String WIND_SPEED = "windSpeed";
private static final String WIND_DIR = "windDir";
private static final String TEMPERATURE = "temperature";
private static final String HORZ_VISIBILITY = "horzVisibility";
private static final String WEATHER_GROUP = "weatherGroup";
private static final String NUM_LAYER = "numLayer";
private static final String NCPIREP_LAYER_DATA = "ncPirepLayerData";
private static final String HAZARD_TYPE = "hazardType";
// private static final String DATA_TYPE = "dataType";
// private static final String BASE_LAYER_HEIGHT = "baseLayerHeight";
// private static final String TOP_LAYER_HEIGHT = "topLayerHeight";
// private static final String FIRST_VALUE = "firstValue";
// private static final String SECOND_VALUE = "secondValue";
private static final String TURB_INTEN = "turbInten";
private static final String TURB_TYPE = "turbType";
private static final String TURB_FREQ = "turbFreq";
private static final String ICE_INTEN = "iceInten";
private static final String ICE_TYPE = "iceType";
private static final String SKY_COVER1 = "skyCover1";
private static final String SKY_COVER2 = "skyCover2";
private static final String TURB_BASE_HEIGHT = "turbBaseHeight";
private static final String TURB_TOP_HEIGHT = "turbTopHeight";
private static final String ICE_BASE_HEIGHT = "iceBaseHeight";
private static final String ICE_TOP_HEIGHT = "iceTopHeight";
private static final String SKY_BASE_HEIGHT = "skyBaseHeight";
private static final String SKY_TOP_HEIGHT = "skyTopHeight";
private static final String SUSPECT_TIME_FLAG = "suspectTimeFlag";
/**
* It is important to keep this up to date or risk breaking backwards
* compatibility
*/
private static final String[] ALL_PARAMS = { CORRECTION_CODE, DATAURI,
OBS_TEXT, WMO_HEADER, STATION_ID, REPORT_TYPE, TIME_OBS, OBS_ID,
AIRCRAFT_TYPE, LONGITUDE, LATITUDE, FLIGHT_LEVEL, TEMPERATURE,
WIND_SPEED, WIND_DIR, HORZ_VISIBILITY, WEATHER_GROUP, NUM_LAYER,
NCPIREP_LAYER_DATA, HAZARD_TYPE, TURB_INTEN, TURB_TYPE,
TURB_FREQ, ICE_INTEN, ICE_TYPE, SKY_COVER1, SKY_COVER2, TURB_BASE_HEIGHT,
TURB_TOP_HEIGHT, ICE_BASE_HEIGHT, ICE_TOP_HEIGHT, SKY_BASE_HEIGHT, SKY_TOP_HEIGHT,
SUSPECT_TIME_FLAG};
public static final String ALL_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (String s : ALL_PARAMS) {
if (!first) {
sb.append(", ");
} else {
first = false;
}
sb.append(s);
}
ALL_PARAMS_LIST = sb.toString();
}
private NcPirepDao dao;
private PointDataDescription description;
public NcPirepPointDataTransform() {
try {
this.dao = new NcPirepDao("ncpirep");
this.description = dao.getPointDataDescription();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public PluginDataObject[] toPointData(PluginDataObject[] pdo) {
System.out.println("===============>toPointData");
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof NcPirepRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
if (pdc == null) {
pdc = PointDataContainer.build(this.description);
pointMap.put(f, pdc);
}
NcPirepRecord npr = (NcPirepRecord) p;
PointDataView pdv = buildView(pdc, npr);
npr.setPointDataView(pdv);
}
}
return pdo;
}
private PointDataView buildView(PointDataContainer container,
NcPirepRecord record) {
PointDataView pdv = container.append();
pdv.setString(STATION_ID, record.getStationId());
Dimension [] dims = description.dimensions;
int maxLayer = -1;
for(Dimension d : dims) {
if ("maxLayer".equals(d.getDimensionName())) {
maxLayer = d.getDimensionLength();
}
}
if (record.getCorIndicator() != null) {
pdv.setString(CORRECTION_CODE, record.getCorIndicator());
}else{
pdv.setString(CORRECTION_CODE," ");
}
pdv.setFloat(LATITUDE, (float) record.getLatitude());
pdv.setFloat(LONGITUDE, (float) record.getLongitude());
pdv.setFloat(FLIGHT_LEVEL, record.getFlightLevel());
pdv.setLong(TIME_OBS, record.getDataTime().getRefTime().getTime());
//pdv.setString(DATAURI, record.getDataURI());
pdv.setString(REPORT_TYPE, "PIREP"); //record.getReportType());
pdv.setFloat(TEMPERATURE,(float) record.getTemp());
pdv.setFloat(WIND_DIR, (float) record.getWindDirection());
pdv.setFloat(WIND_SPEED, (float) record.getWindSpeed());
pdv.setString(OBS_TEXT, record.getObsText());
pdv.setInt(HORZ_VISIBILITY, record.getHorzVisibility());
pdv.setString(WEATHER_GROUP, record.getWeatherGroup());
pdv.setString(SUSPECT_TIME_FLAG, record.getSuspectTimeFlag());
if (record.getAncPirepData() != null) {
Iterator<NcPirepLayerData> pldIterator = record.getAncPirepData().iterator();
int i = 0;
int iTb = -1;
int iIc = -1;
int iSk = -1;
while (pldIterator.hasNext()) {
// TODO: storing duplicate info like this, needs to be resolved
NcPirepLayerData pld = pldIterator.next();
if (pld.getLayerType() != null && i < maxLayer) {
StringBuffer pldBuffer = new StringBuffer();
pldBuffer.append(pld.getLayerType());
// //may not need in cave
// if (pld.getBaseLayerHeight() != null){
// pldBuffer.append(" ");
// pldBuffer.append(pld.getBaseLayerHeight().toString());
// }
pdv.setString(NCPIREP_LAYER_DATA, pldBuffer.toString(), i);
/* +++ end of Needed? +++ */
if (pld.getLayerType() != null) {
pdv.setString(HAZARD_TYPE, pld.getLayerType(), i);
}
if (pld.getLayerType().equalsIgnoreCase("TURBC"))
iTb ++;
else if (pld.getLayerType().equalsIgnoreCase("ICING"))
iIc ++;
else if (pld.getLayerType().equalsIgnoreCase("CLOUD"))
iSk ++;
if (pld.getTurbInten() != null) {
pdv.setString(TURB_INTEN, pld.getTurbInten(), iTb);
}
if (pld.getTurbInten() != null) {
pdv.setString(TURB_TYPE, pld.getTurbType(), iTb);
}
if (pld.getTurbInten() != null) {
pdv.setString(TURB_FREQ, pld.getTurbFreq(), iTb);
}
if (pld.getIceInten() != null) {
pdv.setString(ICE_INTEN, pld.getIceInten(), iIc);
}
if (pld.getIceType() != null) {
pdv.setString(ICE_TYPE, pld.getIceType(), iIc);
}
if (pld.getSkyInten1() != null) {
pdv.setString(SKY_COVER1, pld.getSkyInten1(), iSk);
}
if (pld.getSkyInten2() != null) {
pdv.setString(SKY_COVER2, pld.getSkyInten2(), iSk);
}
if (pld.getTurbBaseHeight() != null) {
pdv.setInt(TURB_BASE_HEIGHT, pld.getTurbBaseHeight(), iTb);
}
if (pld.getTurbTopHeight() != null) {
pdv.setInt(TURB_TOP_HEIGHT, pld.getTurbBaseHeight(), iTb);
}
if (pld.getIceBaseHeight() != null) {
pdv.setInt(ICE_BASE_HEIGHT, pld.getIceBaseHeight(), iIc);
}
if (pld.getIceTopHeight() != null) {
pdv.setInt(ICE_TOP_HEIGHT, pld.getIceTopHeight(), iIc);
}
if (pld.getSkyBaseHeight() != null) {
pdv.setInt(SKY_BASE_HEIGHT, pld.getSkyBaseHeight(), iSk);
}
if (pld.getSkyTopHeight() != null) {
pdv.setInt(SKY_TOP_HEIGHT, pld.getSkyTopHeight(), iSk);
}
}
i++;
}
pdv.setInt("numLayer", i);
}
return pdv;
}
public static NcPirepRecord toNcPirepRecord(PointDataView pdv) {
NcPirepRecord npr = new NcPirepRecord();
npr.setObsId(pdv.getInt(OBS_ID));
npr.setCorIndicator(pdv.getString(CORRECTION_CODE));
npr.setDataTime(new DataTime(new Date(pdv.getNumber(TIME_OBS)
.longValue())));
AircraftObsLocation loc = new AircraftObsLocation(
pdv.getString(STATION_ID));
Double lat = pdv.getNumber(LATITUDE).doubleValue();
Double lon = pdv.getNumber(LONGITUDE).doubleValue();
loc.setLocation(lat, lon);
loc.setFlightLevel(pdv.getNumber(FLIGHT_LEVEL).intValue());
npr.setLocation(loc);
npr.setDataURI(pdv.getString(DATAURI));
npr.setObsText(pdv.getString(OBS_TEXT));
npr.setReportType("PIREP"); //pdv.getString(REPORT_TYPE));
npr.setTemp(pdv.getNumber(TEMPERATURE).floatValue());
npr.setHorzVisibility(pdv.getNumber(HORZ_VISIBILITY).intValue());
npr.setWeatherGroup(pdv.getString(WEATHER_GROUP));
npr.setWindDirection(pdv.getNumber(WIND_DIR).floatValue());
npr.setWindSpeed(pdv.getNumber(WIND_SPEED).floatValue());
Number numLayer = pdv.getNumber("numLayer");
// Number[] levels = pdv.getNumberAllLevels(BASE_LAYER_HEIGHT);
String[] pldLayerType = pdv.getStringAllLevels(HAZARD_TYPE);
String[] pldTurbInten = pdv.getStringAllLevels(TURB_INTEN);
String[] pldIceInten = pdv.getStringAllLevels(ICE_INTEN);
String[] pldSkyInten1 = pdv.getStringAllLevels(SKY_COVER1);
String[] pldSkyInten2 = pdv.getStringAllLevels(SKY_COVER2);
int[] pldTurbBaseHeight = pdv.getIntAllLevels(TURB_BASE_HEIGHT);
int[] pldTurbTopHeight = pdv.getIntAllLevels(TURB_TOP_HEIGHT);
int[] pldIceBaseHeight = pdv.getIntAllLevels(ICE_BASE_HEIGHT);
int[] pldIceTopHeight = pdv.getIntAllLevels(ICE_TOP_HEIGHT);
int[] pldSkyBaseHeight = pdv.getIntAllLevels(SKY_BASE_HEIGHT);
int[] pldSkyTopHeight = pdv.getIntAllLevels(SKY_BASE_HEIGHT);
Set<NcPirepLayerData> pldList = new HashSet<NcPirepLayerData>();
if (numLayer !=null && numLayer.intValue() > 0) {
for (int i = 0; i < numLayer.intValue(); i ++) {
NcPirepLayerData ncPirepLayerData = new NcPirepLayerData();
ncPirepLayerData.setLayerType(pldLayerType[i]);
ncPirepLayerData.setTurbInten(pldTurbInten[i]);
ncPirepLayerData.setIceInten(pldIceInten[i]);
ncPirepLayerData.setSkyInten1(pldSkyInten1[i]);
ncPirepLayerData.setSkyInten2(pldSkyInten2[i]);
ncPirepLayerData.setTurbBaseHeight(pldTurbBaseHeight[i]);
ncPirepLayerData.setTurbTopHeight(pldTurbTopHeight[i]);
ncPirepLayerData.setIceBaseHeight(pldIceBaseHeight[i]);
ncPirepLayerData.setIceTopHeight(pldIceTopHeight[i]);
ncPirepLayerData.setSkyBaseHeight(pldSkyBaseHeight[i]);
ncPirepLayerData.setSkyTopHeight(pldSkyTopHeight[i]);
// //may not need in cave
// if ((levels[i].intValue()) != PointDataDescription.FILL_VALUE_INT) {
// ncPirepLayerData.setBaseLayerHeight(levels[i].intValue());
// }
pldList.add(ncPirepLayerData);
}
}
npr.setAncPirepData(pldList);
return npr;
}
public static NcPirepRecord[] toNcPirepRecords(PointDataContainer container) {
List<NcPirepRecord> records = new ArrayList<NcPirepRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
records.add(toNcPirepRecord(pdv));
}
return records.toArray(new NcPirepRecord[records.size()]);
}
}

View file

@ -0,0 +1,820 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep;
/**
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
//import gov.noaa.nws.ncep.edex.plugin.ncpirep.common.NcPirepLayerData;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import javax.measure.quantity.Angle;
import javax.measure.quantity.Length;
import javax.measure.quantity.Pressure;
import javax.measure.quantity.Temperature;
import javax.measure.quantity.Velocity;
import javax.measure.unit.NonSI;
import javax.measure.unit.SI;
import javax.measure.unit.Unit;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.spatial.AircraftObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.vividsolutions.jts.geom.Geometry;
/**
* NcPirepRecord is the Data Access component for pirep observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 20110421 F. J. Yen Initial creation from Raytheon's pirep.
* Change temp, windSpeed from Double to Float.
* Change windDirection from Integer to Float
* 08/30/2011 286 qzhou Use IDecoderConstantsN.INTEGER_MISSING instead -9999 in visibility.
* 08/31/2011 286 qzhou Created project and moved this from ~edex.plugin.pirep
* 09/19/2011 286 Q.Zhou Changed reportType to string,
* </pre>
*
* @author jkorman
* @version 1.0
*/
@Entity
@Table(name = "ncpirep", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcPirepRecord extends PluginDataObject implements ISpatialEnabled,
IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
public static final Unit<Temperature> TEMPERATURE_UNIT = SI.CELSIUS;
public static final Unit<Length> ALTITUDE_UNIT = NonSI.FOOT;
public static final Unit<Velocity> WIND_SPEED_UNIT = NonSI.KNOT;
public static final Unit<Angle> WIND_DIR_UNIT = NonSI.DEGREE_ANGLE;
public static final Unit<Pressure> PRESSURE_UNIT = SI.PASCAL;
public static final Unit<Angle> LOCATION_UNIT = NonSI.DEGREE_ANGLE;
private static final HashMap<String, String> PARM_MAP = new HashMap<String, String>();
private static final HashMap<String, Integer> ICING_MAP = new HashMap<String, Integer>();
private static final HashMap<String, Integer> TURB_MAP = new HashMap<String, Integer>();
static {
PARM_MAP.put("T", SFC_TEMP);
PARM_MAP.put("WS", SFC_WNDSPD);
PARM_MAP.put("WD", SFC_WNDDIR);
PARM_MAP.put("NLAT", STA_LAT);
PARM_MAP.put("NLON", STA_LON);
PARM_MAP.put("FLT_LVL", UA_FLTLVL);
PARM_MAP.put("ICT", UA_ICETYPE);
PARM_MAP.put("ICI", UA_ICEINTENSE);
PARM_MAP.put("TBF", UA_TURBFREQ);
PARM_MAP.put("TBI", UA_TURBINTENSE);
PARM_MAP.put("TOP_HGT", UA_TOPHGT);
PARM_MAP.put("BOT_HGT", UA_BOTHGT);
ICING_MAP.put("", new Integer(0));
ICING_MAP.put("NEG", new Integer(1));
ICING_MAP.put("TRACE", new Integer(2));
ICING_MAP.put("TRACELGT", new Integer(3));
ICING_MAP.put("LGT", new Integer(4));
ICING_MAP.put("LGTMOD", new Integer(5));
ICING_MAP.put("MOD", new Integer(6));
ICING_MAP.put("MODSEV", new Integer(7));
ICING_MAP.put("SEV", new Integer(8));
TURB_MAP.put("", new Integer(0));
TURB_MAP.put("NEG", new Integer(1));
TURB_MAP.put("SMOOTHLGT", new Integer(2));
TURB_MAP.put("LGT", new Integer(3));
TURB_MAP.put("LGTMOD", new Integer(4));
TURB_MAP.put("MOD", new Integer(5));
TURB_MAP.put("MODSEV", new Integer(6));
TURB_MAP.put("SEV", new Integer(7));
TURB_MAP.put("EXTRM", new Integer(8));
}
@Transient
private NcPirepLayerData maxPirepLayerData = null;
@Transient
private boolean display = true;
@Transient
@XmlAttribute
@DynamicSerializeElement
private Integer obsId;
// Time of the observation.
@Transient
@XmlAttribute
@DynamicSerializeElement
private Calendar timeObs;
// Time of the observation to the nearest hour.
@Column
@XmlElement
@DynamicSerializeElement
private Calendar refHour;
//
@Column(length = 8)
@DataURI(position = 1)
@XmlAttribute
@DynamicSerializeElement
private String reportType;
// Text of the WMO header
@Transient
@XmlElement
@DynamicSerializeElement
private String wmoHeader;
@Transient
@DynamicSerializeElement
@XmlElement
private String suspectTimeFlag;
// Correction indicator from wmo header
@Column(length = 8)
@DataURI(position = 2)
@XmlElement
@DynamicSerializeElement
private String corIndicator;
@Transient
@XmlElement
@DynamicSerializeElement
private String aircraftType;
// Observation air temperature in degrees Celsius, if not converted.
// Observation air temperature in degrees Kelvin.
// Decimal(5,2)
@Transient
@XmlElement
@DynamicSerializeElement
// private Double temp;
private Float temp;
// Observation wind direction in angular degrees. Integer
@Transient
@XmlElement
@DynamicSerializeElement
// private Integer windDirection;
private Float windDirection;
// Observation wind speed in knots, if not converted.
// Observation wind speed in meters per second.
// Decimal(5,2)
@Transient
@XmlElement
@DynamicSerializeElement
// private Double windSpeed;
private Float windSpeed;
@Transient
@XmlElement
@DynamicSerializeElement
// private Integer horzVisibility;
private Integer horzVisibility = IDecoderConstantsN.INTEGER_MISSING; //-9999
@Transient
@XmlElement
@DynamicSerializeElement
private String obsText;
// @Column(length = 16)
@Transient
@XmlElement
@DynamicSerializeElement
private String weatherGroup;
@DynamicSerializeElement
@XmlElement
// @OneToMany(cascade = CascadeType.ALL, mappedBy = "parent", fetch = FetchType.EAGER)
// private Set<NcPirepLayerData> ancPirepData;
@Transient
private Set<NcPirepLayerData> ancPirepData = new HashSet<NcPirepLayerData>();
@Embedded
@DataURI(position = 3, embedded = true)
@XmlElement
@DynamicSerializeElement
private AircraftObsLocation location;
@Embedded
private PointDataView pdv;
/**
*
*/
public NcPirepRecord() {
}
/**
* Constructor for DataURI construction through base class. This is used by
* the notification service.
*
* @param uri
* A data uri applicable to this class.
* @param tableDef
* The table definitions for this class.
*/
public NcPirepRecord(String uri) {
super(uri);
}
public Integer getObsId() {
return obsId;
}
public void setObsId(Integer obsId) {
this.obsId = obsId;
}
/**
* @return the wmoHeader
*/
public String getWmoHeader() {
return wmoHeader;
}
/**
* @param wmoHeader
* the wmoHeader to set
*/
public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader;
}
/**
* Get the report correction indicator.
*
* @return The corIndicator
*/
public String getCorIndicator() {
return corIndicator;
}
/**
* Set the report correction indicator.
*
* @param corIndicator
* The corIndicator.
*/
public void setCorIndicator(String corIndicator) {
this.corIndicator = corIndicator;
}
/**
* Get the report data for this observation.
*
* @return The Report data.
*/
public String getReportData() {
String s = null;
if (messageData instanceof String) {
s = (String) messageData;
}
return s;
}
/**
* Set the report data for this observation.
*
* @param reportData
* The Report data.
*/
public void setReportData(String reportData) {
messageData = reportData;
}
/**
* Get this observation's geometry.
*
* @return The geometry for this observation.
*/
public Geometry getGeometry() {
return location.getGeometry();
}
/**
* Get the geometry latitude.
*
* @return The geometry latitude.
*/
public double getLatitude() {
return location.getLatitude();
}
/**
* Get the geometry longitude.
*
* @return The geometry longitude.
*/
public double getLongitude() {
return location.getLongitude();
}
/**
* Is the location defined in the spatial tables.
*
* @return Is the location defined in the spatial tables.
*/
public Boolean getLocationDefined() {
return location.getLocationDefined();
}
/**
* Get the station identifier for this observation.
*
* @return the stationId
*/
public String getStationId() {
return location.getStationId();
}
/**
// * Get the elevation, in meters, of the observing platform or location.
* Get the elevation, in feet, of the observing platform or location.
*
// * @return The observation elevation, in meters.
* @return The observation elevation, in feet.
*/
public Integer getFlightLevel() {
return location.getFlightLevel();
}
/**
* @return the reportType
*/
public String getReportType() {
return reportType;
}
/**
* @param reportType
* the reportType to set
*/
public void setReportType(String reportType) {
this.reportType = reportType;
}
/**
* @return the timeObs
*/
public Calendar getTimeObs() {
if (this.dataTime == null)
return null;
return this.dataTime.getRefTimeAsCalendar();
}
/**
* @param timeObs
* the timeObs to set
*/
public void setTimeObs(Calendar timeObs) {
this.timeObs = timeObs;
}
/**
* @return the refHour
*/
public Calendar getRefHour() {
return refHour;
}
/**
* @param refHour
* the refHour to set
*/
public void setRefHour(Calendar refHour) {
this.refHour = refHour;
}
public String getSuspectTimeFlag() {
return suspectTimeFlag;
}
public void setSuspectTimeFlag(String suspectTimeFlag) {
this.suspectTimeFlag = suspectTimeFlag;
}
/**
* @param aircraftType
* the aircraftType to set
*/
public void setAircraftType(String aircraftType) {
this.aircraftType = aircraftType;
}
/**
* @return the aircraftType
*/
public String getAircraftType() {
return aircraftType;
}
/**
* @return the temp
*/
// public Double getTemp() {
public float getTemp() {
return temp;
}
/**
* @param temp
* the temp to set
*/
// public void setTemp(Double temp) {
public void setTemp(float temp) {
this.temp = temp;
}
/**
* @return the windDirection
*/
// public Integer getWindDirection() {
public float getWindDirection() {
return windDirection;
}
/**
* @param windDirection
* the windDirection to set
*/
// public void setWindDirection(Integer windDirection) {
public void setWindDirection(float windDirection) {
this.windDirection = windDirection;
}
/**
* @return the windspeed
*/
// public Double getWindSpeed() {
public float getWindSpeed() {
return windSpeed;
}
/**
* @param windspeed
* the windspeed to set
*/
// public void setWindSpeed(Double windSpeed) {
public void setWindSpeed(float windSpeed) {
this.windSpeed = windSpeed;
}
/**
* @return the horzVisibility
*/
public Integer getHorzVisibility() {
return horzVisibility;
}
/**
* @param horzVisibility
* the horzVisibility to set
*/
public void setHorzVisibility(Integer horzVisibility) {
this.horzVisibility = horzVisibility;
}
/**
* @return the obsText
*/
public String getObsText() {
return obsText;
}
/**
* @param obsText the obsText to set
*/
public void setObsText(String obsText) {
this.obsText = obsText;
}
/**
* @return the weatherGroup
*/
public String getWeatherGroup() {
return weatherGroup;
}
/**
* @param weatherGroup
* the weatherGroup to set
*/
public void setWeatherGroup(String weatherGroup) {
this.weatherGroup = weatherGroup;
}
/**
* @return the ancPirepData
*/
public Set<NcPirepLayerData> getAncPirepData() {
return ancPirepData;
}
/**
* @param ancPirepData
* the ancPirepData to set
*/
public void setAncPirepData(Set<NcPirepLayerData> ancPirepData) {
this.ancPirepData = ancPirepData;
}
/**
*
* @param cloud
*/
public void addLayer(NcPirepLayerData layer) {
layer.setParent(this);
if (ancPirepData == null) {
ancPirepData = new HashSet<NcPirepLayerData>();
}
ancPirepData.add(layer);
}
@Override
public void setDataURI(String dataURI) {
identifier = dataURI;
}
/**
* Get the IDecoderGettable reference for this record.
*
* @return The IDecoderGettable reference for this record.
*/
@Override
public IDecoderGettable getDecoderGettable() {
return this;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public String getString(String paramName) {
String retData = null;
if ("STA".matches(paramName)) {
retData = getStationId();
} else if ("TEXT".equals(paramName)) {
retData = obsText;
}
return retData;
}
/**
* Get the value and units of a named parameter within this observation.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return An Amount with value and units. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Amount getValue(String paramName) {
Amount a = null;
String pName = PARM_MAP.get(paramName);
if (display) {
if (SFC_TEMP.equals(pName) && (temp != null)) {
a = new Amount(temp, TEMPERATURE_UNIT);
} else if (SFC_WNDSPD.equals(pName) && (windSpeed != null)) {
a = new Amount(windSpeed, WIND_SPEED_UNIT);
} else if (SFC_WNDDIR.equals(pName) && (windDirection != null)) {
a = new Amount(windDirection, WIND_DIR_UNIT);
} else if (STA_LAT.equals(pName)) {
a = new Amount(this.getLatitude(), LOCATION_UNIT);
} else if (STA_LON.equals(pName)) {
a = new Amount(this.getLongitude(), LOCATION_UNIT);
} else if (UA_FLTLVL.equals(pName) && getFlightLevel() != null) {
a = new Amount(this.getFlightLevel().intValue(), ALTITUDE_UNIT);
// if used, need to modify raytheon code
// } else if (UA_TOPHGT.equals(pName) && maxPirepLayerData != null
// && maxPirepLayerData.getTopLayerHeight() != null) {
// a = new Amount(maxPirepLayerData.getTopLayerHeight().intValue(), ALTITUDE_UNIT);
// } else if (UA_BOTHGT.equals(pName) && maxPirepLayerData != null
// && maxPirepLayerData.getBaseLayerHeight() != null) {
// a = new Amount(maxPirepLayerData.getBaseLayerHeight().intValue(), ALTITUDE_UNIT);
}
}
return a;
}
/**
* Get the value of a parameter that is represented as a String.
*
* @param paramName
* The name of the parameter value to retrieve.
* @return The String value of the parameter. If the parameter is unknown, a
* null reference is returned.
*/
@Override
public Collection<Amount> getValues(String paramName) {
return null;
}
@Override
public String[] getStrings(String paramName) {
if ("ICI".matches(paramName)) {
int rank = -1;
String iceIntensity = null;
for (NcPirepLayerData layer : this.ancPirepData) {
String intensity = "";
if (layer.getLayerType().equals(NcPirepLayerData.LAYER_TYP_ICING)) {
if(layer.getIceInten() != null) {
intensity = layer.getIceInten();
}
// if (layer.getSecondValue() != null) {
// intensity += layer.getSecondValue();
// }
if(ICING_MAP.get(intensity).intValue() > rank) {
rank = ICING_MAP.get(intensity).intValue();
iceIntensity = intensity;
maxPirepLayerData = layer;
}
}
}
if (iceIntensity != null) {
String[] maxIntensity = {iceIntensity};
return maxIntensity;
} else {
display = false;
}
} else if ("ICT".matches(paramName) && maxPirepLayerData != null) {
String[] maxType = {maxPirepLayerData.getIceType()};
return maxType;
} else if ("TBI".matches(paramName)) {
int rank = -1;
String turbIntensity = null;
for (NcPirepLayerData layer : this.ancPirepData) {
String intensity = "";
if (layer.getLayerType().equals(NcPirepLayerData.LAYER_TYP_TURBC)) {
if(layer.getTurbInten() != null) {
intensity = layer.getTurbInten();
}
// if (layer.getSecondValue() != null) {
// intensity += layer.getSecondValue();
// }
if(TURB_MAP.get(intensity).intValue() > rank) {
rank = TURB_MAP.get(intensity).intValue();
turbIntensity = intensity;
maxPirepLayerData = layer;
}
}
}
if (turbIntensity != null) {
String[] maxIntensity = {turbIntensity};
return maxIntensity;
} else {
display = false;
}
} else if ("TBT".matches(paramName) && maxPirepLayerData != null) {
String[] maxType = {maxPirepLayerData.getTurbType()};
return maxType;
} else if ("TBF".matches(paramName) && maxPirepLayerData != null) {
//Turbulence Frequency Types do not get stored.
}
return null;
}
@Override
public AircraftObsLocation getSpatialObject() {
return location;
}
public AircraftObsLocation getLocation() {
return location;
}
public void setLocation(AircraftObsLocation location) {
this.location = location;
}
@Override
public String getMessageData() {
return getObsText();
}
/**
* Returns the hashCode for this object. This implementation
* returns the hashCode of the generated dataURI.
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((getDataURI() == null) ? 0 : getDataURI().hashCode());
return result;
}
/**
* Checks if this record is equal to another by checking the
* generated dataURI.
* @param obj
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NcPirepRecord other = (NcPirepRecord) obj;
if (getDataURI() == null) {
if (other.getDataURI() != null) {
return false;
}
} else if (!getDataURI().equals(other.getDataURI()))
return false;
return true;
}
@Override
public Date getPersistenceTime() {
return this.dataTime.getRefTime();
}
@Override
public void setPersistenceTime(Date persistTime) {
}
@Override
public Integer getHdfFileId() {
return null;
}
@Override
public void setHdfFileId(Integer hdfFileId) {
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView()
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon
* .uf.common.pointdata.PointDataView)
*/
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
}

View file

@ -0,0 +1,132 @@
package gov.noaa.nws.ncep.common.dataplugin.ncpirep.dao;
/**
* This software was modified from Raytheon's pirep plugin by
* NOAA/NWS/NCEP/NCO to order to output point data in HDF5.
**/
//uf.common.status.IUFStatusHandler cannot be resolved. It is indirectly
//referenced from required .class files
import gov.noaa.nws.ncep.common.dataplugin.ncpirep.NcPirepRecord;
import java.util.List;
import javax.xml.bind.JAXBException;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
/**
* Set of DAO methods for Surface Observation data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 04/28/2011 F. J. Yen Initial creation from pirep
* 08/31/2011 286 qzhou Moved this from ~edex.plugin.pirep
* </pre>
*
* @author qzhou
* @version 1.0
*/
public class NcPirepDao extends PointDataPluginDao<NcPirepRecord> {
private PointDataDescription pdd;
/**
* Creates a new NcPirepDao
*
* @throws PluginException
*/
public NcPirepDao(String pluginName) throws PluginException {
super(pluginName);
}
@Override
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
return null;
}
/**
* Retrieves an NcPirep report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public NcPirepRecord queryByDataURI(String dataURI) {
NcPirepRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((obs != null) && (obs.size() > 0)) {
report = (NcPirepRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the sfcobs table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.ncpirep where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
@Override
public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime" };
}
@Override
public NcPirepRecord newObject() {
return new NcPirepRecord();
}
@Override
public String getPointDataFileName(NcPirepRecord p) {
return "ncpirep.h5";
}
/*
@Override
public String[] getParameters(File file) throws StorageException,
FileNotFoundException {
try {
// This should be faster than hitting the datastore.
return getPointDataDescription().getParameterNames();
} catch (Exception e) {
// let super handle it
return super.getParameters(file);
}
}
*/
public PointDataDescription getPointDataDescription() throws JAXBException {
if (pdd == null) {
pdd = PointDataDescription.fromStream(this.getClass()
.getResourceAsStream("/res/pointdata/ncpirep.xml"));
}
return pdd;
}
}

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.h5scd</name>
<name>gov.noaa.nws.ncep.common.dataplugin.ncscd</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Scd Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.h5scd
Bundle-Name: NcScd Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.ncscd
Bundle-Version: 1.0.0.qualifier
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.common.pointdata;bundle-version="1.12.1174",
com.raytheon.uf.edex.pointdata;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-RegisterBuddy: com.raytheon.edex.common, com.raytheon.uf.common.serialization
Import-Package: com.raytheon.edex.exception,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
@ -27,5 +28,6 @@ Import-Package: com.raytheon.edex.exception,
javax.measure.quantity,
javax.measure.unit,
javax.persistence
Export-Package: gov.noaa.nws.ncep.common.dataplugin.h5scd,
gov.noaa.nws.ncep.common.dataplugin.h5scd.dao
Export-Package: gov.noaa.nws.ncep.common.dataplugin.ncscd,
gov.noaa.nws.ncep.common.dataplugin.ncscd.dao
Bundle-ActivationPolicy: lazy

View file

@ -0,0 +1 @@
gov.noaa.nws.ncep.common.dataplugin.ncscd.NcScdRecord

View file

@ -0,0 +1,6 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.ncscd">
<!-- property name="component.name" value="plugin-ncscd" /-->
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -1,6 +1,6 @@
/**
*
* H5ScdRecord
* NcScdRecord
*
* This java class performs the mapping to the database tables for SCD.
*
@ -16,6 +16,7 @@
* 06/2011 41 F. J. Yen Convert SCD to HDF5 (OB11.5). Changed type
* of suspectTimeFlag from Boolean to String
* since undefined in PointDataDescription.
* 09/2011 457 S. Gurung Renamed H5 to Nc and h5 to nc
* </pre>
*
* @author T.Lee
@ -23,7 +24,7 @@
*
*/
package gov.noaa.nws.ncep.common.dataplugin.h5scd;
package gov.noaa.nws.ncep.common.dataplugin.ncscd;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
@ -53,17 +54,18 @@ import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.geospatial.ISpatialObject;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
@Entity
@Table(name = "h5scd", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@Table(name = "ncscd", uniqueConstraints = { @UniqueConstraint(columnNames = { "dataURI" }) })
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
public class NcScdRecord extends PluginDataObject implements ISpatialEnabled, IDecoderGettable, IPointData, IPersistable {
private static final long serialVersionUID = 1L;
@ -72,21 +74,21 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
public static final Unit<Length> PRECIP_UNIT = NonSI.INCH;
/** Report type */
@Transient
@XmlElement
@DynamicSerializeElement
@XmlElement
@DynamicSerializeElement
@Column
@DataURI(position = 1)
private String reportType;
/** Station ID */
@Column(length=32)
@DataURI(position=1)
@XmlElement
@DynamicSerializeElement
private String stationID;
@Embedded
@DataURI(position = 2, embedded = true)
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
/** Bulletin correction */
@Column(length=8)
@DataURI(position=2)
@DataURI(position=3)
@XmlElement
@DynamicSerializeElement
private String corIndicator;
@ -99,7 +101,7 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
/** Bulletin issuance time */
@Column
@DataURI(position=3)
@DataURI(position=4)
@XmlElement
@DynamicSerializeElement
private Calendar issueTime;
@ -219,8 +221,8 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
* Default constructor
*
*/
public H5ScdRecord(){
this.stationID = null;
public NcScdRecord(){
this.location = null;
this.issueTime = null;
this.corIndicator = "REG";
this.obsTime = null;
@ -249,7 +251,7 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
*
* @param uri The dataURI
*/
public H5ScdRecord(String uri) {
public NcScdRecord(String uri) {
super(uri);
}
@ -266,13 +268,35 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
this.reportType = reportType;
}
public String getStationID(){
return stationID;
}
public String getStationId() {
return location.getStationId();
}
public void setStationID(String stationID){
this.stationID=stationID;
@Override
public SurfaceObsLocation getSpatialObject() {
return location;
}
public SurfaceObsLocation getLocation() {
return location;
}
public void setLocation( SurfaceObsLocation obsLoc ){
this.location = obsLoc;
}
public double getLatitude() {
return location.getLatitude();
}
public double getLongitude() {
return location.getLongitude();
}
public Integer getElevation() {
return location.getElevation();
}
public Calendar getIssueTime(){
return issueTime;
}
@ -495,10 +519,4 @@ public class H5ScdRecord extends PluginDataObject implements ISpatialEnabled, ID
// TODO Auto-generated method stub
return null;
}
@Override
public ISpatialObject getSpatialObject() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,5 +1,5 @@
/**
* H5ScdDao
* NcScdDao
*
* This java class defines data access object for SCD data.
*
@ -9,6 +9,7 @@
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06/30/2011 F. J. Yen Renamed and converted ScdDao to HDF5.
* 09/13/2011 457 S. Gurung Renamed H5 to Nc and h5 to nc
*
* </pre>
*
@ -17,7 +18,7 @@
* @version 1.0
*/
package gov.noaa.nws.ncep.common.dataplugin.h5scd.dao;
package gov.noaa.nws.ncep.common.dataplugin.ncscd.dao;
import java.io.InputStream;
import java.util.ArrayList;
@ -37,19 +38,20 @@ import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
import com.raytheon.uf.edex.pointdata.PointDataDbDescription;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
import gov.noaa.nws.ncep.common.dataplugin.h5scd.H5ScdRecord;
public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
import gov.noaa.nws.ncep.common.dataplugin.ncscd.NcScdRecord;
public class NcScdDao extends PointDataPluginDao<NcScdRecord> {
/** The station dao */
private ObStationDao obDao = new ObStationDao();
/**
* Creates a new H5scdDao
* Creates a new NcScdDao
*
* @throws PluginException
*/
public H5ScdDao(String pluginName) throws PluginException {
public NcScdDao(String pluginName) throws PluginException {
super(pluginName);
}
@ -72,7 +74,7 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
// }
stationList.clear();
DatabaseQuery query = new DatabaseQuery(H5ScdRecord.class);
DatabaseQuery query = new DatabaseQuery(NcScdRecord.class);
query.addQueryParam("location.stationId", stationNames,
QueryParam.QueryOperand.IN);
return queryByCriteria(query);
@ -88,34 +90,34 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
// //icaos.add((String)station.getIdentifier());
// }
DatabaseQuery query = new DatabaseQuery(H5ScdRecord.class, count);
DatabaseQuery query = new DatabaseQuery(NcScdRecord.class, count);
query.addQueryParam("location.stationId", icaos,
QueryParam.QueryOperand.IN);
return queryByCriteria(query);
}
/**
* Retrieves an h5scd report using the datauri .
* Retrieves an ncscd report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public H5ScdRecord queryByDataURI(String dataURI) {
H5ScdRecord report = null;
List<?> h5scd = null;
public NcScdRecord queryByDataURI(String dataURI) {
NcScdRecord report = null;
List<?> ncscd = null;
try {
h5scd = queryBySingleCriteria("dataURI", dataURI);
ncscd = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if ((h5scd != null) && (h5scd.size() > 0)) {
report = (H5ScdRecord) h5scd.get(0);
if ((ncscd != null) && (ncscd.size() > 0)) {
report = (NcScdRecord) ncscd.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the h5scd table.
* Queries for to determine if a given data uri exists on the ncscd table.
*
* @param dataUri
* The DataURI to find.
@ -124,7 +126,7 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.h5scd where datauri='"
String sql = "select datauri from awips.ncscd where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
@ -146,13 +148,13 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
}
@Override
public String getPointDataFileName(H5ScdRecord p) {
return "h5scd.h5";
public String getPointDataFileName(NcScdRecord p) {
return "ncscd.h5";
}
@Override
public H5ScdRecord newObject() {
return new H5ScdRecord();
public NcScdRecord newObject() {
return new NcScdRecord();
}
@Override
@ -161,9 +163,9 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
try {
hdf5DataDescription = PointDataDescription.fromStream(this
.getClass().getResourceAsStream(
"/res/pointdata/h5scd.xml"));
"/res/pointdata/ncscd.xml"));
} catch (JAXBException e) {
logger.error("Unable to load h5scd Point Data Description", e);
logger.error("Unable to load ncscd Point Data Description", e);
}
}
return hdf5DataDescription;
@ -180,7 +182,7 @@ public class H5ScdDao extends PointDataPluginDao<H5ScdRecord> {
public PointDataDbDescription getPointDataDbDescription() {
if (dbDataDescription == null) {
InputStream stream = this.getClass().getResourceAsStream(
"/res/pointdata/h5scddb.xml");
"/res/pointdata/ncscddb.xml");
if (stream != null) {
try {
dbDataDescription = PointDataDbDescription

View file

@ -2,7 +2,7 @@
* This software was modified from Raytheon's obs decoder plugin by NOAA/NWS/
* NCEP/NCO in order to output point data in HDF5,
**/
package gov.noaa.nws.ncep.common.dataplugin.h5scd.dao;
package gov.noaa.nws.ncep.common.dataplugin.ncscd.dao;
import java.io.File;
import java.util.ArrayList;
@ -11,17 +11,19 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import gov.noaa.nws.ncep.common.dataplugin.h5scd.H5ScdRecord;
import gov.noaa.nws.ncep.common.dataplugin.h5scd.dao.H5ScdDao;
import gov.noaa.nws.ncep.common.dataplugin.ncscd.NcScdRecord;
import gov.noaa.nws.ncep.common.dataplugin.ncscd.dao.NcScdDao;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
/**
* Provides a transform from H5ScdRecords to PointDataContainer and vice versa.
* Provides a transform from NcScdRecords to PointDataContainer and vice versa.
*
* <pre>
*
@ -29,6 +31,8 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 06/29/2011 F. J. Yen Initial creation
* 09/08/2011 294 G. Hull Use SurfaceObsLocation to set lat/lon
* 09/13/2011 457 S. Gurung Renamed H5 to Nc and h5 to nc
*
* </pre>
*
@ -36,12 +40,22 @@ import com.raytheon.uf.edex.decodertools.time.TimeTools;
* @version 1.0
*/
public class H5ScdPointDataTransform {
public class NcScdPointDataTransform {
private static final String STATION_NAME = "stationName";
private static final String STATION_ID = "stationId";
private static final String REPORT_TYPE = "reportType";
// STATION_NAME, STATION_ID, AUTO_STATION_TYPE, REPORT_TYPE, TIME_OBS,
// ------------------
private static final String LONGITUDE = "longitude";
private static final String LATITUDE = "latitude";
private static final String ELEVATION = "elevation";
private static final String ISSUE_TIME = "issueTime";
private static final String OBS_TIME = "obsTime";
@ -121,13 +135,13 @@ public class H5ScdPointDataTransform {
ALL_PARAMS_LIST = sb.toString();
}
private H5ScdDao dao;
private NcScdDao dao;
private PointDataDescription description;
public H5ScdPointDataTransform() {
public NcScdPointDataTransform() {
try {
this.dao = new H5ScdDao("h5scd");
this.dao = new NcScdDao("ncscd");
this.description = dao.getPointDataDescription(null);
} catch (Exception e) {
// TODO Auto-generated catch block
@ -140,7 +154,7 @@ public class H5ScdPointDataTransform {
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof H5ScdRecord))
if (!(p instanceof NcScdRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
@ -148,7 +162,7 @@ public class H5ScdPointDataTransform {
pdc = PointDataContainer.build(this.description);
pointMap.put(f, pdc);
}
H5ScdRecord nar = (H5ScdRecord) p;
NcScdRecord nar = (NcScdRecord) p;
PointDataView pdv = buildView(pdc, nar);
nar.setPointDataView(pdv);
}
@ -157,7 +171,7 @@ public class H5ScdPointDataTransform {
}
private PointDataView buildView(PointDataContainer container,
H5ScdRecord record) {
NcScdRecord record) {
PointDataView pdv = container.append();
pdv.setLong(OBS_TIME, record.getObsTime().getTime().getTime());
pdv.setString(REPORT, record.getReport());
@ -183,8 +197,8 @@ public class H5ScdPointDataTransform {
return pdv;
}
public static H5ScdRecord toH5ScdRecord(PointDataView pdv) {
H5ScdRecord nar = new H5ScdRecord();
public static NcScdRecord toNcScdRecord(PointDataView pdv) {
NcScdRecord nar = new NcScdRecord();
nar.setCorIndicator(pdv.getString(CORRECTION_CODE));
nar.setDataTime(new DataTime(new Date(pdv.getNumber(OBS_TIME)
@ -192,14 +206,20 @@ public class H5ScdPointDataTransform {
nar.setDataURI(pdv.getString(DATAURI));
nar.setReport(pdv.getString(REPORT));
nar.setReportType(pdv.getString(REPORT_TYPE));
nar.setStationID(pdv.getString(STATION_ID));
SurfaceObsLocation loc = new SurfaceObsLocation(
pdv.getString(STATION_NAME));
Double lat = pdv.getNumber(LATITUDE).doubleValue();
Double lon = pdv.getNumber(LONGITUDE).doubleValue();
loc.assignLocation(lat, lon);
loc.setElevation(pdv.getNumber(ELEVATION).intValue());
long tmptime = pdv.getNumber(ISSUE_TIME).longValue();
nar.setIssueTime(TimeTools.newCalendar(tmptime));
tmptime = pdv.getNumber(OBS_TIME).longValue();
nar.setObsTime(TimeTools.newCalendar(tmptime));
nar.setPluginName("h5scd");
nar.setPluginName("ncscd");
nar.setTDXC(pdv.getNumber(TDXC).floatValue());
nar.setTDNC(pdv.getNumber(TDNC).floatValue());
@ -223,13 +243,13 @@ public class H5ScdPointDataTransform {
return nar;
}
public static H5ScdRecord[] toH5ScdRecords(PointDataContainer container) {
List<H5ScdRecord> records = new ArrayList<H5ScdRecord>();
public static NcScdRecord[] toNcScdRecords(PointDataContainer container) {
List<NcScdRecord> records = new ArrayList<NcScdRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
records.add(toH5ScdRecord(pdv));
records.add(toNcScdRecord(pdv));
}
return records.toArray(new H5ScdRecord[records.size()]);
return records.toArray(new NcScdRecord[records.size()]);
}
}

View file

@ -4,4 +4,4 @@
* Package includes classes to decode the SCD message and persist the data.
*
*/
package gov.noaa.nws.ncep.common.dataplugin.scd;
package gov.noaa.nws.ncep.common.dataplugin.ncscd;

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>gov.noaa.nws.ncep.common.dataplugin.nctaf</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,4 +1,4 @@
#Wed Jun 02 16:49:03 EDT 2010
#Thu Dec 10 11:10:30 EST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6

View file

@ -0,0 +1,44 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nctaf Plug-in
Bundle-SymbolicName: gov.noaa.nws.ncep.common.dataplugin.nctaf
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
com.raytheon.uf.common.status;bundle-version="1.12.1174",
net.sf.cglib;bundle-version="2.1.3",
com.raytheon.uf.edex.core;bundle-version="1.12.1174",
javax.measure,
gov.noaa.nws.ncep.common;bundle-version="1.0.0",
com.raytheon.edex.common;bundle-version="1.12.1174",
org.apache.commons.lang
Import-Package: com.raytheon.edex.db.dao,
com.raytheon.uf.common.dataplugin,
com.raytheon.uf.common.dataplugin.annotations,
com.raytheon.uf.common.dataplugin.persist,
com.raytheon.uf.common.datastorage,
com.raytheon.uf.common.geospatial,
com.raytheon.uf.common.pointdata,
com.raytheon.uf.common.pointdata.spatial,
com.raytheon.uf.common.serialization,
com.raytheon.uf.common.serialization.annotations,
com.raytheon.uf.common.time,
com.raytheon.uf.edex.database,
com.raytheon.uf.edex.database.dao,
com.raytheon.uf.edex.database.plugin,
com.raytheon.uf.edex.decodertools.aircraft,
com.raytheon.uf.edex.decodertools.time,
com.raytheon.uf.edex.pointdata,
com.raytheon.uf.edex.wmo.message,
com.vividsolutions.jts.geom,
gov.noaa.nws.ncep.common.tools,
javax.measure.unit,
javax.persistence,
org.springframework.orm.hibernate3,
org.apache.commons.lang.builder,
org.apache.commons.logging;bundle-version="1.0.4"
Export-Package: gov.noaa.nws.ncep.common.dataplugin.nctaf,
gov.noaa.nws.ncep.common.dataplugin.nctaf.dao

View file

@ -0,0 +1,8 @@
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafRecord
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafChangeGroup
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafIcingLayer
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafSkyCover
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTemperatureForecast
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTurbulenceLayer
gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafWeatherCondition

View file

@ -0,0 +1,8 @@
<project basedir="." default="deploy" name="gov.noaa.nws.ncep.common.dataplugin.nctaf">
<!-- property name="component.name" value="plugin-nctaf" /-->
<available file="../build.edex" property="build.dir.location" value="../build.edex"/>
<available file="../../../../../build.edex" property="build.dir.location" value="../../../../../build.edex"/>
<import file="${build.dir.location}/basebuilds/component_deploy_base.xml" />
</project>

View file

@ -0,0 +1,439 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO to order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import org.hibernate.annotations.Index;
import com.raytheon.uf.common.dataplugin.IDecoderGettable;
import com.raytheon.uf.common.dataplugin.annotations.DataURI;
import com.raytheon.uf.common.geospatial.ISpatialEnabled;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.common.pointdata.IPointData;
import com.raytheon.uf.common.pointdata.PointDataView;
/**
* Record implementation for a taf message
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/22/2011 458 sgurung Initial Creation
* 09/29/2011 sgurung Added reportType
* 10/26/2011 sgurung Added tafValidPeriod
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement
public class NcTafBulletinRecord implements ISpatialEnabled, IDecoderGettable, IPointData {
private static final long serialVersionUID = 1L;
/** The data time for this record */
@Embedded
@XmlElement
@DynamicSerializeElement
@DataURI(position = 0)
protected DataTime dataTime;
/** The raw data from the message */
@Transient
@DynamicSerializeElement
protected Object messageData;
@DynamicSerializeElement
@XmlElement
@Column
private String wmoHeader;
@DynamicSerializeElement
@XmlElement
@Column(length = 1024)
private String tafText;
// The observation report type
@DataURI(position = 1)
@XmlElement
@Column
@DynamicSerializeElement
private String reportType;
// Station Identifier for the data
@DynamicSerializeElement
@XmlElement
@Column
@Index(name = "nctaf_stationIndex")
@DataURI(position = 2)
private String stationId;
@DynamicSerializeElement
@XmlElement
@Column
@DataURI(position = 3)
private String corIndicator;
@DynamicSerializeElement
@XmlElement
@Column
@DataURI(position = 4)
private String amdIndicator;
/** Issue date */
@DynamicSerializeElement
@XmlElement
@Column
// @DataURI(position = 4)
private Date issue_time;
/** Issue date string */
@DynamicSerializeElement
@XmlElement
@Column
@DataURI(position = 5)
private String issue_timeString;
/** Bulletin issuance time */
@DynamicSerializeElement
@XmlElement
@Transient
private Date bulletin_time;
/** Any remarks contained in the TAF record */
@DynamicSerializeElement
@XmlElement
@Column
private String remarks;
/**
* The valid period for the TAF record.
*/
@DynamicSerializeElement
@XmlElement
@Embedded
@Transient
private NcTafPeriod tafValidPeriod;
/** List of change groups (FM, BECMG, etc.) */
@DynamicSerializeElement
@XmlElement
@Transient
private Set<NcTafChangeGroup> changeGroups = new LinkedHashSet<NcTafChangeGroup>();
@Embedded
@XmlElement
@DynamicSerializeElement
private SurfaceObsLocation location;
@Embedded
private PointDataView pdv;
public NcTafBulletinRecord() {
}
public DataTime getDataTime() {
return dataTime;
}
public void setDataTime(DataTime dataTime) {
this.dataTime = dataTime;
}
public Object getMessageData() {
return messageData;
}
public void setMessageData(Object messageData) {
this.messageData = messageData;
}
/**
* Get the WMO header for the enclosing WMO message.
*
* @return The wmoHeader.
*/
public String getWmoHeader() {
return wmoHeader;
}
/**
* Set the WMO header for the enclosing WMO message.
*
* @param wmoHeader
* The WMOHeader to set.
*/
public void setWmoHeader(String wmoHeader) {
this.wmoHeader = wmoHeader;
}
/**
* Get the text of this terminal forecast.
*
* @return The terminal forecast text.
*/
public String getTafText() {
return tafText;
}
/**
* Set the text of this terminal forecast.
*
* @param tafText
* The terminal forecast text.
*/
public void setTafText(String tafText) {
this.tafText = tafText;
}
/**
* Get the observation report type.
*
* @return the reportType
*/
public String getReportType() {
return reportType;
}
/**
* Set the observation report type.
*
* @param reportType
* the reportType to set
*/
public void setReportType(String reportType) {
this.reportType = reportType;
}
/**
*
* @return
*/
public String getStationId() {
return stationId;
}
/**
*
* @param stationID
*/
public void setStationId(String stationID) {
stationId = stationID;
}
/**
*
* @return the corIndicator
*/
public String getCorIndicator() {
return corIndicator;
}
/**
*
* @param corIndicator
* the corIndicator to set
*/
public void setCorIndicator(String corIndicator) {
this.corIndicator = corIndicator;
}
/**
*
* @return the amdIndicator
*/
public String getAmdIndicator() {
return amdIndicator;
}
/**
*
* @param amdIndicator
* the amdIndicator to set
*/
public void setAmdIndicator(String amdIndicator) {
this.amdIndicator = amdIndicator;
}
/**
*
* @return the bulletin_time
*/
public Date getBulletin_time() {
return bulletin_time;
}
/**
*
* @param bulletin_time
* the bulletin_time to set
*/
public void setBulletin_time(Date bulletin_time) {
this.bulletin_time = bulletin_time;
}
/**
* @return the changeGroups
*/
public Set<NcTafChangeGroup> getChangeGroups() {
return changeGroups;
}
/**
* @param changeGroups
* the changeGroups to set
*/
public void setChangeGroups(Set<NcTafChangeGroup> changeGroups) {
this.changeGroups = changeGroups;
}
/**
* @return the issue_time
*/
public Date getIssue_time() {
return issue_time;
}
/**
* @param issue_time
* the issue_time to set
*/
public void setIssue_time(Date issue_time) {
this.issue_time = issue_time;
}
/**
* @return the issue_timeString
*/
public String getIssue_timeString() {
return issue_timeString;
}
/**
* @param issue_timeString
* the issue_time to set
*/
public void setIssue_timeString(String issue_timeString) {
this.issue_timeString = issue_timeString;
}
/**
* @return the remarks
*/
public String getRemarks() {
return remarks;
}
/**
* @param remarks
* the remarks to set
*/
public void setRemarks(String remarks) {
this.remarks = remarks;
}
@Override
public SurfaceObsLocation getSpatialObject() {
return location;
}
public SurfaceObsLocation getLocation() {
return location;
}
public void setLocation(SurfaceObsLocation location) {
this.location = location;
}
public double getLatitude() {
return location.getLatitude();
}
public double getLongitude() {
return location.getLongitude();
}
public Integer getElevation() {
return location.getElevation();
}
public NcTafPeriod getTafValidPeriod() {
return tafValidPeriod;
}
public void setTafValidPeriod(NcTafPeriod tafValidPeriod) {
this.tafValidPeriod = tafValidPeriod;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.common.pointdata.IPointData#getPointDataView()
*/
@Override
public PointDataView getPointDataView() {
return this.pdv;
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.common.pointdata.IPointData#setPointDataView(com.raytheon
* .uf.common.pointdata.PointDataView)
*/
@Override
public void setPointDataView(PointDataView pdv) {
this.pdv = pdv;
}
@Override
public Amount getValue(String paramName) {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<Amount> getValues(String paramName) {
// TODO Auto-generated method stub
return null;
}
@Override
public String getString(String paramName) {
// TODO Auto-generated method stub
return null;
}
@Override
public String[] getStrings(String paramName) {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -0,0 +1,115 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
/**
* String constants used in the nctaf Plugin.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
public final class NcTafConstants {
/** Regular expression for extracting wind information */
public static final String WIND_GROUP_EXP = "(\\d{3}|VRB)(\\d{2,3})((G)(\\d{2,3}))?(KT|MPS|KMH)()";
/** Regular expression for extracting visibility information */
public static final String VISIBILITY_GROUP_EXP = "(P?[0-6]|[0-6] [13]/[24]|[13]/[24])SM";
/** Regular expression for extracting sky coverage information */
public static final String SKY_COVER_GROUP_EXP = "(((FEW|SCT|BKN|OVC|VV)((\\d{3}|///)((CB|TCU)?)))|((SKC|CLR|NSC)))";
/** Regular expression for extracting wind shear information */
public static final String WIND_SHEAR_GROUP_EXP = "WS([0-9]{3})/([0-9]{3})([0-9]{2})KT";
/** Regular expression for extracting icing information */
public static final String ICING_GROUP_EXP = "6([0-9])([0-9]{3})([0-9])";
/** Regular expression for extracting turbulence information */
public static final String TURBULENCE_GROUP_EXP = "5([0-9])([0-9]{3})([0-9])";
/** Regular expression for extracting temperature information */
public static final String TEMP_GROUP_EXP = "T(M)?([0-9]{2})/([0-9]{2})Z";
/** Regular expression for extracting altimeter information */
public static final String ALTIMETER_GROUP_EXP = "QNH([23]\\d{3})INS";
/**
* Pattern used for extracting change groups
*
* <pre>
* Group #
* 0
* 1
* 2 Change group id = {FM|BECMG|PROBxx|TEMPO|PROBxx TEMPO
* 3
* 4
* 5
* 6 null | PROBxx When in conjunction with PROBxx or PROBxx TEMPO
* 7 null | TEMPO When in conjunction with PROBxx TEMPO
* 8 null | TEMPO
* 9 time group
* </pre>
*/
public static final String CHANGE_GROUP_EXP = "((FM|((BECMG )|((PROB[34]0) +(TEMPO )?)|(TEMPO )))((\\d{6})|(([0-3]\\d{3})/([0-3]\\d{3})))( ))";
public static final String CG_FM = "FM";
public static final String CG_BECMG = "BECMG";
public static final String CG_INITIAL = "INITIAL";
public static final String CG_TEMPO = "TEMPO";
public static final String CG_PROB = "PROB";
public static final String CG_PROB_TEMPO = "PROB TEMPO";
public static final String VS_6PLUS_SM = "P6";
public static final String VS_6PLUS_M = "9999";
public static final String WX_NSW = "NSW";
public static final String WX_CAVOK = "CAVOK";
public static final String CLD_SKC = "SKC";
public static final String CLD_VV = "VV";
public static final String TAF_IND = "TAF";
public static final String AMD_IND = "AMD";
public static final String COR_IND = "COR";
public static final String REPORT_HEADER = "(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{5})( )";
public static final String REPORT_HEADER30 = "(TAF )?((AMD|COR) )*?"
+ "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?(\\d{4}/\\d{4})( )";
public static final String RPT_HDR_TAF = "(TAF((\\s)+(AMD|COR))?)";
public static final String RPT_HDR_CCCC = "([A-Z][A-Z,0-9]{3}) ([0-3]\\d{5}Z )?([0-3]\\d{3})/([0-3]\\d{3})( )";
/**
* Constructor.
*/
private NcTafConstants() {
}
}

View file

@ -0,0 +1,191 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
* An icing layer found in a TAF message.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcTafIcingLayer extends PersistableDataObject implements
ISerializableObject {
@Id
@GeneratedValue
private int id;
/**
*
*/
private static final long serialVersionUID = 1L;
@ManyToOne
@JoinColumn(name = "parentID", nullable = false)
private NcTafChangeGroup parentID;
/** The icing intensity */
@DynamicSerializeElement
@XmlElement
private Integer icing_intensity;
/** The minimum altitude for the icing */
@DynamicSerializeElement
@XmlElement
private Integer icing_min_alt_ft_agl;
/** The maximum altitude for the icing */
@DynamicSerializeElement
@XmlElement
private Integer icing_max_alt_ft_agl;
public NcTafIcingLayer() {
}
/**
* Constructor for IcingLayer
*
* @param intensityVal
* The intensity of the icing layer
* @param baseLayer
* The base altitude of the icing layer
* @param thicknessIce
* The thickness of the icing layer
*/
public NcTafIcingLayer(NcTafChangeGroup parentid, String intensityVal,
String baseLayer, String thicknessIce) {
this.parentID = parentid;
this.icing_intensity = Integer.parseInt(intensityVal);
this.icing_min_alt_ft_agl = Integer.parseInt(baseLayer + "00");
this.icing_max_alt_ft_agl = icing_min_alt_ft_agl
+ Integer.parseInt(thicknessIce) * 1000;
}
/**
* Converts an IcingLayer object to a String
*/
@Override
public String toString() {
return "\nIcing Layer ->Intensity: " + icing_intensity + " Min: "
+ icing_min_alt_ft_agl + " ft. Max: " + icing_max_alt_ft_agl
+ " ft.\n";
}
public Integer getIcing_intensity() {
return icing_intensity;
}
public void setIcing_intensity(Integer icing_intensity) {
this.icing_intensity = icing_intensity;
}
public Integer getIcing_min_alt_ft_agl() {
return icing_min_alt_ft_agl;
}
public void setIcing_min_alt_ft_agl(Integer icing_min_alt_ft_agl) {
this.icing_min_alt_ft_agl = icing_min_alt_ft_agl;
}
public Integer getIcing_max_alt_ft_agl() {
return icing_max_alt_ft_agl;
}
public void setIcing_max_alt_ft_agl(Integer icing_max_alt_ft_agl) {
this.icing_max_alt_ft_agl = icing_max_alt_ft_agl;
}
public NcTafChangeGroup getParentID() {
return parentID;
}
public void setParentID(NcTafChangeGroup parentID) {
this.parentID = parentID;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NcTafIcingLayer) {
NcTafIcingLayer layer = (NcTafIcingLayer) obj;
if (this.parentID != layer.parentID) {
return false;
}
if (!(this.icing_intensity == null ? layer.getIcing_intensity() == null
: this.icing_intensity.equals(layer.getIcing_intensity()))) {
return false;
}
if (!(this.icing_min_alt_ft_agl == null ? layer
.getIcing_min_alt_ft_agl() == null
: this.icing_min_alt_ft_agl.equals(layer
.getIcing_min_alt_ft_agl()))) {
return false;
}
if (!(this.icing_max_alt_ft_agl == null ? layer
.getIcing_max_alt_ft_agl() == null
: this.icing_max_alt_ft_agl.equals(layer
.getIcing_max_alt_ft_agl()))) {
return false;
}
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(parentID).append(
this.icing_intensity).append(this.icing_min_alt_ft_agl).append(
this.icing_max_alt_ft_agl).toHashCode();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View file

@ -0,0 +1,505 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import com.raytheon.uf.edex.wmo.message.WMOHeader;
/**
*
* Class representing a period of time.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@Embeddable
@DynamicSerialize
@XmlAccessorType(XmlAccessType.NONE)
public class NcTafPeriod implements Serializable, ISerializableObject {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* The forecast valid starting date
*/
@DynamicSerializeElement
@XmlElement
@Column
private Calendar startDate;
// This time is only used for BECMG groups. It marks the end time of the
// BECMG transition period.
@DynamicSerializeElement
@XmlElement
@Column
private Calendar transitionEndDate;
/**
* The forecast valid ending date
*/
@DynamicSerializeElement
@XmlElement
@Column
private Calendar endDate;
/**
* Empty constructor for period. Internal values set to null.
*/
public NcTafPeriod() {
}
/**
* Constructor
*
* @param sDate
* @param eDate
*/
public NcTafPeriod(Calendar sDate, Calendar eDate) {
startDate = sDate;
if (startDate != null) {
startDate.set(Calendar.SECOND, 0);
startDate.set(Calendar.MILLISECOND, 0);
}
endDate = eDate;
if (endDate != null) {
endDate.set(Calendar.SECOND, 0);
endDate.set(Calendar.MILLISECOND, 0);
}
}
/**
*
* @param period
* @return
*/
public static NcTafPeriod copy(NcTafPeriod period) {
NcTafPeriod periodCopy = new NcTafPeriod();
periodCopy.startDate = TimeTools.copy(period.startDate);
periodCopy.transitionEndDate = TimeTools.copy(period.transitionEndDate);
periodCopy.endDate = TimeTools.copy(period.endDate);
return periodCopy;
}
/**
* Constructor that parses string. This constructor parses the string passed
* into the method into beginning and ending dates. The dates specified may
* only cover a 24 hour period but may extend into the next calendar day.
*
* @param aValidPeriod
* String containing the valid forecast times to be parsed
* @throws TAFFormatException
* If dates are not in proper format
*/
public static NcTafPeriod parseValidPeriod(String aValidPeriod,
WMOHeader header) {
aValidPeriod = new String(aValidPeriod.trim());
// decode day
int day = Integer.parseInt(aValidPeriod.substring(0, 2).trim());
// decode start and end hours
int hour1 = Integer.parseInt(aValidPeriod.substring(2, 4).trim());
int hour2 = Integer.parseInt(aValidPeriod.substring(4, 6).trim());
// Get the current time : In GMT!
Calendar startTime = TimeTools.getSystemCalendar(header.getYear(),
header.getMonth(), header.getDay());
return NcTafPeriod.determineValidPeriod(startTime, day, hour1, hour2);
}
/**
* This method determines starting and ending dates based on the input
* values.
*
* @param baseTime
* @param day
* @param hour1
* @param hour2
* @return TAFPeriod that represents starting and ending dates.
*/
public static NcTafPeriod determineValidPeriod(Calendar baseTime, int day,
int hour1, int hour2) {
Calendar sTime = TimeTools.copy(baseTime);
// get start time day
int startTimeDay = sTime.get(Calendar.DAY_OF_MONTH);
int nearEndOfMonth = sTime.getLeastMaximum(Calendar.DAY_OF_MONTH) - 1;
// TAFs are suppose to cover a short time frame. Adjust for month
// and year rollover if day difference is 'large'. Subtract one
// from the greatestMinimum in case month is Jan and year is a
// leap year.
if (startTimeDay == 1 && day >= nearEndOfMonth) {
// we are at the beginning of a month and the TAF is for the
// end of the month. Adjust month to previous.
sTime.add(Calendar.MONTH, -1);
} else if (startTimeDay >= nearEndOfMonth && day < 3) {
// we are at the end of the month and the TAF is for the
// beginning of the next month. Adjust month to next.
sTime.add(Calendar.MONTH, 1);
}
sTime.set(Calendar.DAY_OF_MONTH, day);
sTime.set(Calendar.HOUR_OF_DAY, hour1);
sTime.set(Calendar.MINUTE, 0);
sTime.set(Calendar.SECOND, 0);
// Set the ending time for the period
Calendar eTime = TimeTools.copy(sTime);
// Add a day to ending time if the hour is less than or equal
// to the the start hour
if (hour2 <= hour1) {
eTime.add(Calendar.DAY_OF_MONTH, 1);
}
if (hour2 == 24) {
eTime.add(Calendar.DAY_OF_MONTH, 1);
hour2 = 0;
}
eTime.set(Calendar.HOUR_OF_DAY, hour2);
eTime.set(Calendar.MINUTE, 0);
eTime.set(Calendar.SECOND, 0);
return new NcTafPeriod(sTime, eTime);
}
/**
* This method determines starting and ending dates based on the input
* values from a 30 Hour TAF.
*
* @param baseTime
* @param day1
* @param hour1
* @param day2
* The
* @param hour2
* @return TAFPeriod that represents starting and ending dates.
*/
public static NcTafPeriod determineValidPeriod(Calendar baseTime, int day1,
int hour1, int day2, int hour2) {
Calendar sTime = TimeTools.copy(baseTime);
// get start time day
int startTimeDay = sTime.get(Calendar.DAY_OF_MONTH);
int nearEndOfMonth = sTime.getLeastMaximum(Calendar.DAY_OF_MONTH) - 1;
// TAFs are suppose to cover a short time frame. Adjust for month
// and year rollover if day difference is 'large'. Subtract one
// from the greatestMinimum in case month is Jan and year is a
// leap year.
if (startTimeDay == 1 && day1 >= nearEndOfMonth) {
// we are at the beginning of a month and the TAF is for the
// end of the month. Adjust month to previous.
sTime.add(Calendar.MONTH, -1);
} else if (startTimeDay >= nearEndOfMonth && day1 < 3) {
// we are at the end of the month and the TAF is for the
// beginning of the next month. Adjust month to next.
sTime.add(Calendar.MONTH, 1);
}
sTime.set(Calendar.DAY_OF_MONTH, day1);
sTime.set(Calendar.HOUR_OF_DAY, hour1);
sTime.set(Calendar.MINUTE, 0);
sTime.set(Calendar.SECOND, 0);
// Set the ending time for the period
Calendar eTime = TimeTools.copy(sTime);
// Add a day to ending time if the hour is less than or equal
// to the the start hour
if (hour2 <= hour1) {
eTime.add(Calendar.DAY_OF_MONTH, 1);
}
if (hour2 == 24) {
eTime.add(Calendar.DAY_OF_MONTH, 1);
hour2 = 0;
}
eTime.set(Calendar.HOUR_OF_DAY, hour2);
eTime.set(Calendar.MINUTE, 0);
eTime.set(Calendar.SECOND, 0);
return new NcTafPeriod(sTime, eTime);
}
/**
* This method determines the valid period for a change group of type
* BECOMING or TEMPORARY which have the format SSEE where SS is the start
* hour and EE is the end hour of the valid period. The valid period for the
* entire TAF must be supplied in order to determine the correct dates
* associated with the hours.
*
* @param aStartTimeHour
* @param aEndTimeHour
* @param aTAFValidPeriod
* @param isChangeCodeBecoming
* true if change code is Becoming
* @return
*/
public static NcTafPeriod determineChangeGroupPeriodSSEE(int hour1,
int hour2, NcTafPeriod aTAFValidPeriod, boolean isChangeCodeBecoming) {
Calendar tafStartTime = aTAFValidPeriod.getStartDate();
Calendar sDate = TimeTools.copy(tafStartTime);
if (hour1 < tafStartTime.get(Calendar.HOUR_OF_DAY)) {
sDate.add(Calendar.DAY_OF_MONTH, 1);
}
sDate.set(Calendar.HOUR_OF_DAY, hour1);
sDate.set(Calendar.MINUTE, 0);
sDate.set(Calendar.SECOND, 0);
sDate.set(Calendar.MILLISECOND, 0);
Calendar eDate = TimeTools.copy(tafStartTime);
if (hour2 <= tafStartTime.get(Calendar.HOUR_OF_DAY)) {
eDate.add(Calendar.DAY_OF_MONTH, 1);
}
eDate.set(Calendar.HOUR_OF_DAY, hour2);
eDate.set(Calendar.MINUTE, 0);
eDate.set(Calendar.SECOND, 0);
eDate.set(Calendar.MILLISECOND, 0);
NcTafPeriod period = new NcTafPeriod();
// All groups use the start date as is.
period.setStartDate(sDate);
if (isChangeCodeBecoming) {
period.setTransitionEndDate(eDate);
} else {
period.setEndDate(eDate);
}
return period;
}
/**
* This method determines the valid period for a change group of type
* BECOMING, PROB, PROB TEMP, or TEMPO which have the format DDhh/DDhh where
* DDhh/DDhh are the start and end day and hour for a 30 hour change group.
* The TAFs' valid period is supplied in order to determine the month and
* year.
*
* @param aStartTimeHour
* @param aEndTimeHour
* @param aTAFValidPeriod
* @param isChangeCodeBecoming
* true if change code is Becoming
* @return
*/
public static NcTafPeriod determineChangeGroupPeriodDDhhDDhh(int day1,
int hour1, int day2, int hour2, NcTafPeriod aTAFValidPeriod,
boolean isChangeCodeBecoming) {
Calendar sDate = setDayHourMin(aTAFValidPeriod.getStartDate(), day1,
hour1, 0);
Calendar eDate = setDayHourMin(aTAFValidPeriod.getStartDate(), day2,
hour2, 0);
NcTafPeriod period = new NcTafPeriod();
// All groups use the start date as is.
period.setStartDate(sDate);
if (isChangeCodeBecoming) {
period.setTransitionEndDate(eDate);
} else {
period.setEndDate(eDate);
}
return period;
}
/**
* This method determines the valid period for a change group of type FroM
* which have the format SSss where SS is the start hour and ss is the start
* minute of the valid period. The valid period for the entire TAF must be
* supplied in order to determine the correct dates associated with the
* time.
*
* @param aStartTimeHour
* @param aStartTimeMin
* @param aTAFValidPeriod
* @return
*/
public static NcTafPeriod determineChangeGroupPeriodSSss(int hour, int min,
NcTafPeriod aTAFValidPeriod) {
Calendar startDate = TimeTools.copy(aTAFValidPeriod.getStartDate());
if (hour <= startDate.get(Calendar.HOUR_OF_DAY)) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
}
startDate.set(Calendar.HOUR_OF_DAY, hour);
startDate.set(Calendar.MINUTE, min);
startDate.set(Calendar.SECOND, 0);
startDate.set(Calendar.MILLISECOND, 0);
// Have to wait until the next group to figure the actual stop datetime.
return new NcTafPeriod(startDate, null);
}
/**
* This method determines the valid period for a change group of type FroM
* which have the format SSss where SS is the start hour and ss is the start
* minute of the valid period. The valid period for the entire TAF must be
* supplied in order to determine the correct dates associated with the
* time.
*
* @param aStartTimeHour
* @param aStartTimeMin
* @param aTAFValidPeriod
* @return
*/
public static NcTafPeriod determineChangeGroupPeriodDDhhmm(int day, int hour,
int min, NcTafPeriod aTAFValidPeriod) {
Calendar sDate = setDayHourMin(aTAFValidPeriod.getStartDate(), day,
hour, min);
NcTafPeriod period = new NcTafPeriod();
// All groups use the start date as is.
period.setStartDate(sDate);
return period;
}
/**
* Converts object to string
*
* @return String representing the valid forecast period
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("start:");
if (startDate != null) {
sb.append(formatDate(startDate));
}
sb.append(":trans:");
if (transitionEndDate != null) {
sb.append(formatDate(transitionEndDate));
}
sb.append(":end:");
if (endDate != null) {
sb.append(formatDate(endDate));
}
return sb.toString();
}
/**
* @return the theStartDate
*/
public Calendar getStartDate() {
return startDate;
}
/**
* @param theStartDate
* the theStartDate to set
*/
public void setStartDate(Calendar start) {
startDate = start;
}
/**
* @return the transitionEndDate
*/
public Calendar getTransitionEndDate() {
return transitionEndDate;
}
/**
* @param transitionEndDate
* the transitionEndDate to set
*/
public void setTransitionEndDate(Calendar transitionEndDate) {
this.transitionEndDate = transitionEndDate;
}
/**
* @return the theEndDate
*/
public Calendar getEndDate() {
return endDate;
}
/**
* @param theEndDate
* the theEndDate to set
*/
public void setEndDate(Calendar end) {
endDate = end;
}
public static String formatDate(Calendar dateTime) {
return String.format("%1$tY%1$tm%1$td%1$tH%1$tM%1$tS", dateTime);
}
/**
*
* @param day
* @param hour
* @param min
* @return
*/
public static Calendar setDayHourMin(Calendar base, int day, int hour,
int min) {
Calendar cal = null;
Calendar target = TimeTools.copy(base);
target.set(Calendar.SECOND, 0);
target.set(Calendar.MILLISECOND, 0);
for (int i = 0; i < 3; i++) {
int sDay = target.get(Calendar.DAY_OF_MONTH);
if (sDay == day) {
cal = TimeTools.copy(target);
cal.set(Calendar.HOUR_OF_DAY, hour);
cal.set(Calendar.MINUTE, min);
break;
} else {
target.add(Calendar.DAY_OF_MONTH, 1);
}
}
return cal;
}
}

View file

@ -0,0 +1,238 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Class representing a sky coverage item contained in a taf message
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
* 10/26/2011 sgurung Added isProbable to indicate if it is for TEMPO/PROB
* 11/03/2011 sgurung Removed isProbable (not needed)
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcTafSkyCover extends PersistableDataObject implements
ISerializableObject, Comparable<NcTafSkyCover> {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private int id;
/** The taf record this skycover object belongs to * */
@ManyToOne
@JoinColumn(name = "parentID", nullable = false)
private NcTafChangeGroup parentID;
/** The type of sky coverage * */
@DynamicSerializeElement
@XmlElement
private String type;
/** The height of the cloud layer * */
@DynamicSerializeElement
@XmlElement
private Integer height;
// For convective low level cloud - CB
@DynamicSerializeElement
@XmlElement
private String genus;
/**
* @return the parentID
*/
public NcTafChangeGroup getParentID() {
return parentID;
}
/**
* @param parentID
* the parentID to set
*/
public void setParentID(NcTafChangeGroup parentID) {
this.parentID = parentID;
}
/**
* No-Arg Constructor.
*/
public NcTafSkyCover() {
this.type = "";
this.height = 0;
}
/**
* Constructor
*
* @param type
* @param height
*/
public NcTafSkyCover(String type, int height) {
this.type = type;
this.height = height;
}
/**
* @return the serialVersionUID
*/
public static long getSerialVersionUID() {
return serialVersionUID;
}
/**
* @return the height
*/
public Integer getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(Integer height) {
this.height = height;
}
/**
* @return the type
*/
public String getType() {
return type;
}
/**
* @param type
* the type to set
*/
public void setType(String type) {
this.type = type;
}
/**
* @return the genus
*/
public String getGenus() {
return genus;
}
/**
* @param genus
* the genus to set
*/
public void setGenus(String genus) {
this.genus = genus;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NcTafSkyCover) {
NcTafSkyCover sky = (NcTafSkyCover) obj;
if (parentID != sky.parentID) {
return false;
}
if (!(this.height == null ? sky.getHeight() == null : this.height
.equals(sky.getHeight()))) {
return false;
}
if (!(this.type == null ? sky.getType() == null : this.type
.equals(sky.getType()))) {
return false;
}
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(parentID).append(height)
.append(type).toHashCode();
}
/**
* @return
*/
@Override
public String toString() {
StringBuilder retVal = new StringBuilder("_TAF SKY COVER_");
if (type != null) {
retVal.append(type);
} else {
retVal.append("---");
}
if (height != null) {
retVal.append(String.format("%3d", height));
} else {
retVal.append("---");
}
if (genus != null) {
retVal.append(genus);
}
return retVal.toString();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int compareTo(NcTafSkyCover sc) {
int rVal = 0;
if (this.height != null && sc.getHeight() != null) {
rVal = height.compareTo(sc.getHeight());
} else if (this.height != null && sc.getHeight() == null) {
rVal = -1;
} else if (this.height == null && sc.getHeight() != null) {
rVal = 1;
}
return rVal;
}
}

View file

@ -0,0 +1,170 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
* A temperature forecast found in a taf message.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcTafTemperatureForecast extends PersistableDataObject implements
ISerializableObject {
@Id
@GeneratedValue
private int id;
/**
*
*/
private static final long serialVersionUID = 1L;
/** The taf record this weather condition object belongs to * */
@ManyToOne
@JoinColumn(name = "parentID", nullable = false)
private NcTafChangeGroup parentID;
/** Temperature valid time */
@DynamicSerializeElement
@XmlElement
private Integer valid_time;
/** Surface temperature */
@DynamicSerializeElement
@XmlElement
private Integer sfc_temp_c;
public NcTafTemperatureForecast() {
}
/**
* Constructor for new temperature forecast
*
* @param negative
* "M" if temperature is negative
* @param temp
* The temperature
* @param time
* The valid time for the temperature
*/
public NcTafTemperatureForecast(NcTafChangeGroup parentid, String negative,
String temp, String time) {
this.parentID = parentid;
sfc_temp_c = Integer.parseInt(temp);
if (negative != null) {
sfc_temp_c *= -1;
}
valid_time = Integer.parseInt(time);
}
/**
* Converts Temperature Forecast object to a string
*/
@Override
public String toString() {
return "\nTemperature Forecast-> Surface Temp: " + sfc_temp_c + " at "
+ valid_time + " Z";
}
public NcTafChangeGroup getParentID() {
return parentID;
}
public void setParentID(NcTafChangeGroup parentID) {
this.parentID = parentID;
}
public Integer getValid_time() {
return valid_time;
}
public void setValid_time(Integer valid_time) {
this.valid_time = valid_time;
}
public Integer getSfc_temp_c() {
return sfc_temp_c;
}
public void setSfc_temp_c(Integer sfc_temp_c) {
this.sfc_temp_c = sfc_temp_c;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NcTafTemperatureForecast) {
NcTafTemperatureForecast forecast = (NcTafTemperatureForecast) obj;
if (this.parentID != forecast.parentID) {
return false;
}
if (!(this.valid_time == null ? forecast.getValid_time() == null
: this.valid_time.equals(forecast.getValid_time()))) {
return false;
}
if (!(this.sfc_temp_c == null ? forecast.getSfc_temp_c() == null
: this.sfc_temp_c.equals(forecast.getSfc_temp_c()))) {
return false;
}
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(parentID).append(
this.valid_time).append(this.sfc_temp_c).toHashCode();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View file

@ -0,0 +1,190 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
*
* A turbulence layer found in a taf message.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcTafTurbulenceLayer extends PersistableDataObject implements
ISerializableObject {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private int id;
@ManyToOne
@JoinColumn(name = "parentID", nullable = false)
private NcTafChangeGroup parentID;
/** The intensity of the turbulence */
@DynamicSerializeElement
@XmlElement
private Integer turbulence_intensity;
/** The minimum altitude for the turbulence */
@DynamicSerializeElement
@XmlElement
private Integer turbulence_min_alt_ft_agl;
/** The maximum altitude for the turbulence */
@DynamicSerializeElement
@XmlElement
private Integer turbulence_max_alt_ft_agl;
public NcTafTurbulenceLayer() {
}
/**
* Constructor for new TurbulenceLayer
*
* @param intensityVal
* The intensity of the turbulence
* @param baseLayer
* The lower altitude of the turbulence
* @param thicknessIce
* The thickness of the turbulence
*/
public NcTafTurbulenceLayer(NcTafChangeGroup parentID, String intensityVal,
String baseLayer, String thicknessIce) {
this.parentID = parentID;
this.turbulence_intensity = Integer.parseInt(intensityVal);
this.turbulence_min_alt_ft_agl = Integer.parseInt(baseLayer + "00");
this.turbulence_max_alt_ft_agl = turbulence_min_alt_ft_agl
+ Integer.parseInt(thicknessIce) * 1000;
}
/**
* Converts a TurbulenceLayer object to a String
*/
@Override
public String toString() {
return "Turbulence Layer->Int: " + turbulence_intensity + "ft Base: "
+ turbulence_min_alt_ft_agl + " Top: "
+ turbulence_max_alt_ft_agl + " ft.";
}
public Integer getTurbulence_intensity() {
return turbulence_intensity;
}
public void setTurbulence_intensity(Integer turbulence_intensity) {
this.turbulence_intensity = turbulence_intensity;
}
public Integer getTurbulence_min_alt_ft_agl() {
return turbulence_min_alt_ft_agl;
}
public void setTurbulence_min_alt_ft_agl(Integer turbulence_min_alt_ft_agl) {
this.turbulence_min_alt_ft_agl = turbulence_min_alt_ft_agl;
}
public Integer getTurbulence_max_alt_ft_agl() {
return turbulence_max_alt_ft_agl;
}
public void setTurbulence_max_alt_ft_agl(Integer turbulence_max_alt_ft_agl) {
this.turbulence_max_alt_ft_agl = turbulence_max_alt_ft_agl;
}
public NcTafChangeGroup getParentID() {
return parentID;
}
public void setParentID(NcTafChangeGroup parentID) {
this.parentID = parentID;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NcTafTurbulenceLayer) {
NcTafTurbulenceLayer layer = (NcTafTurbulenceLayer) obj;
if (this.parentID != layer.parentID) {
return false;
}
if (!(this.turbulence_intensity == null ? layer
.getTurbulence_intensity() == null
: this.turbulence_intensity.equals(layer
.getTurbulence_intensity()))) {
return false;
}
if (!(this.turbulence_min_alt_ft_agl == null ? layer
.getTurbulence_min_alt_ft_agl() == null
: this.turbulence_min_alt_ft_agl.equals(layer
.getTurbulence_min_alt_ft_agl()))) {
return false;
}
if (!(this.turbulence_max_alt_ft_agl == null ? layer
.getTurbulence_max_alt_ft_agl() == null
: this.turbulence_max_alt_ft_agl.equals(layer
.getTurbulence_max_alt_ft_agl()))) {
return false;
}
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(parentID).append(
this.turbulence_intensity).append(
this.turbulence_min_alt_ft_agl).append(
this.turbulence_max_alt_ft_agl).toHashCode();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}

View file

@ -0,0 +1,462 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import org.apache.commons.lang.builder.HashCodeBuilder;
import com.raytheon.uf.common.dataplugin.persist.PersistableDataObject;
import com.raytheon.uf.common.serialization.ISerializableObject;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
/**
* Class representing a weather condition item contained in a taf message
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
* 10/26/2011 sgurung Added isProbable to indicate if it is for TEMPO/PROB
* 11/03/2011 sgurung Removed isProbable (not needed). Added method to convert weather to canonical form.
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
@XmlAccessorType(XmlAccessType.NONE)
@DynamicSerialize
public class NcTafWeatherCondition extends PersistableDataObject implements
ISerializableObject {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
private int id;
/** The taf record this weather condition object belongs to * */
@ManyToOne
@JoinColumn(name = "parentID", nullable = false)
private NcTafChangeGroup parentID;
/** The intensity proximity notation * */
@DynamicSerializeElement
@XmlElement
private String intensityProximity = "";
/** The descriptor notation * */
@DynamicSerializeElement
@XmlElement
private String descriptor = "";
/** The precipitation notation * */
@DynamicSerializeElement
@XmlElement
private String precipitation = "";
/** The obscuration notation * */
@DynamicSerializeElement
@XmlElement
private String obscuration = "";
/** The other notation * */
@DynamicSerializeElement
@XmlElement
private String other = "";
@Transient
private Integer sequenceId;
/**
* No-Arg Constructor.
*/
public NcTafWeatherCondition() {
this.intensityProximity = "";
this.descriptor = "";
this.precipitation = "";
this.obscuration = "";
this.other = "";
}
/**
* Constructor.
*
* @param intensityProximity
* @param descriptor
* @param precipitation
* @param obscuration
* @param other
*/
public NcTafWeatherCondition(NcTafChangeGroup parentID, String intensityProximity,
String descriptor, String precipitation, String obscuration,
String other, int sequence) {
this.parentID = parentID;
sequenceId = sequence;
if (intensityProximity == null) {
intensityProximity = "";
}
if (descriptor == null) {
descriptor = "";
}
if (precipitation == null) {
precipitation = "";
}
if (obscuration == null) {
obscuration = "";
}
if (other == null) {
other = "";
}
setIntensityProximity(intensityProximity);
setDescriptor(descriptor);
setPrecipitation(precipitation);
setObscuration(obscuration);
setOther(other);
}
/* Constructor.
*
* @param intensityProximity
* @param descriptor
* @param precipitation
* @param obscuration
* @param other
*/
public NcTafWeatherCondition(NcTafChangeGroup parentID, String intensityProximity,
String descriptor, String precipitation, String obscuration,
String other, String isProbable, int sequence) {
this.parentID = parentID;
sequenceId = sequence;
if (intensityProximity == null) {
intensityProximity = "";
}
if (descriptor == null) {
descriptor = "";
}
if (precipitation == null) {
precipitation = "";
}
if (obscuration == null) {
obscuration = "";
}
if (other == null) {
other = "";
}
if (isProbable == null) {
isProbable = "";
}
setIntensityProximity(intensityProximity);
setDescriptor(descriptor);
setPrecipitation(precipitation);
setObscuration(obscuration);
setOther(other);
}
/**
* @return the descriptor
*/
public String getDescriptor() {
return descriptor;
}
/**
* @param descriptor
* the descriptor to set
*/
public void setDescriptor(String descriptor) {
if (descriptor != null) {
this.descriptor = descriptor;
}
}
/**
* @return the intensityProximity
*/
public String getIntensityProximity() {
return intensityProximity;
}
/**
* @param intensityProximity
* the intensityProximity to set
*/
public void setIntensityProximity(String intensityProximity) {
if (intensityProximity != null) {
this.intensityProximity = intensityProximity;
}
}
/**
* @return the obscuration
*/
public String getObscuration() {
return obscuration;
}
/**
* @param obscuration
* the obscuration to set
*/
public void setObscuration(String obscuration) {
if (obscuration != null) {
this.obscuration = obscuration;
}
}
/**
* @return the other
*/
public String getOther() {
return other;
}
/**
* @param other
* the other to set
*/
public void setOther(String other) {
if (other != null) {
this.other = other;
}
}
/**
* @return the parentID
*/
public NcTafChangeGroup getParentID() {
return parentID;
}
/**
* @param parentID
* the parentID to set
*/
public void setParentID(NcTafChangeGroup parentID) {
this.parentID = parentID;
}
/**
* @return the precipitation
*/
public String getPrecipitation() {
return precipitation;
}
/**
* @param precipitation
* the precipitation to set
*/
public void setPrecipitation(String precipitation) {
if (precipitation != null) {
this.precipitation = precipitation;
}
}
/**
* @return the sequenceId
*/
public Integer getSequenceId() {
return sequenceId;
}
public StringBuilder toString(StringBuilder buffer) {
if (buffer == null) {
buffer = new StringBuilder();
}
// buffer.append(parentID);
// buffer.append(":");
buffer.append((sequenceId != null) ? sequenceId : "--");
buffer.append(":");
buffer.append((intensityProximity != null) ? intensityProximity : "_");
buffer.append((intensityProximity != null) ? intensityProximity : "_");
buffer.append(":");
buffer.append((descriptor != null) ? descriptor : "__");
buffer.append(":");
buffer.append((precipitation != null) ? precipitation : "__");
buffer.append(":");
buffer.append((obscuration != null) ? obscuration : "__");
buffer.append(":");
buffer.append((other != null) ? other : "__");
return buffer;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Int:");
sb.append(intensityProximity);
sb.append(":Desc:");
sb.append(descriptor);
sb.append(":Precip:");
sb.append(precipitation);
sb.append(":Obscuration:");
sb.append(obscuration);
sb.append(":other:");
sb.append(other);
return sb.toString();
}
/**
* @param sequenceId
* the sequenceId to set
*/
public void setSequenceId(Integer sequenceId) {
this.sequenceId = sequenceId;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NcTafWeatherCondition) {
NcTafWeatherCondition cond = (NcTafWeatherCondition) obj;
if (!(this.precipitation == null ? cond.getPrecipitation() == null
: this.precipitation.equals(cond.getPrecipitation()))) {
return false;
}
if (!(this.obscuration == null ? cond.getObscuration() == null
: this.obscuration.equals(cond.getObscuration()))) {
return false;
}
if (parentID != cond.getParentID()) {
return false;
}
if (!(this.intensityProximity == null ? cond
.getIntensityProximity() == null : this.intensityProximity
.equals(cond.getIntensityProximity()))) {
return false;
}
if (!(this.descriptor == null ? cond.getDescriptor() == null
: this.descriptor.equals(cond.getDescriptor()))) {
return false;
}
if (!(this.other == null ? cond.other == null : this.other
.equals(cond.getOther()))) {
return false;
}
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(precipitation).append(
obscuration).append(parentID).append(intensityProximity)
.append(descriptor).append(other).toHashCode();
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
/**
*
* @return
*/
public String toCanonicalForm() {
StringBuilder sb = new StringBuilder();
if((intensityProximity != null)&&(!"".equals(intensityProximity))) {
sb.append(intensityProximity);
}
if((descriptor != null)&&(!"".equals(descriptor))) {
sb.append(descriptor);
}
if((precipitation != null)&&(!"".equals(precipitation))) {
sb.append(precipitation);
}
if((obscuration != null)&&(!"".equals(obscuration))) {
sb.append(obscuration);
}
if((other != null)&&(!"".equals(other))) {
sb.append(other);
}
return sb.toString();
}
/**
*
* @return
*/
public static String toCanonicalForm(Set<NcTafWeatherCondition> wthrConds) {
List<NcTafWeatherCondition> groups = new ArrayList<NcTafWeatherCondition>(wthrConds);
StringBuilder sb = new StringBuilder();
if((groups != null)&&(groups.size() > 0)) {
sb.append(groups.get(0).toCanonicalForm());
for(int i = 1;i < groups.size();i++) {
sb.append(" ");
sb.append(groups.get(i).toCanonicalForm());
}
}
return sb.toString();
}
/**
*
* @param args
*/
public static final void main(String [] args) {
Set<NcTafWeatherCondition> wthrConds = new HashSet<NcTafWeatherCondition>();
NcTafWeatherCondition cond = new NcTafWeatherCondition();
cond.setIntensityProximity("+");
cond.setDescriptor("SH");
cond.setPrecipitation("RA");
cond.setObscuration("");
cond.setOther("");
wthrConds.add(cond);
for(NcTafWeatherCondition w : wthrConds) {
System.out.println(w);
System.out.println(w.toCanonicalForm());
}
}
}

View file

@ -0,0 +1,501 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Set of tools to parse TAF weather conditions. The public parseWeather() calls
* various helper methods to properly parse the data following certain rules
* that are defined in the TAF standard and in NWS coding standards.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
public class NcTafWeatherTools {
private static String[] tsTypes = { "TSRA", "TSSN", "TSPL", "TSGS", "TSGR", };
private static String[] shTypes = { "SHRA", "SHSN", "SHPL", "SHGS", "SHGR", };
private static String [] wxTypes = { "DZ", "RA", "SN", "SG", "IC", "PL", "GR", "GS", };
private static String[] vcTypes = { "VCTS", "VCSH", "VCFG", };
private static String[] fzTypes = { "FZRA", "FZDZ", "FZFG", };
// Freezing fog will get picked up in the FZ category!
// Vicinity fog will get picked up in the VC category!
private static String [] drTypes = { "DRSN", "DRDU", "DRSA", };
private static String [] blTypes = { "BLSN", "BLDU", "BLSA", "BLPY", };
private static String [] obTypes = { "BR", "MIFG", "PRFG", "BCFG", "FG", "FU", "VA", "DU", "SA", "HZ", "PY", };
private static String [] otTypes = { "PO", "SQ", "FC", "SS", "DS", };
private List<NcTafWxElements> elements = null;
/**
* Parse Vicinity weather elements.
* @param data Candidate TAF weather data.
* @return Was Vicinity found.
*/
private boolean doVC(StringBuilder data) {
boolean foundVC = false;
int posx = -1;
for(String s : vcTypes) {
posx = data.indexOf(s);
if (posx >= 0) {
foundVC = true;
String ss = data.substring(posx+2,posx+4);
data.delete(posx, posx + 4);
NcTafWxElements e = new NcTafWxElements();
e.setIntensity("VC");
if("FG".equals(ss)) {
e.setObscuration(ss);
} else {
e.setDescriptor(ss);
}
elements.add(e);
break;
}
}
return foundVC;
}
/**
* Parse Freezing weather elements.
* @param data Candidate TAF weather data.
* @return Was Freezing found.
*/
private boolean doFZ(StringBuilder data) {
boolean foundFZ = false;
String descriptor = null;
int pos = data.indexOf("FZ");
if(pos >= 0) {
descriptor = "FZ";
}
if(descriptor != null) {
// Going to check for TS here.
int posx = data.indexOf("TS");
if((posx >= 0)&&(posx < pos)) {
data.delete(posx,pos);
NcTafWxElements e = new NcTafWxElements();
e.setDescriptor("TS");
elements.add(e);
pos -= 2;
} else {
posx = data.indexOf("SH");
if((posx >= 0)&&(posx < pos)) {
data.delete(posx,pos);
NcTafWxElements e = new NcTafWxElements();
e.setDescriptor("SH");
elements.add(e);
pos -= 2;
}
}
String intensity = " ";
for(String s : fzTypes) {
posx = data.indexOf(s);
if(posx == pos) {
int end = posx + s.length();
NcTafWxElements e = new NcTafWxElements();
e.setDescriptor(descriptor);
e.setWx(data.substring(posx+2,posx+4));
// Check if there is an intensity
// Is it possible?
if(posx > 0) {
char c = data.charAt(posx-1);
if((c == '+')||(c == '-')) {
posx--;
intensity = data.substring(posx,posx+1);
}
}
e.setIntensity(intensity);
elements.add(e);
data.delete(posx, end);
// RA,SN,PL,GR, and GS can follow
if(data.length() > 0) {
// If there's a character here then we're in a compound weather
// group. Extract it.
while(data.charAt(0) != ' ') {
boolean breakOut = true;
for(String ss : wxTypes) {
String subGrp = data.substring(0,2);
if(ss.equals(subGrp)) {
e = new NcTafWxElements();
e.setIntensity(intensity);
e.setWx(subGrp);
elements.add(e);
data.delete(0,2);
breakOut = false;
}
}
if(breakOut) {
break;
}
}
}
}
}
}
return foundFZ;
}
/**
* Parse Thunderstorm/Shower weather elements.
* @param data Candidate TAF weather data.
* @return Was Thunderstorms/Showers found.
*/
private boolean doTSSH(StringBuilder data) {
// RA,SN,PL,GR, and GS can follow
String [] wx = {
"RA","SN","PL","GR","GS",
};
boolean foundTS = false;
String [] types = null;
String descriptor = null;
int pos = data.indexOf("TS");
if(pos >= 0) {
descriptor = "TS";
types = tsTypes;
} else {
pos = data.indexOf("SH");
if(pos >= 0) {
descriptor = "SH";
types = shTypes;
}
}
if(descriptor != null) {
// Assume moderate until we find out otherwise.
String intensity = " ";
int posx = -1;
for(String s : types) {
posx = data.indexOf(s);
if(posx >= pos) {
foundTS = true;
int end = posx + 4;
NcTafWxElements e = new NcTafWxElements();
e.setDescriptor(descriptor);
e.setWx(data.substring(posx+2,posx+4));
// Check if there is an intensity
// Is it possible?
if(posx > 0) {
char c = data.charAt(posx-1);
if((c == '+')||(c == '-')) {
posx--;
intensity = data.substring(posx,posx+1);
e.setIntensity(intensity);
}
elements.add(e);
} else {
e.setIntensity(intensity);
elements.add(e);
}
data.delete(posx, end);
// RA,SN,PL,GR, and GS can follow
// If there's a character here then we're in a compound
// weather
// group. Extract it.
outerLoop: while ((data.length() > 1)
&& (data.charAt(0) != ' ')) {
boolean breakOut = true;
for (String ss : wx) {
String subGrp = data.substring(0, 2);
if (ss.equals(subGrp)) {
e = new NcTafWxElements();
e.setIntensity(intensity);
e.setDescriptor(descriptor);
e.setWx(subGrp);
elements.add(e);
data.delete(0, 2);
breakOut = false;
continue outerLoop;
}
} // for
// If we've gone through the entire list without finding
// anything, quit.
if(breakOut) {
break;
}
} // while
break;
}
}
}
return foundTS;
}
/**
* Parse weather elements.
* @param data Candidate TAF weather data.
* @return Was weather found.
*/
private boolean doWx(StringBuilder data) {
ArrayList<NcTafWxElements> wxData = new ArrayList<NcTafWxElements>();
boolean foundWx = false;
int minPos = 9999;
int end = -1;
int pos = -1;
for(String s : wxTypes) {
pos = data.indexOf(s);
if (pos >= 0) {
minPos = Math.min(minPos,pos);
end = Math.max(end,pos+2);
NcTafWxElements e = new NcTafWxElements();
e.setWx(data.substring(pos,pos+2));
e.setPos(pos);
wxData.add(e);
foundWx = true;
}
}
if(wxData.size() > 0) {
Collections.sort(wxData);
String intensity = " ";
if(minPos > 0) {
char c = data.charAt(minPos-1);
if((c == '+')||(c == '-')) {
minPos--;
intensity = data.substring(minPos,minPos+1);
}
}
data.delete(minPos, end);
for(NcTafWxElements s : wxData) {
s.setIntensity(intensity);
elements.add(s);
}
}
return foundWx;
}
/**
* Parse Blowing weather elements.
* @param data Candidate TAF weather data.
* @return Was Blowing found.
*/
private boolean doBL(StringBuilder data) {
boolean foundBL = false;
int posx = -1;
for(String s : blTypes) {
posx = data.indexOf(s);
if (posx >= 0) {
foundBL = true;
NcTafWxElements e = new NcTafWxElements();
e.setDescriptor(data.substring(posx,posx+2));
String ss = data.substring(posx+2,posx+4);
if("SN".equals(ss)) {
e.setWx(ss);
} else {
e.setObscuration(ss);
}
elements.add(e);
data.delete(posx, posx + 4);
break;
}
}
return foundBL;
}
/**
* Parse Drifting weather elements.
* @param data Candidate TAF weather data.
* @return Was Drifting found.
*/
private boolean doDR(StringBuilder data) {
boolean foundDR = false;
int posx = -1;
for(String s : drTypes) {
posx = data.indexOf(s);
if (posx >= 0) {
foundDR = true;
NcTafWxElements e = new NcTafWxElements();
String ss = data.substring(posx+2,posx+4);
if("SN".equals(ss)) {
e.setWx(ss);
} else {
e.setObscuration(ss);
}
e.setDescriptor(data.substring(posx,posx+2));
elements.add(e);
data.delete(posx, posx + 4);
break;
}
}
return foundDR;
}
/**
* Parse Obscuration weather elements.
* @param data Candidate TAF weather data.
* @return Was Obscuration found.
*/
private boolean doOB(StringBuilder data) {
boolean foundOB = false;
ArrayList<NcTafWxElements> wxData = new ArrayList<NcTafWxElements>();
int minPos = 9999;
int end = -1;
int pos = -1;
for(String s : obTypes) {
pos = data.indexOf(s);
if (pos >= 0) {
minPos = Math.min(minPos,pos);
end = Math.max(end,pos+s.length());
NcTafWxElements e = new NcTafWxElements();
if(s.length() == 4) {
e.setDescriptor(data.substring(pos,pos+2));
e.setObscuration(data.substring(pos+2,pos+4));
} else {
e.setObscuration(data.substring(pos,pos+s.length()));
}
int size = s.length();
data.replace(pos,pos+size,String.format("%" + size + "s" ," "));
e.setPos(pos);
wxData.add(e);
foundOB = true;
}
}
if(foundOB) {
Collections.sort(wxData);
data.delete(minPos, end);
for(NcTafWxElements s : wxData) {
elements.add(s);
}
}
return foundOB;
}
/**
* Parse Other weather elements.
* @param data Candidate TAF weather data.
* @return Was Other found.
*/
private boolean doOT(StringBuilder data) {
boolean foundOT = false;
ArrayList<NcTafWxElements> wxData = new ArrayList<NcTafWxElements>();
int minPos = 9999;
int end = -1;
int pos = -1;
for(String s : otTypes) {
pos = data.indexOf(s);
if (pos >= 0) {
minPos = Math.min(minPos,pos);
end = Math.max(end,pos+s.length());
int size = s.length();
NcTafWxElements e = new NcTafWxElements();
String ss = data.substring(pos,pos+size);
e.setWx(ss);
// Have to check for a special case of +FC here. (Tornado/Waterspout)
if("FC".equals(ss) || "DS".equals(ss) || "SS".equals(ss) ) {
// Could there be a plus sign?
if((pos > 0)&&('+' == data.charAt(pos-1))) {
pos--;
size++;
minPos = Math.min(minPos,pos);
e.setIntensity("+");
}
}
data.replace(pos,pos+size,String.format("%" + size + "s" ," "));
e.setPos(pos);
wxData.add(e);
foundOT = true;
}
}
if(foundOT) {
Collections.sort(wxData);
data.delete(minPos, end);
for(NcTafWxElements s : wxData) {
elements.add(s);
}
}
return foundOT;
}
/**
* Parse all weather elements and delete those found.
* @param data Candidate TAF weather data.
* @return Set of all weather element data found.
*/
public Set<NcTafWeatherCondition> parseWeather(StringBuilder data) {
Set<NcTafWeatherCondition> wxElements = null;
elements = new ArrayList<NcTafWxElements>();
// The order of these method calls depends on the data definition.
// Changes should be made with caution!
doFZ(data);
doTSSH(data);
doBL(data);
doDR(data);
doWx(data);
doVC(data);
doOB(data);
doOT(data);
if(elements.size() > 0) {
wxElements = new HashSet<NcTafWeatherCondition>();
int sequence = 1;
for(NcTafWxElements e : elements) {
NcTafWeatherCondition con = e.getWeather(sequence++);
wxElements.add(con);
}
}
return wxElements;
}
}

View file

@ -0,0 +1,179 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf;
/**
* Intermediate data element used to parse weather data elements. It differs from
* the TafWeatherCondition by allowing the text position of elements to be kept.
* It also implements Comparable allowing these elements to be sorted by their
* position.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
public class NcTafWxElements implements Comparable<NcTafWxElements> {
private String intensity;
private String descriptor;
private String wx;
private String obscuration;
private String other;
private Integer pos;
/**
* Get the intensity value.
* @return the intensity
*/
public String getIntensity() {
return intensity;
}
/**
* Set the intensity value.
* @param intensity the intensity to set
*/
public void setIntensity(String intensity) {
this.intensity = intensity;
}
/**
* Get the descriptor value.
* @return the descriptor
*/
public String getDescriptor() {
return descriptor;
}
/**
* Set the descriptor value.
* @param descriptor the descriptor to set
*/
public void setDescriptor(String descriptor) {
this.descriptor = descriptor;
}
/**
* Get the weather value.
* @return the wx
*/
public String getWx() {
return wx;
}
/**
* Set the weather value.
* @param wx the wx to set
*/
public void setWx(String wx) {
this.wx = wx;
}
/**
* Get the obscuration value.
* @return the obscuration
*/
public String getObscuration() {
return obscuration;
}
/**
* Get the obscuration value.
* @param obscuration the obscuration to set
*/
public void setObscuration(String obscuration) {
this.obscuration = obscuration;
}
/**
* Get the value of other weather data elements
* @return the other
*/
public String getOther() {
return other;
}
/**
* Set the value of other weather data elements.
* @param other the other to set
*/
public void setOther(String other) {
this.other = other;
}
/**
* Get the position where this element was found in the data.
* @return the pos
*/
public Integer getPos() {
return pos;
}
/**
* Set the position where this element was found in the data.
* @param pos the pos to set
*/
public void setPos(Integer pos) {
this.pos = pos;
}
public StringBuilder toString(StringBuilder buffer) {
if(buffer == null) {
buffer = new StringBuilder();
}
buffer.append((intensity != null) ? intensity : "_");
buffer.append(":");
buffer.append((descriptor != null) ? descriptor : "__");
buffer.append(":");
buffer.append((wx != null) ? wx : "__");
buffer.append(":");
buffer.append((obscuration != null) ? obscuration : "__");
buffer.append(":");
buffer.append((other != null) ? other : "__");
return buffer;
}
public String toString() {
return toString(null).toString();
}
@Override
public int compareTo(NcTafWxElements element) {
return getPos().compareTo(element.getPos());
}
/**
* Factory method to create a TafWeatherCondition entry from this data.
* @param sequence An externally supplied sequence number to use.
* @return The created TafWeatherCondition element.
*/
public NcTafWeatherCondition getWeather(int sequence) {
NcTafWeatherCondition condition = new NcTafWeatherCondition();
condition.setSequenceId(sequence);
condition.setIntensityProximity(intensity);
condition.setDescriptor(descriptor);
condition.setPrecipitation(wx);
condition.setObscuration(obscuration);
condition.setOther(other);
return condition;
}
}

View file

@ -0,0 +1,190 @@
/**
* This software was modified from Raytheon's taf plugin by
* NOAA/NWS/NCEP/NCO in order to output point data in HDF5.
**/
package gov.noaa.nws.ncep.common.dataplugin.nctaf.dao;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.JAXBException;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafRecord;
import com.raytheon.edex.db.dao.spatial.ObStationDao;
import com.raytheon.uf.common.dataplugin.PluginException;
import com.raytheon.uf.common.dataplugin.persist.IPersistable;
import com.raytheon.uf.common.dataquery.db.QueryParam;
import com.raytheon.uf.common.datastorage.IDataStore;
import com.raytheon.uf.edex.database.DataAccessLayerException;
import com.raytheon.uf.edex.database.query.DatabaseQuery;
import com.raytheon.uf.edex.pointdata.PointDataDbDescription;
import com.raytheon.uf.edex.pointdata.PointDataPluginDao;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.spatial.ObStation;
/**
* Set of DAO methods for TAF data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/09/2011 458 sgurung Initial Creation from Raytheon's taf plugin
* 09/23/2011 458 sgurung Converted to HDF5
*
* </pre>
*
* @author sgurung
* @version 1.0
*/
public class NcTafDao extends PointDataPluginDao<NcTafRecord> {
/** The station dao */
private ObStationDao obDao = new ObStationDao();
/**
* Creates a new NcTafDao
* @throws PluginException
*/
public NcTafDao(String pluginName) throws PluginException {
super(pluginName);
}
@Override
protected IDataStore populateDataStore(IDataStore dataStore,
IPersistable obj) throws Exception {
// TODO Auto-generated method stub
return null;
}
public List<?> queryBySpatialBox(double upperLeftLat, double upperLeftLon,
double lowerRightLat, double lowerRightLon)
throws DataAccessLayerException {
List<ObStation> stationList = obDao.queryBySpatialBox(upperLeftLat,
upperLeftLon, lowerRightLat, lowerRightLon);
List<String> stationNames = new ArrayList<String>();
// for(ObStation station:stationList){
// stationNames.add((String)station.getIdentifier());
// }
stationList.clear();
DatabaseQuery query = new DatabaseQuery(NcTafRecord.class);
query.addQueryParam("location.stationId", stationNames,
QueryParam.QueryOperand.IN);
return queryByCriteria(query);
}
public List<?> queryByState(String state, Integer count)
throws DataAccessLayerException {
// List<ObStation> results = obDao.queryByState(state);
ArrayList<String> icaos = new ArrayList<String>();
// for (ObStation station : results) {
// //icaos.add((String)station.getIdentifier());
// }
DatabaseQuery query = new DatabaseQuery(NcTafRecord.class, count);
query.addQueryParam("location.stationId", icaos,
QueryParam.QueryOperand.IN);
return queryByCriteria(query);
}
/**
* Retrieves an nctaf report using the datauri .
*
* @param dataURI
* The dataURI to match against.
* @return The report record if it exists.
*/
public NcTafRecord queryByDataURI(String dataURI) {
NcTafRecord report = null;
List<?> obs = null;
try {
obs = queryBySingleCriteria("dataURI", dataURI);
} catch (DataAccessLayerException e) {
e.printStackTrace();
}
if((obs != null)&&(obs.size() > 0)) {
report = (NcTafRecord) obs.get(0);
}
return report;
}
/**
* Queries for to determine if a given data uri exists on the nctaf table.
*
* @param dataUri
* The DataURI to find.
* @return An array of objects. If not null, there should only be a single
* element.
*/
public Object[] queryDataUriColumn(final String dataUri) {
String sql = "select datauri from awips.nctaf where datauri='"
+ dataUri + "';";
Object[] results = executeSQLQuery(sql);
return results;
}
public ObStationDao getObDao() {
return obDao;
}
public void setObDao(ObStationDao obDao) {
this.obDao = obDao;
}
@Override
public String[] getKeysRequiredForFileName() {
return new String[] { "dataTime.refTime" };
}
@Override
public String getPointDataFileName(NcTafRecord p) {
return "nctafs.h5";
}
@Override
public NcTafRecord newObject() {
return new NcTafRecord();
}
public PointDataDescription getPointDataDescription() throws JAXBException {
if (hdf5DataDescription == null) {
hdf5DataDescription = PointDataDescription.fromStream(this.getClass()
.getResourceAsStream("/res/pointdata/nctaf.xml"));
}
return hdf5DataDescription;
}
@Override
public PointDataDbDescription getPointDataDbDescription() {
if (dbDataDescription == null) {
InputStream stream = this.getClass().getResourceAsStream(
"/res/pointdata/nctafdb.xml");
if (stream != null) {
try {
dbDataDescription = PointDataDbDescription
.fromStream(stream);
} catch (JAXBException e) {
logger.error("Unable to load " + pluginName
+ " Point Data Database Description", e);
}
}
}
return dbDataDescription;
}
}

View file

@ -0,0 +1,539 @@
/**
* NcTafToPointData
*
* This java class provides the data transform from NcTafRecord to
* point data.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 09/23/2011 458 S. Gurung Initial Creation
* 09/29/2011 sgurung Added REPORT_TYPE
* 10/26/2011 sgurung Added probable parameters (for TEMPO/PROB)
* 11/03/2011 sgurung Added additional parameters
* 11/07/2011 sgurung Added LOW_LEVEL_WIND_SHEAR
*
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
* @author S. Gurung
* @version 1.0
*/
package gov.noaa.nws.ncep.common.dataplugin.nctaf.dao;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.raytheon.uf.common.dataplugin.PluginDataObject;
import com.raytheon.uf.common.pointdata.Dimension;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataDescription;
import com.raytheon.uf.common.pointdata.PointDataView;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafIcingLayer;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafRecord;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafSkyCover;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTemperatureForecast;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTurbulenceLayer;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafWeatherCondition;
import gov.noaa.nws.ncep.common.tools.IDecoderConstantsN;
public class NcTafToPointData {
private static final String DATAURI = "DATAURI";
private static final String WMO_HEADER = "WMOHEADER";
private static final String TAF_TEXT = "TAFTEXT";
private static final String STATION_ID = "STID";
private static final String CORRECTION_INDICATOR = "CORR";
private static final String AMD_INDICATOR = "AMD";
private static final String ISSUE_TIME = "ISSUETIME";
private static final String ISSUE_TIME_STRING = "ISSUETIMESTR";
private static final String BULLETIN_TIME = "BULLETINTIME";
//private static final String RAW_DATA = "RAWDATA";
private static final String REPORT_TYPE = "REPORTTYPE";
private static final String CGRP = "CGRP";
private static final String IND = "IND";
private static final String PROB = "PROB";
private static final String MAX_TEMP = "MAX_TEMP";
private static final String MIN_TEMP = "MIN_TEMP";
private static final String ALTIM = "ALTIM";
private static final String REMARKS = "REMARKS";
private static final String SEQID = "SEQID";
private static final String END_DATE = "END_DATE";
private static final String START_DATE = "START_DATE";
private static final String TRANS_END_DATE = "TRANS_END_DATE";
private static final String VISIBILITY = "VISIBILITY";
private static final String VERT_VISIBILITY ="VERT_VISIBILITY";
private static final String WIND_DIR = "WIND_DIR";
private static final String WIND_GUST = "WIND_GUST";
private static final String WIND_SPEED = "WIND_SPEED";
private static final String SHEAR_WIND_DIR = "SHEAR_WIND_DIR";
private static final String SHEAR_WIND_SPEED = "SHEAR_WIND_SPEED";
private static final String SHEAR_WIND_HGT = "SHEAR_WIND_HGT";
private static final String PROBABLE_VISIBILITY = "PROBABLE_VISIBILITY";
private static final String PROBABLE_VERT_VISIBILITY ="PROBABLE_VERT_VISIBILITY";
private static final String PROBABLE_WIND_DIR = "PROBABLE_WIND_DIR";
private static final String PROBABLE_WIND_GUST = "PROBABLE_WIND_GUST";
private static final String PROBABLE_WIND_SPEED = "PROBABLE_WIND_SPEED";
private static final String PROBABLE_SHEAR_WIND_DIR = "PROBABLE_SHEAR_WIND_DIR";
private static final String PROBABLE_SHEAR_WIND_SPEED = "PROBABLE_SHEAR_WIND_SPEED";
private static final String PROBABLE_SHEAR_WIND_HGT = "PROBABLE_SHEAR_WIND_HGT";
private static final String CEILING ="CEILING";
private static final String PROBABLE_CEILING ="PROBABLE_CEILING";
private static final String STIM = "STIM";
private static final String LOW_LEVEL_WIND_SHEAR_FLAG = "LOW_LEVEL_WIND_SHEAR";
private static final String ICNG_INTENSITY = "ICNG_INTENSITY";
private static final String ICNG_MAX_ALT = "ICNG_MAX_ALT";
private static final String ICNG_MIN_ALT = "ICNG_MIN_ALT";
private static final String SCVR_HGT = "SCVR_HGT";
private static final String SCVR_TYPE = "SCVR_TYPE";
private static final String SCVR_GENUS = "SCVR_GENUS";
private static final String PROBABLE_SCVR_HGT = "PROBABLE_SCVR_HGT";
private static final String PROBABLE_SCVR_TYPE = "PROBABLE_SCVR_TYPE";
private static final String PROBABLE_SCVR_GENUS = "PROBABLE_SCVR_GENUS";
private static final String TMPFCST_VALID_TIME = "TMPFCST_VALID_TIME";
private static final String TMPFCST_TEMP = "TMPFCST_TEMP";
private static final String TURB_INTENSITY = "TURB_INTENSITY";
private static final String TURB_MAX_ALT = "TURB_MAX_ALT";
private static final String TURB_MIN_ALT = "TURB_MIN_ALT";
private static final String WTHRCOND_DESCRIPTOR = "WTHRCOND_DESCRIPTOR";
private static final String WTHRCOND_INTSTY_PRXMTY = "WTHRCOND_INTSTY_PRXMTY";
private static final String WTHRCOND_OBSCURATION = "WTHRCOND_OBSCURATION";
private static final String WTHRCOND_OTHER = "WTHRCOND_OTHER";
private static final String WTHRCOND_PRECIPITATION = "WTHRCOND_PRECIPITATION";
private static final String PRES_WEATHER = "PRES_WEATHER";
private static final String PROBABLE_WTHRCOND_DESCRIPTOR = "PROBABLE_WTHRCOND_DESCRIPTOR";
private static final String PROBABLE_WTHRCOND_INTSTY_PRXMTY = "PROBABLE_WTHRCOND_INTSTY_PRXMTY";
private static final String PROBABLE_WTHRCOND_OBSCURATION = "PROBABLE_WTHRCOND_OBSCURATION";
private static final String PROBABLE_WTHRCOND_OTHER = "PROBABLE_WTHRCOND_OTHER";
private static final String PROBABLE_WTHRCOND_PRECIPITATION = "PROBABLE_WTHRCOND_PRECIPITATION";
private static final String PROBABLE_PRES_WEATHER = "PROBABLE_PRES_WEATHER";
/**
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! It is important to
* keep this up to date or risk breaking backwards compatibility
*/
private static final String[] ALL_PARAMS = { DATAURI,
WMO_HEADER, TAF_TEXT, REPORT_TYPE, STATION_ID, CORRECTION_INDICATOR, AMD_INDICATOR,
ISSUE_TIME, ISSUE_TIME_STRING, BULLETIN_TIME,
CGRP, IND, PROB, MAX_TEMP, MIN_TEMP, ALTIM,
REMARKS, SEQID, END_DATE, START_DATE, TRANS_END_DATE,
VISIBILITY, VERT_VISIBILITY,WIND_DIR, WIND_GUST,
WIND_SPEED,SHEAR_WIND_DIR,SHEAR_WIND_SPEED, SHEAR_WIND_HGT, LOW_LEVEL_WIND_SHEAR_FLAG,
CEILING, PROBABLE_CEILING,
PROBABLE_VISIBILITY, PROBABLE_VERT_VISIBILITY,PROBABLE_WIND_DIR, PROBABLE_WIND_GUST,
PROBABLE_WIND_SPEED,PROBABLE_SHEAR_WIND_DIR,PROBABLE_SHEAR_WIND_SPEED, PROBABLE_SHEAR_WIND_HGT,
ICNG_INTENSITY, ICNG_MAX_ALT, ICNG_MIN_ALT,
SCVR_HGT, SCVR_TYPE, SCVR_GENUS,
PROBABLE_SCVR_HGT, PROBABLE_SCVR_TYPE, PROBABLE_SCVR_GENUS,
TMPFCST_VALID_TIME, TMPFCST_TEMP,
TURB_INTENSITY, TURB_MAX_ALT, TURB_MIN_ALT,
WTHRCOND_DESCRIPTOR, WTHRCOND_INTSTY_PRXMTY, WTHRCOND_OBSCURATION, WTHRCOND_OTHER, WTHRCOND_PRECIPITATION, PRES_WEATHER,
PROBABLE_WTHRCOND_DESCRIPTOR, PROBABLE_WTHRCOND_INTSTY_PRXMTY, PROBABLE_WTHRCOND_OBSCURATION, PROBABLE_WTHRCOND_OTHER, PROBABLE_WTHRCOND_PRECIPITATION, PROBABLE_PRES_WEATHER };
public static final String ALL_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
boolean first = true;
for (String s : ALL_PARAMS) {
if (!first) {
sb.append(", ");
} else {
first = false;
}
sb.append(s);
}
ALL_PARAMS_LIST = sb.toString();
}
private NcTafDao dao;
private PointDataDescription pdd;
public NcTafToPointData() {
try {
this.dao = new NcTafDao("nctaf");
this.pdd = dao.getPointDataDescription();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public PluginDataObject[] toPointData(PluginDataObject[] pdo) {
if (pdo.length > 0) {
Map<File, PointDataContainer> pointMap = new HashMap<File, PointDataContainer>();
for (PluginDataObject p : pdo) {
if (!(p instanceof NcTafRecord))
continue;
File f = this.dao.getFullFilePath(p);
PointDataContainer pdc = pointMap.get(f);
if (pdc == null) {
pdc = PointDataContainer.build(this.pdd);
pointMap.put(f, pdc);
}
NcTafRecord mr = (NcTafRecord) p;
PointDataView pdv = buildView(pdc, mr);
mr.setPointDataView(pdv);
}
}
return pdo;
}
private PointDataView buildView(PointDataContainer container,
NcTafRecord record) {
PointDataView pdv = container.append();
int maxIcngLyr = -1;
int maxSkyCover = -1;
int maxTempFcst = -1;
int maxTurbFcst = -1;
int maxWthrCond = -1;
Dimension [] dims = pdd.dimensions;
for(Dimension d : dims) {
if("maxIcngLyr".equals(d.getDimensionName())) {
maxIcngLyr = d.getDimensionLength();
}
if("maxSkyCover".equals(d.getDimensionName())) {
maxSkyCover = d.getDimensionLength();
}
if("maxTempFcst".equals(d.getDimensionName())) {
maxTempFcst = d.getDimensionLength();
}
if("maxTurbFcst".equals(d.getDimensionName())) {
maxTurbFcst = d.getDimensionLength();
}
if("maxWthrCond".equals(d.getDimensionName())) {
maxWthrCond = d.getDimensionLength();
}
}
if (record.getDataURI()!=null)
pdv.setString(DATAURI, record.getDataURI());
if (record.getWmoHeader()!=null)
pdv.setString(WMO_HEADER, record.getWmoHeader());
if (record.getTafText()!=null)
pdv.setString(TAF_TEXT, record.getTafText());
if (record.getReportType()!=null)
pdv.setString(REPORT_TYPE, record.getReportType());
if (record.getStationId()!=null)
pdv.setString(STATION_ID, record.getStationId());
if (record.getCorIndicator() != null) {
pdv.setString(CORRECTION_INDICATOR,record.getCorIndicator());
} else {
pdv.setString(CORRECTION_INDICATOR, "");
}
if (record.getCorIndicator() != null) {
pdv.setString(AMD_INDICATOR,record.getAmdIndicator());
} else {
pdv.setString(AMD_INDICATOR, "");
}
if (record.getIssue_time()!=null)
pdv.setLong(ISSUE_TIME, record.getIssue_time().getTime());
if (record.getIssue_timeString()!=null)
pdv.setString(ISSUE_TIME_STRING, record.getIssue_timeString());
if (record.getBulletin_time()!=null)
pdv.setLong(BULLETIN_TIME, record.getBulletin_time().getTime());
if (record.getChange_indicator() != null)
pdv.setString(IND, record.getChange_indicator());
if (record.getChangeGroup() != null)
pdv.setString(CGRP, record.getChangeGroup().trim());
if (record.getProbability() != null)
pdv.setInt(PROB, record.getProbability());
if (record.getMax_temp_c() != null)
pdv.setFloat(MAX_TEMP, record.getMax_temp_c());
if (record.getMin_temp_c() != null)
pdv.setFloat(MIN_TEMP, record.getMin_temp_c());
pdv.setFloat(ALTIM, record.getAltim_in_hg());
if (record.getRemarks() != null)
pdv.setString(REMARKS, record.getRemarks());
if (record.getSequenceId() != null)
pdv.setInt(SEQID, record.getSequenceId());
if (record.getEndDate() != null)
pdv.setLong(END_DATE, record.getEndDate().getTime().getTime());
if (record.getStartDate() != null)
pdv.setLong(START_DATE, record.getStartDate().getTime().getTime());
if (record.getTransitionEndDate() != null)
pdv.setLong(TRANS_END_DATE, record.getTransitionEndDate().getTime().getTime());
if (record.getVisibility_mi() != null)
pdv.setFloat(VISIBILITY, record.getVisibility_mi());
pdv.setFloat(VERT_VISIBILITY, record.getVert_vis_ft());
if (record.getWind_dir_degrees() != null)
pdv.setFloat(WIND_DIR, record.getWind_dir_degrees());
if (record.getWind_gust_kt() != null)
pdv.setFloat(WIND_GUST, record.getWind_gust_kt());
if (record.getWind_speed_kt() != null)
pdv.setFloat(WIND_SPEED, record.getWind_speed_kt());
if (record.getWind_shear_dir_degrees() != null)
pdv.setFloat(SHEAR_WIND_DIR, record.getWind_shear_dir_degrees());
if (record.getWind_shear_speed_kt() != null)
pdv.setFloat(SHEAR_WIND_SPEED, record.getWind_shear_speed_kt());
if (record.getWind_shear_hgt_ft_agl() != null)
pdv.setFloat(SHEAR_WIND_HGT, record.getWind_shear_hgt_ft_agl());
// Set low level wind shear forecast flag
if ((record.getWind_shear_hgt_ft_agl() != IDecoderConstantsN.NEGATIVE_FLOAT_MISSING)
&& (record.getWind_shear_dir_degrees() != IDecoderConstantsN.NEGATIVE_FLOAT_MISSING)
&& (record.getWind_shear_speed_kt() != IDecoderConstantsN.NEGATIVE_FLOAT_MISSING))
pdv.setInt(LOW_LEVEL_WIND_SHEAR_FLAG, 1);
pdv.setFloat(PROBABLE_VISIBILITY, record.getProbable_visibility_mi());
pdv.setFloat(PROBABLE_VERT_VISIBILITY, record.getProbable_vert_vis_ft());
pdv.setFloat(PROBABLE_WIND_DIR, record.getProbable_wind_dir_degrees());
pdv.setFloat(PROBABLE_WIND_GUST, record.getProbable_wind_gust_kt());
pdv.setFloat(PROBABLE_WIND_SPEED, record.getProbable_wind_speed_kt());
pdv.setFloat(PROBABLE_SHEAR_WIND_DIR, record.getProbable_wind_shear_dir_degrees());
pdv.setFloat(PROBABLE_SHEAR_WIND_SPEED, record.getProbable_wind_shear_speed_kt());
pdv.setFloat(PROBABLE_SHEAR_WIND_HGT, record.getProbable_wind_shear_hgt_ft_agl());
String reportIssueTime = record.getIssue_timeString();
if (reportIssueTime != null && reportIssueTime.length() == 7) {
reportIssueTime = reportIssueTime.substring(2, reportIssueTime.length()-1);
pdv.setInt(STIM, Integer.parseInt(reportIssueTime));
}
int index = 0;
if (record.getIcing_layers() != null) {
Iterator<NcTafIcingLayer> icngLyrs = record.getIcing_layers().iterator();
if (icngLyrs != null ) {
while (icngLyrs.hasNext()) {
NcTafIcingLayer icngLyr = icngLyrs.next();
if (index < maxIcngLyr ) {
if (icngLyr.getIcing_intensity() != null)
pdv.setInt(ICNG_INTENSITY, icngLyr.getIcing_intensity(), index);
if (icngLyr.getIcing_max_alt_ft_agl() != null)
pdv.setInt(ICNG_MAX_ALT, icngLyr.getIcing_max_alt_ft_agl(), index);
if (icngLyr.getIcing_min_alt_ft_agl() != null)
pdv.setInt(ICNG_MIN_ALT, icngLyr.getIcing_min_alt_ft_agl(), index);
index++;
}
}
pdv.setInt ("numICNG", index);
}
}
index = 0;
if (record.getSky_cover() != null) {
Iterator<NcTafSkyCover> skyCvrs = record.getSky_cover().iterator();
if (skyCvrs != null ) {
while (skyCvrs.hasNext()) {
NcTafSkyCover skyCvr = skyCvrs.next();
if (index < maxSkyCover ) {
if (skyCvr.getHeight() != null)
pdv.setFloat(SCVR_HGT, skyCvr.getHeight(), index);
if (skyCvr.getType() != null)
pdv.setString(SCVR_TYPE, skyCvr.getType(), index);
if (skyCvr.getGenus() != null)
pdv.setString(SCVR_GENUS, skyCvr.getGenus(), index);
index++;
}
}
pdv.setInt ("numSCVR", index);
}
// Set ceiling
float ceiling = NcTafRecord.getCeiling(record.getSky_cover(), record.getVert_vis_ft());
if (ceiling != IDecoderConstantsN.NEGATIVE_FLOAT_MISSING)
pdv.setFloat(CEILING, ceiling);
}
index = 0;
if (record.getProbable_sky_cover() != null) {
Iterator<NcTafSkyCover> skyCvrs = record.getProbable_sky_cover().iterator();
if (skyCvrs != null ) {
while (skyCvrs.hasNext()) {
NcTafSkyCover skyCvr = skyCvrs.next();
if (index < maxSkyCover ) {
if (skyCvr.getHeight() != null)
pdv.setFloat(PROBABLE_SCVR_HGT, skyCvr.getHeight(), index);
if (skyCvr.getType() != null)
pdv.setString(PROBABLE_SCVR_TYPE, skyCvr.getType(), index);
if (skyCvr.getGenus() != null)
pdv.setString(PROBABLE_SCVR_GENUS, skyCvr.getGenus(), index);
index++;
}
}
pdv.setInt ("numPROBABLE_SCVR", index);
}
// Set probable ceiling (TEMPO/PROB)
float probableCeiling = NcTafRecord.getCeiling(record.getProbable_sky_cover(), record.getProbable_vert_vis_ft());
if (probableCeiling != IDecoderConstantsN.NEGATIVE_FLOAT_MISSING)
pdv.setFloat(PROBABLE_CEILING, probableCeiling);
}
index = 0;
if (record.getTemp_forecasts() != null) {
Iterator<NcTafTemperatureForecast> tmpFcsts = record.getTemp_forecasts().iterator();
if (tmpFcsts != null ) {
while (tmpFcsts.hasNext()) {
NcTafTemperatureForecast tmpFcst = tmpFcsts.next();
if (index < maxTempFcst ) {
if (tmpFcst.getSfc_temp_c() != null)
pdv.setFloat(TMPFCST_VALID_TIME, tmpFcst.getSfc_temp_c(), index);
if (tmpFcst.getValid_time() != null)
pdv.setFloat(TMPFCST_TEMP, tmpFcst.getValid_time(), index);
index++;
}
}
pdv.setInt ("numTMPFCST", index);
}
}
index = 0;
if (record.getTurbulence_layers() != null) {
Iterator<NcTafTurbulenceLayer> turbLyrs = record.getTurbulence_layers().iterator();
if (turbLyrs != null ) {
while (turbLyrs.hasNext()) {
NcTafTurbulenceLayer turbLyr = turbLyrs.next();
if (index < maxTurbFcst ) {
if (turbLyr.getTurbulence_intensity() != null)
pdv.setFloat(TURB_INTENSITY, turbLyr.getTurbulence_intensity(), index);
if (turbLyr.getTurbulence_max_alt_ft_agl() != null)
pdv.setFloat(TURB_MAX_ALT, turbLyr.getTurbulence_max_alt_ft_agl(), index);
if (turbLyr.getTurbulence_min_alt_ft_agl() != null)
pdv.setFloat(TURB_MIN_ALT, turbLyr.getTurbulence_min_alt_ft_agl(), index);
index++;
}
}
pdv.setInt ("numTURB", index);
}
}
index = 0;
if (record.getWeather() != null) {
Iterator<NcTafWeatherCondition> wthrConds = record.getWeather().iterator();
if (wthrConds != null ) {
while (wthrConds.hasNext()) {
NcTafWeatherCondition wthrCond = wthrConds.next();
if (index < maxWthrCond ) {
if (wthrCond.getDescriptor() != null)
pdv.setString(WTHRCOND_DESCRIPTOR, wthrCond.getDescriptor(), index);
if (wthrCond.getIntensityProximity() != null)
pdv.setString(WTHRCOND_INTSTY_PRXMTY, wthrCond.getIntensityProximity(), index);
if (wthrCond.getObscuration() != null)
pdv.setString(WTHRCOND_OBSCURATION, wthrCond.getObscuration(), index);
if (wthrCond.getOther() != null)
pdv.setString(WTHRCOND_OTHER, wthrCond.getOther(), index);
if (wthrCond.getPrecipitation() != null)
pdv.setString(WTHRCOND_PRECIPITATION, wthrCond.getPrecipitation(), index);
index++;
}
}
pdv.setInt ("numWTHRCOND", index);
}
}
// Write this data in "backwards" so that the plot model stuff
// displays correctly.
if (record.getWeather() != null) {
int i = record.getWeather().size() - 1;
for (NcTafWeatherCondition wc : record.getWeather()) {
pdv.setString(PRES_WEATHER, wc.toCanonicalForm(), i--);
}
}
index = 0;
if (record.getProbable_weather() != null) {
Iterator<NcTafWeatherCondition> wthrConds = record.getProbable_weather().iterator();
if (wthrConds != null ) {
while (wthrConds.hasNext()) {
NcTafWeatherCondition wthrCond = wthrConds.next();
if (index < maxWthrCond ) {
if (wthrCond.getDescriptor() != null)
pdv.setString(PROBABLE_WTHRCOND_DESCRIPTOR, wthrCond.getDescriptor(), index);
if (wthrCond.getIntensityProximity() != null)
pdv.setString(PROBABLE_WTHRCOND_INTSTY_PRXMTY, wthrCond.getIntensityProximity(), index);
if (wthrCond.getObscuration() != null)
pdv.setString(PROBABLE_WTHRCOND_OBSCURATION, wthrCond.getObscuration(), index);
if (wthrCond.getOther() != null)
pdv.setString(PROBABLE_WTHRCOND_OTHER, wthrCond.getOther(), index);
if (wthrCond.getPrecipitation() != null)
pdv.setString(PROBABLE_WTHRCOND_PRECIPITATION, wthrCond.getPrecipitation(), index);
index++;
}
}
pdv.setInt ("numPROBABLE_WTHRCOND", index);
}
}
// Write this data in "backwards" so that the plot model stuff
// displays correctly.
if (record.getProbable_weather() != null) {
int i = record.getProbable_weather().size() - 1;
for (NcTafWeatherCondition wc : record.getWeather()) {
pdv.setString(PROBABLE_PRES_WEATHER, wc.toCanonicalForm(), i--);
}
}
return pdv;
}
}

View file

@ -0,0 +1,487 @@
/**
* NcTafToRecord
*
* This java class provides a transform from point data to
* NcTafRecord.
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- -----------------------
* 09/23/2011 458 S. Gurung Initial Creation
* 09/29/2011 S. Gurung Added REPORTTYPE
* 10/26/2011 S. Gurung Added probable parameters (for TEMPO/PROB)
* 11/03/2011 S. Gurung Added additional parameters and renamed some parameters
* 11/07/2011 S. Gurung Added LOW_LEVEL_WIND_SHEAR
*
* </pre>
*
* This code has been developed by the SIB for use in the AWIPS2 system.
* @author S. Gurung
* @version 1.0
*/
package gov.noaa.nws.ncep.common.dataplugin.nctaf.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.raytheon.uf.common.pointdata.PointDataContainer;
import com.raytheon.uf.common.pointdata.PointDataView;
import com.raytheon.uf.common.pointdata.spatial.SurfaceObsLocation;
import com.raytheon.uf.edex.decodertools.time.TimeTools;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafIcingLayer;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafRecord;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafSkyCover;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTemperatureForecast;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafTurbulenceLayer;
import gov.noaa.nws.ncep.common.dataplugin.nctaf.NcTafWeatherCondition;
public class NcTafToRecord {
/** The logger */
private static Log logger = LogFactory.getLog(NcTafToRecord.class);
private static final String LONGITUDE = "longitude";
private static final String LATITUDE = "latitude";
private static final String ELEVATION = "elevation";
public static final String HDR_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
sb.append("DATAURI,");
sb.append("WMOHEADER,");
sb.append("TAFTEXT,");
sb.append("REPORTTYPE,");
sb.append("STID,");
sb.append("CORR,");
sb.append("AMD,");
sb.append("ISSUETIME,");
sb.append("ISSUETIMESTR,");
sb.append("BULLETINTIME,");
sb.append("CGRP,");
sb.append("IND,");
sb.append("PROB,");
sb.append("MAX_TEMP,");
sb.append("MIN_TEMP,");
sb.append("ALTIM,");
sb.append("REMARKS,");
sb.append("SEQID,");
sb.append("END_DATE,");
sb.append("START_DATE,");
sb.append("TRANS_END_DATE,");
sb.append("VISIBILITY,");
sb.append("VERT_VISIBILITY,");
sb.append("WIND_DIR,");
sb.append("WIND_GUST,");
sb.append("WIND_SPEED,");
sb.append("SHEAR_WIND_DIR,");
sb.append("SHEAR_WIND_SPEED,");
sb.append("SHEAR_WIND_HGT,");
sb.append("LOW_LEVEL_WIND_SHEAR,");
sb.append("CEILING,");
sb.append("PROBABLE_CEILING,");
sb.append("PROBABLE_VISIBILITY,");
sb.append("PROBABLE_VERT_VISIBILITY,");
sb.append("PROBABLE_WIND_DIR,");
sb.append("PROBABLE_WIND_GUST,");
sb.append("PROBABLE_WIND_SPEED,");
sb.append("PROBABLE_SHEAR_WIND_DIR,");
sb.append("PROBABLE_SHEAR_WIND_SPEED,");
sb.append("PROBABLE_SHEAR_WIND_HGT,");
HDR_PARAMS_LIST = sb.toString();
}
public static final String MAN_PARAMS_LIST;
static {
StringBuffer sb = new StringBuffer();
sb.append(HDR_PARAMS_LIST);
//-------------------------
sb.append("numICNG,");
sb.append("ICNG_INTENSITY,");
sb.append("ICNG_MAX_ALT,");
sb.append("ICNG_MIN_ALT,");
//-------------------------
sb.append("numSCVR,");
sb.append("SCVR_HGT,");
sb.append("SCVR_TYPE,");
sb.append("SCVR_GENUS,");
//-------------------------
sb.append("numPROBABLE_SCVR,");
sb.append("PROBABLE_SCVR_HGT,");
sb.append("PROBABLE_SCVR_TYPE,");
sb.append("PROBABLE_SCVR_GENUS,");
//-------------------------
sb.append("numTMPFCST,");
sb.append("TMPFCST_VALID_TIME,");
sb.append("TMPFCST_TEMP,");
//-------------------------
sb.append("numTURB,");
sb.append("TURB_INTENSITY,");
sb.append("TURB_MAX_ALT,");
sb.append("TURB_MIN_ALT,");
//-------------------------
sb.append("numWTHRCOND,");
sb.append("WTHRCOND_DESCRIPTOR,");
sb.append("WTHRCOND_INTSTY_PRXMTY,");
sb.append("WTHRCOND_OBSCURATION,");
sb.append("WTHRCOND_OTHER,");
sb.append("WTHRCOND_PRECIPITATION");
sb.append("PRES_WEATHER");
//-------------------------
sb.append("numPROBABLE_WTHRCOND,");
sb.append("PROBABLE_WTHRCOND_DESCRIPTOR,");
sb.append("PROBABLE_WTHRCOND_INTSTY_PRXMTY,");
sb.append("PROBABLE_WTHRCOND_OBSCURATION,");
sb.append("PROBABLE_WTHRCOND_OTHER,");
sb.append("PROBABLE_WTHRCOND_PRECIPITATION");
sb.append("PROBABLE_PRES_WEATHER");
//-------------------------
MAN_PARAMS_LIST = sb.toString();
}
private static NcTafRecord getNcTafRecord(PointDataView pdv) {
NcTafRecord record = null;
if (pdv != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("DATAURI")) {
String uri = pdv.getString("DATAURI");
logger.debug("URI = " + uri);
record = new NcTafRecord(uri);
}
else{
logger.debug("No DATAURI");
record = new NcTafRecord();
}
if (parameters.contains("WMOHEADER"))
record.setWmoHeader(pdv.getString("WMOHEADER"));
if (parameters.contains("TAFTEXT")) {
record.setTafText(pdv.getString("TAFTEXT"));
}
if (parameters.contains("REPORTTYPE"))
record.setReportType(pdv.getString("REPORTTYPE"));
if (parameters.contains("STID"))
record.setStationId(pdv.getString("STID"));
SurfaceObsLocation loc = new SurfaceObsLocation(pdv.getString("STID"));
Double lat = pdv.getNumber(LATITUDE).doubleValue();
Double lon = pdv.getNumber(LONGITUDE).doubleValue();
loc.assignLocation(lat, lon);
loc.setElevation(pdv.getNumber(ELEVATION).intValue());
record.setLocation(loc);
if (parameters.contains("CORR"))
record.setCorIndicator(pdv.getString("CORR"));
if (parameters.contains("AMD"))
record.setAmdIndicator(pdv.getString("AMD"));
if (parameters.contains("ISSUETIME")) {
long vt = pdv.getNumber("ISSUETIME").longValue();
record.setIssue_time(new Date(vt));
}
if (parameters.contains("ISSUETIMESTR"))
record.setIssue_timeString(pdv.getString("ISSUETIMESTR"));
if (parameters.contains("BULLETINTIME")) {
long vt = pdv.getNumber("BULLETINTIME").longValue();
record.setBulletin_time(new Date(vt));
}
if (parameters.contains("REMARKS"))
record.setRemarks(pdv.getString("REMARKS"));
if (parameters.contains("IND"))
record.setChange_indicator(pdv.getString("IND"));
if (parameters.contains("CGRP"))
record.setChangeGroup(pdv.getString("CGRP"));
if (parameters.contains("PROB"))
record.setProbability(pdv.getInt("PROB"));
if (parameters.contains("MAX_TEMP"))
record.setMax_temp_c(pdv.getInt("MAX_TEMP"));
if (parameters.contains("MIN_TEMP"))
record.setMin_temp_c(pdv.getInt("MIN_TEMP"));
if (parameters.contains("ALTIM"))
record.setAltim_in_hg(pdv.getFloat("ALTIM"));
if (parameters.contains("REMARKS"))
record.setRemarks(pdv.getString("REMARKS"));
if (parameters.contains("SEQID"))
record.setSequenceId(pdv.getInt("SEQID"));
if (parameters.contains("END_DATE")) {
long vt = pdv.getNumber("END_DATE").longValue();
record.setEndDate(TimeTools.newCalendar(vt));
}
if (parameters.contains("START_DATE")) {
long vt = pdv.getNumber("START_DATE").longValue();
record.setStartDate(TimeTools.newCalendar(vt));
}
if (parameters.contains("TRANS_END_DATE")) {
long vt = pdv.getNumber("TRANS_END_DATE").longValue();
record.setTransitionEndDate(TimeTools.newCalendar(vt));
}
if (parameters.contains("VISIBILITY"))
record.setVisibility_mi(pdv.getFloat("VISIBILITY"));
if (parameters.contains("VERT_VISIBILITY"))
record.setVert_vis_ft(pdv.getFloat("VERT_VISIBILITY"));
if (parameters.contains("WIND_DIR"))
record.setWind_dir_degrees(pdv.getFloat("WIND_DIR"));
if (parameters.contains("WIND_GUST"))
record.setWind_gust_kt(pdv.getFloat("WIND_GUST"));
if (parameters.contains("WIND_SPEED"))
record.setWind_speed_kt(pdv.getFloat("WIND_SPEED"));
if (parameters.contains("SHEAR_WIND_DIR"))
record.setWind_shear_dir_degrees(pdv.getFloat("SHEAR_WIND_DIR"));
if (parameters.contains("SHEAR_WIND_SPEED"))
record.setWind_shear_speed_kt(pdv.getFloat("SHEAR_WIND_SPEED"));
if (parameters.contains("SHEAR_WIND_HGT"))
record.setWind_shear_hgt_ft_agl(pdv.getFloat("SHEAR_WIND_HGT"));
if (parameters.contains("PROBABLE_VISIBILITY"))
record.setProbable_visibility_mi(pdv.getFloat("PROBABLE_VISIBILITY"));
if (parameters.contains("PROBABLE_VERT_VISIBILITY"))
record.setProbable_vert_vis_ft(pdv.getFloat("PROBABLE_VERT_VISIBILITY"));
if (parameters.contains("PROBABLE_WIND_DIR"))
record.setProbable_wind_dir_degrees(pdv.getFloat("PROBABLE_WIND_DIR"));
if (parameters.contains("PROBABLE_WIND_GUST"))
record.setProbable_wind_gust_kt(pdv.getFloat("PROBABLE_WIND_GUST"));
if (parameters.contains("PROBABLE_WIND_SPEED"))
record.setProbable_wind_speed_kt(pdv.getFloat("PROBABLE_WIND_SPEED"));
if (parameters.contains("PROBABLE_SHEAR_WIND_DIR"))
record.setProbable_wind_shear_dir_degrees(pdv.getFloat("PROBABLE_SHEAR_WIND_DIR"));
if (parameters.contains("PROBABLE_SHEAR_WIND_SPEED"))
record.setProbable_wind_shear_speed_kt(pdv.getFloat("PROBABLE_SHEAR_WIND_SPEED"));
if (parameters.contains("PROBABLE_SHEAR_WIND_HGT"))
record.setProbable_wind_shear_hgt_ft_agl(pdv.getFloat("PROBABLE_SHEAR_WIND_HGT"));
}
return record;
}
private static NcTafRecord getIcingLayerData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numICNG")) {
Number numICNG = pdv.getInt("numICNG");
if (numICNG != null) {
Number[] intensity, maxAlt, minAlt;
intensity = pdv.getNumberAllLevels("ICNG_INTENSITY");
maxAlt = pdv.getNumberAllLevels("ICNG_MAX_ALT");
minAlt = pdv.getNumberAllLevels("ICNG_MIN_ALT");
for (int i = 0; i < numICNG.intValue(); i++) {
NcTafIcingLayer icngLyr = new NcTafIcingLayer();
icngLyr.setIcing_intensity(intensity[i].intValue());
icngLyr.setIcing_max_alt_ft_agl(maxAlt[i].intValue());
icngLyr.setIcing_min_alt_ft_agl(minAlt[i].intValue());
record.addIcing_layer(icngLyr);
}
}
}
}
return record;
}
private static NcTafRecord getWeatherConditionData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numWTHRCOND")) {
Number numWTHRCOND = pdv.getInt("numWTHRCOND");
if (numWTHRCOND != null) {
Number[] desc, intPrxty, obscur, other, precip;
desc = pdv.getNumberAllLevels("WTHRCOND_DESCRIPTOR");
intPrxty = pdv.getNumberAllLevels("WTHRCOND_INTSTY_PRXMTY");
obscur = pdv.getNumberAllLevels("WTHRCOND_OBSCURATION");
other = pdv.getNumberAllLevels("WTHRCOND_OTHER");
precip = pdv.getNumberAllLevels("WTHRCOND_PRECIPITATION");
for (int i = 0; i < numWTHRCOND.intValue(); i++) {
NcTafWeatherCondition wthrCond = new NcTafWeatherCondition();
wthrCond.setDescriptor(desc[i].toString());
wthrCond.setIntensityProximity(intPrxty[i].toString());
wthrCond.setObscuration(obscur[i].toString());
wthrCond.setOther(other[i].toString());
wthrCond.setPrecipitation(precip[i].toString());
record.addWeather(wthrCond);
}
}
}
}
return record;
}
private static NcTafRecord getProbableWeatherConditionData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numPROBABLE_WTHRCOND")) {
Number numWTHRCOND = pdv.getInt("numPROBABLE_WTHRCOND");
if (numWTHRCOND != null) {
Number[] desc, intPrxty, obscur, other, precip;
desc = pdv.getNumberAllLevels("PROBABLE_WTHRCOND_DESCRIPTOR");
intPrxty = pdv.getNumberAllLevels("PROBABLE_WTHRCOND_INTSTY_PRXMTY");
obscur = pdv.getNumberAllLevels("PROBABLE_WTHRCOND_OBSCURATION");
other = pdv.getNumberAllLevels("PROBABLE_WTHRCOND_OTHER");
precip = pdv.getNumberAllLevels("PROBABLE_WTHRCOND_PRECIPITATION");
for (int i = 0; i < numWTHRCOND.intValue(); i++) {
NcTafWeatherCondition wthrCond = new NcTafWeatherCondition();
wthrCond.setDescriptor(desc[i].toString());
wthrCond.setIntensityProximity(intPrxty[i].toString());
wthrCond.setObscuration(obscur[i].toString());
wthrCond.setOther(other[i].toString());
wthrCond.setPrecipitation(precip[i].toString());
record.addProbable_weather(wthrCond);
}
}
}
}
return record;
}
private static NcTafRecord getTurbulenceLayerData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numTURB")) {
Number numTURB = pdv.getInt("numTURB");
if (numTURB != null) {
Number[] intensity, maxAlt, minAlt;
intensity = pdv.getNumberAllLevels("TURB_INTENSITY");
maxAlt = pdv.getNumberAllLevels("TURB_MAX_ALT");
minAlt = pdv.getNumberAllLevels("TURB_MIN_ALT");
for (int i = 0; i < numTURB.intValue(); i++) {
NcTafTurbulenceLayer turbLyr = new NcTafTurbulenceLayer();
turbLyr.setTurbulence_intensity(intensity[i].intValue());
turbLyr.setTurbulence_max_alt_ft_agl(maxAlt[i].intValue());
turbLyr.setTurbulence_min_alt_ft_agl(minAlt[i].intValue());
record.addTurbulence_layer(turbLyr);
}
}
}
}
return record;
}
private static NcTafRecord getTemperatureForecastData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numTMPFCST")) {
Number numTMPFCST = pdv.getInt("numTMPFCST");
if (numTMPFCST != null) {
Number[] time, temp;
time = pdv.getNumberAllLevels("TMPFCST_VALID_TIME");
temp = pdv.getNumberAllLevels("TMPFCST_TEMP");
for (int i = 0; i < numTMPFCST.intValue(); i++) {
NcTafTemperatureForecast tempFcst = new NcTafTemperatureForecast();
tempFcst.setValid_time(time[i].intValue());
tempFcst.setSfc_temp_c(temp[i].intValue());
record.addTemp_forecast(tempFcst);
}
}
}
}
return record;
}
private static NcTafRecord getSkyCoverData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numSCVR")) {
Number numSCVR = pdv.getInt("numSCVR");
if (numSCVR != null) {
Number[] height, type, genus;
height = pdv.getNumberAllLevels("SCVR_HGT");
type = pdv.getNumberAllLevels("SCVR_TYPE");
genus = pdv.getNumberAllLevels("SCVR_GENUS");
for (int i = 0; i < numSCVR.intValue(); i++) {
NcTafSkyCover skyCvr = new NcTafSkyCover();
skyCvr.setHeight(height[i].intValue());
skyCvr.setType(type[i].toString());
skyCvr.setGenus(genus[i].toString());
record.addSky_cover(skyCvr);
}
}
}
}
return record;
}
private static NcTafRecord getProbableSkyCoverData(PointDataView pdv, NcTafRecord record) {
if (record != null) {
Set<String> parameters = pdv.getContainer().getParameters();
if (parameters.contains("numPROBABLE_SCVR")) {
Number numSCVR = pdv.getInt("numPROBABLE_SCVR");
if (numSCVR != null) {
Number[] height, type, genus;
height = pdv.getNumberAllLevels("PROBABLE_SCVR_HGT");
type = pdv.getNumberAllLevels("PROBABLE_SCVR_TYPE");
genus = pdv.getNumberAllLevels("PROBABLE_SCVR_GENUS");
for (int i = 0; i < numSCVR.intValue(); i++) {
NcTafSkyCover skyCvr = new NcTafSkyCover();
skyCvr.setHeight(height[i].intValue());
skyCvr.setType(type[i].toString());
skyCvr.setGenus(genus[i].toString());
record.addProbable_sky_cover(skyCvr);
}
}
}
}
return record;
}
public static NcTafRecord [] toNcTafRecords(PointDataContainer container) {
List<NcTafRecord> records = new ArrayList<NcTafRecord>();
container.setCurrentSz(container.getAllocatedSz());
for (int i = 0; i < container.getCurrentSz(); i++) {
PointDataView pdv = container.readRandom(i);
NcTafRecord record = getNcTafRecord(pdv);
record = getIcingLayerData(pdv, record);
record = getSkyCoverData(pdv, record);
record = getProbableSkyCoverData(pdv, record);
record = getTemperatureForecastData(pdv, record);
record = getTurbulenceLayerData(pdv, record);
record = getWeatherConditionData(pdv, record);
record = getProbableWeatherConditionData(pdv, record);
records.add(record);
}
return records.toArray(new NcTafRecord[records.size()]);
}
}

View file

@ -0,0 +1 @@
package gov.noaa.nws.ncep.common.dataplugin.nctaf.dao;

View file

@ -0,0 +1 @@
package gov.noaa.nws.ncep.common.dataplugin.nctaf;

Some files were not shown because too many files have changed in this diff Show more