Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[main_aqm] fix: persistence flag always evaluates to false #1148

Draft
wants to merge 4 commits into
base: main_aqm
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions ush/generate_fire_emissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Workflow
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def generate_emiss_workflow(staticdir, ravedir, intp_dir, predef_grid, ebb_dcycle, restart_interval, persistence):
def generate_emiss_workflow(staticdir, ravedir, intp_dir, predef_grid, ebb_dcycle, restart_interval, persistence_flag):

# staticdir: path to FIX files
# ravedir: path to RAVE fire data files (hourly), typically workding directory (DATA)
Expand All @@ -40,7 +40,8 @@ def generate_emiss_workflow(staticdir, ravedir, intp_dir, predef_grid, ebb_dcycl
vars_emis = ["FRP_MEAN","FRE"]
cols, rows = (2700, 3950) if predef_grid == 'RRFS_NA_3km' else (1092, 1820)
print('PREDEF GRID',predef_grid,'cols,rows',cols,rows)
print('WARNING, EBB_DCYCLE set to', ebb_dcycle, 'and persistence=', persistence, 'if persistence is false, emissions comes from same day satellite obs')
persistence = convert_string_flag_to_boolean(persistence_flag)
print('WARNING, EBB_DCYCLE set to', ebb_dcycle, 'and persistence=', persistence, 'if persistence is False, emissions comes from same day satellite obs')
#used later when working with ebb_dcyle 1 or 2
ebb_dcycle = float(ebb_dcycle)

Expand Down Expand Up @@ -102,6 +103,17 @@ def generate_emiss_workflow(staticdir, ravedir, intp_dir, predef_grid, ebb_dcycl
print('First day true, no RAVE files available. Use dummy emissions file')
i_tools.create_dummy(intp_dir, current_day, tgt_latt, tgt_lont, cols, rows)


def convert_string_flag_to_boolean(flag: str) -> bool:
lowered = flag.lower()
if lowered == 'true':
return True
elif lowered == 'false':
return False
else:
raise ValueError('Boolean flag not recognized. Acceptable values are true, TRUE, false, or FALSE')


if __name__ == '__main__':

print('')
Expand Down
2 changes: 1 addition & 1 deletion ush/interp_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def date_range(current_day, ebb_dcycle, persistence):

if ebb_dcycle == 1:
print('Find RAVE for ebb_dcyc 1')
if persistence == True:
if persistence:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohanaRomeroAlvarez - The persistence block is now entered. I attached a smoke_dust log smoke_dust_2019072200.log that shows this. It probably makes sense for you to test, since I'm not sure what behavior is expected. Mostly I'm wondering if persistence should apply on the first day and the dummy emissions file should be input: First day true, no RAVE files available. Use dummy emissions file.

# Start date range from one day prior if persistence is True
print('Creating emissions for persistence method where satellite FRP persist from previous day')
start_datetime = fcst_datetime - dt.timedelta(days=1)
Expand Down