From 5e780d94f1d354076d94d296a16a630b46c8ca7d Mon Sep 17 00:00:00 2001 From: William Pringle Date: Mon, 24 Jun 2024 13:25:52 -0500 Subject: [PATCH] Bug fix/quadrant order (#101) * 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 --- stormevents/nhc/atcf.py | 8 ++++---- stormevents/nhc/track.py | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/stormevents/nhc/atcf.py b/stormevents/nhc/atcf.py index e6420a6..2e3f0ca 100644 --- a/stormevents/nhc/atcf.py +++ b/stormevents/nhc/atcf.py @@ -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. @@ -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", } diff --git a/stormevents/nhc/track.py b/stormevents/nhc/track.py index e7b23ee..1afa596 100644 --- a/stormevents/nhc/track.py +++ b/stormevents/nhc/track.py @@ -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) @@ -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( @@ -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 @@ -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