@@ -705,6 +705,13 @@ def define_filename(
705705 """
706706 from disdrodb .api .checks import check_product , check_product_kwargs , check_temporal_resolution
707707
708+ # Retrieve temporal resolution
709+ if product == "L0C" :
710+ temporal_resolution = product_kwargs .pop ("temporal_resolution" , "XXX" )
711+ else :
712+ temporal_resolution = product_kwargs .get ("temporal_resolution" , "" )
713+
714+ # Check product
708715 product = check_product (product )
709716 product_kwargs = check_product_kwargs (product , product_kwargs )
710717
@@ -715,9 +722,8 @@ def define_filename(
715722 # Define product name
716723 product_name = f"{ product } "
717724
718- # L0C ... sample interval known only per-file
719- if product in ["L1" , "L2E" , "L2M" ]:
720- temporal_resolution = product_kwargs .get ("temporal_resolution" )
725+ # Temporal resolution required from L0C onwards
726+ if product in ["L0C" , "L1" , "L2E" , "L2M" ]:
721727 check_temporal_resolution (temporal_resolution )
722728 product_name = f"{ product } .{ temporal_resolution } "
723729 if product in ["L2M" ]:
@@ -810,10 +816,19 @@ def define_l0c_filename(ds, campaign_name: str, station_name: str, sample_interv
810816 """Define L0C file name."""
811817 temporal_resolution = define_temporal_resolution (sample_interval , rolling = False )
812818 starting_time , ending_time = get_file_start_end_time (ds )
813- starting_time = starting_time .strftime ("%Y%m%d%H%M%S" )
814- ending_time = ending_time .strftime ("%Y%m%d%H%M%S" )
815- version = ARCHIVE_VERSION
816- filename = f"L0C.{ temporal_resolution } .{ campaign_name } .{ station_name } .s{ starting_time } .e{ ending_time } .{ version } .nc"
819+ filename = define_filename (
820+ product = "L0C" ,
821+ campaign_name = campaign_name ,
822+ station_name = station_name ,
823+ # Filename options
824+ start_time = starting_time ,
825+ end_time = ending_time ,
826+ add_version = True ,
827+ add_time_period = True ,
828+ add_extension = True ,
829+ # Product options
830+ temporal_resolution = temporal_resolution ,
831+ )
817832 return filename
818833
819834
0 commit comments