@@ -537,17 +537,18 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me
537537 l3 .z_surf_combined .to_series (),
538538 ),
539539 )
540- if "z_ice_surf" in l3_merged .keys () and "z_ice_surf" in l3 .keys ():
541- if (
542- l3_merged .z_ice_surf .notnull ().any ()
543- and l3 .z_ice_surf .notnull ().any ()
544- ):
545- l3_merged ["z_ice_surf" ] = (
546- "time" ,
547- align_surface_heights (
548- l3_merged .z_ice_surf .to_series (), l3 .z_ice_surf .to_series ()
549- ),
550- )
540+ if st_attrs [stid ]['site_type' ] == 'accumulation' :
541+ if "z_ice_surf" in l3_merged .keys () and "z_ice_surf" in l3 .keys ():
542+ if (
543+ l3_merged .z_ice_surf .notnull ().any ()
544+ and l3 .z_ice_surf .notnull ().any ()
545+ ):
546+ l3_merged ["z_ice_surf" ] = (
547+ "time" ,
548+ align_surface_heights (
549+ l3_merged .z_ice_surf .to_series (), l3 .z_ice_surf .to_series ()
550+ ),
551+ )
551552
552553 # saves attributes
553554 attrs = l3_merged .attrs
@@ -572,16 +573,19 @@ def join_l3(config_folder, site, folder_l3, folder_gcnet, outpath, variables, me
572573 if not l3_merged :
573574 logger .error ("No level 3 station data file found for " + site )
574575 return None , sorted_list_station_data
575- else :
576- l3_merged ["z_ice_surf" ] = post_processing_z_ice_surf (l3_merged ["z_ice_surf" ],
577- l3_merged ["z_surf_combined" ],
578- l3_merged ["z_ice_surf" ])
576+
579577 l3_merged .attrs ["site_id" ] = site
580578 l3_merged .attrs ["stations" ] = " " .join (sorted_stids )
581579 l3_merged .attrs ["level" ] = "L3"
580+ first_station_name = list (l3_merged .attrs ["stations_attributes" ].keys ())[0 ]
581+
582582 l3_merged .attrs ["project" ] = sorted_list_station_data [0 ][1 ]["project" ]
583583 l3_merged .attrs ["location_type" ] = sorted_list_station_data [0 ][1 ]["location_type" ]
584584
585+ if l3_merged .attrs ["stations_attributes" ][first_station_name ]['site_type' ] == 'ablation' :
586+ l3_merged ["z_ice_surf" ] = post_processing_z_ice_surf (l3_merged ["z_ice_surf" ],
587+ l3_merged ["z_surf_combined" ],
588+ l3_merged ["z_ice_surf" ])
585589 site_source = dict (
586590 site_config_source_hash = get_commit_hash_and_check_dirty (config_folder ),
587591 gcnet_source_hash = get_commit_hash_and_check_dirty (folder_gcnet ),
0 commit comments