loone-data-prep 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,9 @@ D2_D = 30
26
26
  St_Yr = 2008
27
27
  St_M = 1
28
28
  St_D = 1
29
- En_Yr = 2023
30
- En_M = 3
31
- En_D = 31
29
+ En_Yr = 2024
30
+ En_M = 9
31
+ En_D = 30
32
32
 
33
33
  st_year = START_DATE.strftime("%Y")
34
34
  st_month = START_DATE.strftime("%m")
@@ -577,7 +577,7 @@ def main(input_dir: str, output_dir: str, ensemble_number: str) -> None: # , hi
577
577
  # Flow dataframe including Inflows, NetFlows, and Outflows (all in m3/day)
578
578
  geoglows_flow_df.to_csv(f"{output_dir}/geoglows_flow_df_ens_{ensemble_number}_predicted.csv", index=False)
579
579
  # Inflows (cmd)
580
- LO_Inflows_BK.to_csv(f"{output_dir}/LO_Inflows_BK.csv", index=False)
580
+ LO_Inflows_BK.to_csv(f"{output_dir}/LO_Inflows_BK_forecast.csv", index=False)
581
581
  # Outflows (cmd)
582
582
  Outflows_consd.to_csv(f"{output_dir}/Outflows_consd.csv", index=False)
583
583
  # NetFlows (cmd)
@@ -22,9 +22,9 @@ D2_D = 30
22
22
  St_Yr = 2008
23
23
  St_M = 1
24
24
  St_D = 1
25
- En_Yr = 2023
26
- En_M = 3
27
- En_D = 31
25
+ En_Yr = 2024
26
+ En_M = 9
27
+ En_D = 30
28
28
 
29
29
  # Tp Concentrations Dataframe
30
30
  TP_df = None
