|
2 | 2 |
|
3 | 3 | @author: mmacferrin |
4 | 4 | """ |
| 5 | + |
5 | 6 | #!/usr/bin/env python3 |
6 | 7 |
|
7 | 8 | import datetime |
@@ -254,19 +255,21 @@ def plot_current_year_melt_over_baseline_stats( |
254 | 255 | and ((current_doy < doy_start) or (current_doy > doy_end)) |
255 | 256 | ): |
256 | 257 | current_date = datetime.datetime( |
257 | | - year=(current_date.year - 1) |
258 | | - if ((current_doy < doy_start) and (doy_start < doy_end)) |
259 | | - else current_date.year, |
| 258 | + year=( |
| 259 | + (current_date.year - 1) |
| 260 | + if ((current_doy < doy_start) and (doy_start < doy_end)) |
| 261 | + else current_date.year |
| 262 | + ), |
260 | 263 | month=doy_end[0], |
261 | 264 | day=doy_end[1], |
262 | 265 | ) |
263 | 266 | current_doy = doy_end |
264 | 267 |
|
265 | 268 | # Convert the start date to a datetime object |
266 | 269 | datetime_start = datetime.datetime( |
267 | | - year=current_date.year |
268 | | - if (current_doy > doy_start) |
269 | | - else (current_date.year - 1), |
| 270 | + year=( |
| 271 | + current_date.year if (current_doy > doy_start) else (current_date.year - 1) |
| 272 | + ), |
270 | 273 | month=doy_start[0], |
271 | 274 | day=doy_start[1], |
272 | 275 | ) |
@@ -478,13 +481,15 @@ def _get_previous_max_melt_values( |
478 | 481 | for i, current_dt in enumerate(current_datetimes): |
479 | 482 | # For each datetime of the current year, subset the previous days that have the same datetime and happen *before* the current date. |
480 | 483 | dt_mask = [ |
481 | | - True |
482 | | - if ( |
483 | | - (current_dt.month == dt.month) |
484 | | - and (current_dt.day == dt.day) |
485 | | - and (dt.date() < current_dt) |
| 484 | + ( |
| 485 | + True |
| 486 | + if ( |
| 487 | + (current_dt.month == dt.month) |
| 488 | + and (current_dt.day == dt.day) |
| 489 | + and (dt.date() < current_dt) |
| 490 | + ) |
| 491 | + else False |
486 | 492 | ) |
487 | | - else False |
488 | 493 | for dt in melt_dates_all |
489 | 494 | ] |
490 | 495 |
|
@@ -826,19 +831,21 @@ def special_figure_REG5_FEB_APR_2022(outfile): |
826 | 831 | and ((current_doy < doy_start) or (current_doy > doy_end)) |
827 | 832 | ): |
828 | 833 | current_date = datetime.datetime( |
829 | | - year=(current_date.year - 1) |
830 | | - if ((current_doy < doy_start) and (doy_start < doy_end)) |
831 | | - else current_date.year, |
| 834 | + year=( |
| 835 | + (current_date.year - 1) |
| 836 | + if ((current_doy < doy_start) and (doy_start < doy_end)) |
| 837 | + else current_date.year |
| 838 | + ), |
832 | 839 | month=doy_end[0], |
833 | 840 | day=doy_end[1], |
834 | 841 | ) |
835 | 842 | current_doy = doy_end |
836 | 843 |
|
837 | 844 | # Convert the start date to a datetime object |
838 | 845 | datetime_start = datetime.datetime( |
839 | | - year=current_date.year |
840 | | - if (current_doy > doy_start) |
841 | | - else (current_date.year - 1), |
| 846 | + year=( |
| 847 | + current_date.year if (current_doy > doy_start) else (current_date.year - 1) |
| 848 | + ), |
842 | 849 | month=doy_start[0], |
843 | 850 | day=doy_start[1], |
844 | 851 | ) |
|
0 commit comments