Skip to content

Commit

Permalink
Bug fix/quadrant order (#101)
Browse files Browse the repository at this point in the history
* adding bias correction matrix for RMW forecast computation

* adding bias correction of vmax, lat, and radii for RMW regression forecast

* keeping bias corrected value of radii from previous timestep if preserving it

* changing reference files to pass tests

* quadrant order is clockwise from NE, i.e., NE, SE, SW, NW. SW and NW were in the wrong order
  • Loading branch information
WPringle authored and SorooshMani-NOAA committed Aug 7, 2024
1 parent e9e1ae2 commit 5e780d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions stormevents/nhc/atcf.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
# RAD2 - If full circle this field not used, If semicicle, radius (nm) of specified wind intensity for semicircle not specified in radius code, If quadrant, radius (nm) of specified wind intensity for 2nd quadrant (counting clockwise from quadrant specified in radius code). 0 through 1200 nm.
"RAD2": "isotach_radius_for_SEQ",
# RAD3 - If full circle or semicircle this field not used, If quadrant, radius (nm) of specified wind intensity for 3rd quadrant (counting clockwise from quadrant specified in radius code). 0 through 1200 nm.
"RAD3": "isotach_radius_for_NWQ",
"RAD3": "isotach_radius_for_SWQ",
# RAD4 - If full circle or semicircle this field not used, If quadrant, radius (nm) of specified wind intensity for 4th quadrant (counting clockwise from quadrant specified in radius code). 0 through 1200 nm.
"RAD4": "isotach_radius_for_SWQ",
"RAD4": "isotach_radius_for_NWQ",
# RADP - pressure in millibars of the last closed isobar, 900 - 1050 mb.
"RADP": "background_pressure",
# RRP - radius of the last closed isobar in nm, 0 - 9999 nm.
Expand Down Expand Up @@ -127,9 +127,9 @@
# SEAS2 - second quadrant seas radius as defined by SEASCODE, 0 through 999 nm.
"SEAS2": "isowave_radius_for_SEQ",
# SEAS3 - third quadrant seas radius as defined by SEASCODE, 0 through 999 nm.
"SEAS3": "isowave_radius_for_NWQ",
"SEAS3": "isowave_radius_for_SWQ",
# SEAS4 - fourth quadrant seas radius as defined by SEASCODE, 0 through 999 nm.
"SEAS4": "isowave_radius_for_SWQ",
"SEAS4": "isowave_radius_for_NWQ",
# user data section as indicated by USERDEFINED parameter.
"USERDEFINED": "extra_values",
}
Expand Down
18 changes: 9 additions & 9 deletions stormevents/nhc/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,12 @@ def atcf(self, advisory: ATCF_Advisory = None) -> DataFrame:
atcf["isotach_radius_for_SEQ"] = (
atcf["isotach_radius_for_SEQ"].astype("string").str.pad(5)
)
atcf["isotach_radius_for_NWQ"] = (
atcf["isotach_radius_for_NWQ"].astype("string").str.pad(5)
)
atcf["isotach_radius_for_SWQ"] = (
atcf["isotach_radius_for_SWQ"].astype("string").str.pad(5)
)
atcf["isotach_radius_for_NWQ"] = (
atcf["isotach_radius_for_NWQ"].astype("string").str.pad(5)
)

atcf["background_pressure"].fillna(method="ffill", inplace=True)
atcf["background_pressure"] = atcf["background_pressure"].astype(int)
Expand Down Expand Up @@ -686,12 +686,12 @@ def atcf(self, advisory: ATCF_Advisory = None) -> DataFrame:
atcf["isowave_radius_for_SEQ"] = (
atcf["isowave_radius_for_SEQ"].astype("string").str.pad(5)
)
atcf["isowave_radius_for_NWQ"] = (
atcf["isowave_radius_for_NWQ"].astype("string").str.pad(5)
)
atcf["isowave_radius_for_SWQ"] = (
atcf["isowave_radius_for_SWQ"].astype("string").str.pad(5)
)
atcf["isowave_radius_for_NWQ"] = (
atcf["isowave_radius_for_NWQ"].astype("string").str.pad(5)
)

for column in atcf.select_dtypes(include=["string"]).columns:
atcf[column] = atcf[column].str.replace(
Expand Down Expand Up @@ -823,9 +823,9 @@ def isotachs(
# enumerate quadrants
quadrant_names = [
"isotach_radius_for_NEQ",
"isotach_radius_for_NWQ",
"isotach_radius_for_SWQ",
"isotach_radius_for_SEQ",
"isotach_radius_for_SWQ",
"isotach_radius_for_NWQ",
]

# convert quadrant radii from nautical miles to meters
Expand All @@ -847,7 +847,7 @@ def isotachs(
start_angle = 0 + rotation_angle
end_angle = 90 + rotation_angle

# append quadrants in counter-clockwise direction from NEQ
# append quadrants in clockwise direction from NEQ
quadrants = []
for quadrant_name in quadrant_names:
# skip if quadrant radius is zero
Expand Down

0 comments on commit 5e780d9

Please sign in to comment.