@@ -126,7 +126,7 @@ def get_filename(expocode, station, cast, file_ext):
126126 station = _pad_station_cast (station )
127127 cast = _pad_station_cast (cast )
128128 return "{}.{}" .format (
129- "_" . join (( expocode , station , cast )) ,
129+ f" { expocode } _ { station } _ { cast } " ,
130130 file_ext ,
131131 )
132132
@@ -281,9 +281,7 @@ def quality_flags_of(column):
281281 flags = []
282282 for column in columns :
283283 format_str = column .attrs .get ("cchdo.hydro._format" , "%s" )
284- str_column = list (
285- map (lambda x : format_str % x , column .fillna (FILL_VALUE ).to_numpy ())
286- )
284+ str_column = [format_str % x for x in column .fillna (FILL_VALUE ).to_numpy ()]
287285 for i , d in enumerate (str_column ):
288286 if len (d ) > COLUMN_WIDTH :
289287 extra = len (d ) - COLUMN_WIDTH
@@ -298,12 +296,7 @@ def quality_flags_of(column):
298296
299297 if acc .FLAG_NAME in column .attrs :
300298 flags .append (
301- list (
302- map (
303- lambda x : f"{ x :1d} " ,
304- column .attrs [acc .FLAG_NAME ].fillna (9 ).to_numpy ().astype (int ),
305- )
306- )
299+ [f"{ x :1d} " for x in column .attrs [acc .FLAG_NAME ].fillna (9 ).to_numpy ().astype (int )]
307300 )
308301
309302 for row_d , row_f in zip_longest (zip (* data , strict = True ), zip (* flags , strict = True ), fillvalue = "" ):
@@ -336,7 +329,7 @@ def write_bottle(ds: xr.Dataset):
336329 record_1 += "\n "
337330
338331 data = write_data (ds , columns , base_format )
339- return "" . join ([ record_1 , data ]) .encode ("ascii" , "replace" )
332+ return f" { record_1 } { data } " .encode ("ascii" , "replace" )
340333
341334
342335def write_ctd (ds : xr .Dataset ):
@@ -367,9 +360,9 @@ def write_ctd(ds: xr.Dataset):
367360 f"INSTRUMENT NO. { instrument_no : >5s} SAMPLING RATE { sampling_rate :>6.2f} HZ"
368361 )
369362
370- headers = " \n " . join ([ record1 , record2 , record3 ])
363+ headers = f" { record1 } \n { record2 } \n { record3 } "
371364 data = write_data (ds , columns , base_format )
372- return " \n " . join ([ headers , data ]) .encode ("ascii" , "replace" )
365+ return f" { headers } \n { data } " .encode ("ascii" , "replace" )
373366
374367
375368def to_woce (ds : xr .Dataset ) -> bytes :
0 commit comments