loone_data_prep/utils.py CHANGED
@@ -800,6 +800,7 @@ def nutrient_prediction(
800
800
 
801
801
  def photo_period(
802
802
  workspace: str,
803
+ file_name: str = "PhotoPeriod",
803
804
  phi: float = 26.982052,
804
805
  doy: np.ndarray = np.arange(1, 365),
805
806
  verbose: bool = False,
@@ -808,6 +809,7 @@ def photo_period(
808
809
 
809
810
  Args:
810
811
  workspace (str): A path to the directory where the file will be generated.
812
+ file_name (str): The name of the file to be generated.
811
813
  phi (float, optional): Latitude of the location. Defaults to 26.982052.
812
814
  doy (np.ndarray, optional): An array holding the days of the year that you want the photo period for. Defaults to np.arange(1,365).
813
815
  verbose (bool, optional): Print results of each computation. Defaults to False.
@@ -858,7 +860,7 @@ def photo_period(
858
860
  photo_period_df["Data"] = P
859
861
 
860
862
  photo_period_df.to_csv(
861
- os.path.join(workspace, "PhotoPeriod.csv"), index=False
863
+ os.path.join(workspace, f"{file_name}.csv"), index=False
862
864
  )
863
865
 
864
866
 
@@ -936,6 +938,45 @@ def dbhydro_data_is_latest(date_latest: str):
936
938
  )
937
939
 
938
940
 
941
+ def get_synthetic_data(date_start: str, df: pd.DataFrame):
942
+ """
943
+ Gets 15 days of synthetic NO and Chla data matching forecast start date.
944
+
945
+ Args:
946
+ date_start (str): The date to start the forecast
947
+ df (pd.DataFrame): The dataset containing NO or Chla data
948
+
949
+ Returns:
950
+ pd.DataFrame, pd.DataFrame: The updated NO or Chla dataset
951
+ """
952
+ date_end = date_start + datetime.timedelta(days=15)
953
+
954
+ df['date'] = pd.to_datetime(df['date'], format='%Y-%m-%d')
955
+ # Extract the month and day from the 'date' column
956
+ df['month_day'] = df['date'].dt.strftime('%m-%d')
957
+
958
+ # Extract the month and day from date_start and date_end
959
+ start_month_day = date_start.strftime('%m-%d')
960
+ end_month_day = date_end.strftime('%m-%d')
961
+
962
+ # Filter the DataFrame to include only rows between date_start and date_end for all previous years
963
+ mask = (df['month_day'] >= start_month_day) & (df['month_day'] <= end_month_day)
964
+ filtered_data = df.loc[mask]
965
+
966
+ # Group by the month and day, then calculate the average for each group
967
+ average_values = filtered_data.groupby('month_day')['Data'].mean()
968
+
969
+ average_values_df = pd.DataFrame({
970
+ 'date': pd.date_range(start=date_start, end=date_end),
971
+ 'Data': average_values.values
972
+ })
973
+
974
+ df = pd.concat([df, average_values_df], ignore_index=True)
975
+ df.drop(columns=['month_day'], inplace=True)
976
+
977
+ return df
978
+
979
+
939
980
  if __name__ == "__main__":
940
981
  if sys.argv[1] == "get_dbkeys":
941
982
  get_dbkeys(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: loone_data_prep
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Prepare data to run the LOONE model.
5
5
  Author-email: Osama Tarabih <osamatarabih@usf.edu>
6
6
  Maintainer-email: Michael Souffront <msouffront@aquaveo.com>, James Dolinar <jdolinar@aquaveo.com>
@@ -1,8 +1,8 @@
1
- loone_data_prep/GEOGLOWS_LOONE_DATA_PREP.py,sha256=wstZQwb_e2Z117dhvuLPrqyln6Bpb3ZTL0RfnOTvET4,35456
2
- loone_data_prep/LOONE_DATA_PREP.py,sha256=osaLYlrfTwwUGLwXGypy61BOYBlXnoTPDp09O4Am1ZE,67761
1
+ loone_data_prep/GEOGLOWS_LOONE_DATA_PREP.py,sha256=vtDA341YIXLHi9fLuGf6-Kf2ImhNnRXt8HRxemAAP14,35465
2
+ loone_data_prep/LOONE_DATA_PREP.py,sha256=Yqc6A0iGCXOYZDDC58Q1Gfu1e0CKzojr_SwX7Z25ATU,67761
3
3
  loone_data_prep/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  loone_data_prep/data_analyses_fns.py,sha256=BZ7famrSKoUfExQvZfbl72CyADHLb-zzgdWZ-kLJxcQ,4603
5
- loone_data_prep/utils.py,sha256=Jsa08iaD04C-BqK0K5BHgRFZEOqp6f_dcJSjPgcz1zA,31575
5
+ loone_data_prep/utils.py,sha256=-NNU6HA20gWNpdVUtVyjaVlQ_5qv-BQxcElQ6Os9Cow,33115
6
6
  loone_data_prep/flow_data/S65E_total.py,sha256=szNUfj0EyyyDzuKNhTGAZtWc5owiOpxYS55YTt4u19k,2835
7
7
  loone_data_prep/flow_data/__init__.py,sha256=u7fENFUZsJjyl13Bc9ZE47sHMKmjxtqXhV9t7vDTm7Y,93
8
8
  loone_data_prep/flow_data/forecast_bias_correction.py,sha256=ydoZ0UmDZvsPLHsO7cpCFN9Pmj7w_tKjMDy9RK5EoiM,10146
@@ -20,8 +20,8 @@ loone_data_prep/water_quality_data/wq.py,sha256=sl6G3iDCk6QUzpHTXPHpRZNMBG0-wHuc
20
20
  loone_data_prep/weather_data/__init__.py,sha256=TX58EPgGRzEK_LmLze79lC4L7kU_j3yZf5_iC4nOIP4,45
21
21
  loone_data_prep/weather_data/get_all.py,sha256=aCufuxORU51XhXt7LN9wN_V4qtjNt1qRC1UKlI2b3Ko,6918
22
22
  loone_data_prep/weather_data/weather.py,sha256=hvceksrGSnDkCjheBVBuPgY1DrdR0ZAtrFB-K2tYTtk,12043
23
- loone_data_prep-0.1.8.dist-info/LICENSE,sha256=rR1QKggtQUbAoYu2SW1ouI5xPqt9g4jvRRpZ0ZfnuqQ,1497
24
- loone_data_prep-0.1.8.dist-info/METADATA,sha256=WB5Nk0uuAtv55-zdjaLRZjn9qbMg1H34Yp5Qe2LpKbc,4122
25
- loone_data_prep-0.1.8.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
26
- loone_data_prep-0.1.8.dist-info/top_level.txt,sha256=wDyJMJiCO5huTAuNmvxpjFxtvGaq_8Tr4hFFcXf8jLE,16
27
- loone_data_prep-0.1.8.dist-info/RECORD,,
23
+ loone_data_prep-0.1.9.dist-info/LICENSE,sha256=rR1QKggtQUbAoYu2SW1ouI5xPqt9g4jvRRpZ0ZfnuqQ,1497
24
+ loone_data_prep-0.1.9.dist-info/METADATA,sha256=l6KtDZKXWDb_QQbHVC-kN4uQbdHmRoS5TJRG7KTJTd4,4122
25
+ loone_data_prep-0.1.9.dist-info/WHEEL,sha256=R06PA3UVYHThwHvxuRWMqaGcr-PuniXahwjmQRFMEkY,91
26
+ loone_data_prep-0.1.9.dist-info/top_level.txt,sha256=wDyJMJiCO5huTAuNmvxpjFxtvGaq_8Tr4hFFcXf8jLE,16
27
+ loone_data_prep-0.1.9.dist-info/RECORD,,