1. James Morrison
  2. hebtools

Commits

James Morrison  committed 57c241b

added ability to pass month parameter to process subset of wave data

  • Participants
  • Parent commits cb78a40
  • Branches default

Comments (0)

Files changed (1)

File hebtools/dwr/parse_raw.py

View file
     data = data.reshape((-1, 4))
     return data
         
-def load(folder_path, year = None):
+def load(folder_path, year = None, month = None):
     
     def get_rounded_timestamps(file_name, raw_array_length):
         """ Takes the length of the raw file and based on the file name gives 
         return raw_array, False        
     
     def iterate_over_years(year, folder_path):
-        if year != None:
+        if month != None and year != None:
+            process_month(os.path.join(folder_path,str(year),str(month)))
+        elif year != None:
             iterate_over_months(os.path.join(folder_path,str(year)))
         else:
             year_dirs = os.listdir(folder_path)
         for month_dir in month_dirs:
             path = os.path.join(year_folder_path,month_dir)
             if os.path.isdir(path):
-                month_raw_displacements = iterate_over_file_names(path)
-                extrema_df = GetExtrema(month_raw_displacements)
-                raw_plus_std = error_check.check(extrema_df.raw_disp_with_extrema)
-                WaveStats(raw_plus_std)
+                process_month(path)
+                
+    def process_month(month_path):
+        month_raw_displacements = iterate_over_file_names(month_path)
+        extrema_df = GetExtrema(month_raw_displacements)
+        raw_plus_std = error_check.check(extrema_df.raw_disp_with_extrema)
+        WaveStats(raw_plus_std)
               
     iterate_over_years(year, folder_path)