<jupyter_start><jupyter_text>Read in all the cruise full data- swap dims from obs to time- I checked & time = for both trajectories<jupyter_code>ds = xr.open_mfdataset(data_dir+'*.nc',combine='nested',concat_dim='trajectory').load()

xlon=ds.lon
time_offset_to_lmt=(xlon/360.)*24.*60
ds['tlmt']=xlon
for i in range(2):
    ds['tlmt'][i,:]= ds.time.data+time_offset_to_lmt[i,:]*np.timedelta64(1,'m')# dt.timedelta(seconds=1)<jupyter_output><empty_output><jupyter_text>read in ice, diurnal warming, and surface coolingpresent fileThis file is a combination of the NOAA ice file & own analysis of data based on STD of salinity and SST<jupyter_code>badfile=baddir+'Arctic_bad.xlsx'
ds_tem = pd.read_excel(badfile, sheet_name='warm',index_col=1)
ds_warm = ds_tem.to_xarray()
ds_tem = pd.read_excel(badfile, sheet_name='cold',index_col=1)
ds_cool = ds_tem.to_xarray()

tem=ds_warm
for i in range(tem.usv.size):
    tt=pd.to_datetime(str(tem.start_time[i].data),format='%Y-%m-%dT%H:%M:%S')
    tt64=np.datetime64(tt)
    tem.start_time[i]=tt64
    tt=pd.to_datetime(str(tem.stop_time[i].data),format='%Y-%m-%dT%H:%M:%S')
    tt64=np.datetime64(tt)
    tem.stop_time[i]=tt64
ds_warm=tem
tem=ds_cool
for i in range(tem.usv.size):
    tt=pd.to_datetime(str(tem.start_time[i].data),format='%Y-%m-%dT%H:%M:%S')
    tt64=np.datetime64(tt)
    tem.start_time[i]=tt64
    tt=pd.to_datetime(str(tem.stop_time[i].data),format='%Y-%m-%dT%H:%M:%S')
    tt64=np.datetime64(tt)
    tem.stop_time[i]=tt64
ds_cool=tem

tem_mask=np.zeros(ds.TEMP_AIR_MEAN.shape)
tem_mask = xr.DataArray(tem_mask,coords=[ds.trajectory,ds.time],dims=['trajectory','time'],
                                           attrs={'long_name':'Diurnal warming mask 1=warm'})
ds['warm_mask']=tem_mask
for iusv in range(2):
    tem =  ds_warm.sel(usv=int(ds.trajectory[iusv].data))
    ds_tem = ds.isel(trajectory=iusv)
    if tem.usv.size>1:
        for i in range(tem.usv.size):
            cond = (ds_tem.time>=tem.start_time[i]) & (ds_tem.time<=tem.stop_time[i])
            ds_tem.warm_mask[cond]=1
    else:
        cond = (ds_tem.time>=tem.start_time) & (ds_tem.time<=tem.stop_time)
        ds_tem.warm_mask[cond]=1       
    ds['warm_mask'][iusv,:]=ds_tem.warm_mask

tem_mask=np.zeros(ds.TEMP_AIR_MEAN.shape)
tem_mask = xr.DataArray(tem_mask,coords=[ds.trajectory,ds.time],dims=['trajectory','time'],
                                           attrs={'long_name':'surface cooling mask 1=cool'})
ds['cool_mask']=tem_mask
for iusv in range(2):
    tem =  ds_cool.sel(usv=int(ds.trajectory[iusv].data))
    ds_tem = ds.isel(trajectory=iusv)
    if tem.usv.size>1:
        for i in range(tem.usv.size):
            cond = (ds_tem.time>=tem.start_time[i]) & (ds_tem.time<=tem.stop_time[i])
            ds_tem.cool_mask[cond]=1
    else:
        cond = (ds_tem.time>=tem.start_time) & (ds_tem.time<=tem.stop_time)
        ds_tem.cool_mask[cond]=1       
    ds['cool_mask'][iusv,:]=ds_tem.cool_mask

ds.to_netcdf(data_dir_out + 'saildrone-gen_5-arctic_misst_2019-sd10361037-20190514T230000-20191011T183000-1_minutes-v1.1575336154680-withSBE_flags.nc')


ds<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16645408163265307, 'fraction_numerical': 0.03316326530612245, 'mean_word_length': 4.316949152542373, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '73614', 'license': 'Apache-2.0', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1308, 'n_words': 159, 'path': 'arctic_cruise/.ipynb_checkpoints/Create_combined_file_dw_cool_flags-checkpoint.ipynb', 'repo_name': 'cgentemann/Saildrone', 'size': '3136'}