Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
long_name="Ceilometer Range",
description="Ranges for the ceilometer backscatter profile, including the instrument height",),) #added as 1D
#2D: dimension time/cloud_layer
da_baseht=xr.DataArray(data=np.array(DF_20min_cloudbh,dtype=float).astype('float32'),
name="cloud_base_altitude",dims=["time","cloud_layer"],
coords=dict(time=Time_steps_dt64_org,cloud_layer=cloud_layer_levs),
attrs=dict(type="float32",dimension="time, cloud_layer", units="m",
long_name="Cloud Base Altitude",
description="cloud base height of 1-3 cloud layers; NaN if no layer detected. " +\
"Instrument height incorporated."),) #added as 2D
#2D: dimension time/sky_condition_layer
da_scfrac=xr.DataArray(data=np.array(DF_20min_scfrac,dtype=float).astype('float32'),
name="sky_condition_cloud_fraction",dims=["time","sky_condition_layer"],
coords=dict(time=Time_steps_dt64_org,sky_condition_layer=sc_layer_levs),
attrs=dict(type="float32",dimension="time, sky_condition_layer", units="octal",
long_name="Sky Condition Cloud Fraction",
description="Cloud fraction calculated with the sky condition algorithm. "+\
"0-8 = cloud coverage of up to 5 levels; 9 = obscuration. " +\
"NaN = missing data or no detected layer."),) #added as 2D
da_scht=xr.DataArray(data=np.array(DF_20min_scht,dtype=float).astype('float32'),
name="sky_condition_cloud_altitude",dims=["time","sky_condition_layer"],
coords=dict(time=Time_steps_dt64_org,sky_condition_layer=sc_layer_levs),
attrs=dict(type="float32",dimension="time, sky_condition_layer", units="m",
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
description = "Cloud layer height calculated with the sky condition algorithm. "+\
"Cloud layer height given for 1-5 sky condition layers; NaN if no layer detected. "+\
"Vertical visibility is reported as height if obscuration (at sky_condition_cloud_fraction 9). "+\
"Instrument height incorporated."),) #added as 2D
#2D: dimension time/range
da_bsprof=xr.DataArray(data=np.array(DF_20min_range,dtype=float).astype('float32'),
name="backscatter_profile",dims=["time","range_levels"],
coords=dict(time=Time_steps_dt64_org,range_levels=range_levs),
attrs=dict(type="float32",dimension="time, range_levels", units="1 km-1 steradians-1",
long_name="Backscatter Profile", description="backscatter coefficient profile"),) #added as 2D
# +
#merge all arrays into one
ds_all=xr.merge([da_doy,da_year,da_month,da_day,da_hour,da_min,da_sec,
da_ceilrange,da_cloudcode,da_vertvis,da_high_sig,
da_baseht,da_scfrac,da_scht,da_bsprof])
len(ds_all)
# -
#get time range - start
Times_nomicrosec[0]
#get time range - end
Times_nomicrosec[-1]
# +
# modify attributes (start/end time and text in comments);
# note again geospatial bounds from the weather station data
ds_all.attrs = {"Conventions" :"CF-1.8",
"source" : "Ceilometer",
"instrument_model" : "Vaisala Ceilometer CL31",
"creator_name" : "Sonja Murto",
"creator_email" : "sonja.murto@misu.su.se",
"creator_url" : "https://orcid.org/0000-0002-4966-9077",
"institution" : "Stockholm University",
"processing_software" : "Matlab (for creating the matlab file) and a jupyter notebook script (netCDF)",
"sampling_interval": "original 30s; here 20min averages",
"product_version" : "v01",
"last_revised_date" : "2024-05-31T15:00:00",
"project" : "ARTofMELT",
"project_principal_investigator" : "Michael Tjernström",
"project_principal_investigator_email" : "michaelt@misu.su.se",
"project_principal_investigator_url" : "https://orcid.org/0000-0002-6908-7410",
"acknowledgement" : " Knut och Alice Wallenbergs Stiftelse, Grant 2016-0024",
"platform" : "Swedish Icebreaker Oden",
"platform_type" : "On Oden's 7th deck above the bridge",
"deployment_mode" : "ship",
"title" : "Ceilometer cloud base height, vertical visibility and backscatter profiles",
"feature_type" : "time series",
"time_coverage_start" : "2023-05-07T00:10:22",
"time_coverage_end" : "2023-06-13T16:10:07",
"geospatial_bounds" : "80.52392166666667N, -3.8737749999999997E, 78.04355166666666N, 15.660881666666667E",
"platform_altitude" : "Located at approximately 25 m a.s.l",
"location_keywords": "Oden, Arctic Ocean, Fram Strait, atmosphere, on the ship",
"comments" : "This file consists of 20 min averages of ceilometer data " +\
"measured with the Vaisala Ceilometer CL31 that was located on the 7th deck, "+\
"above the bridge (at approximately 25m)." + \
"The sky condition measurements are time averages to represent an area average. " + \
"The vertical resolution is 10m * 770, but the measurement height (25m) is included in the backscatter profile ranges, " + \
"as well as in the cloud base heights (cloud_base_altitude and sky_condition_cloud_altitude). " + \
"Geospatial bounds are taken from the gps location of the weather station dataset located on Oden. " +\
"Time variables month, day, hour, minute and second are approximated to the nearest second. " +\
"Data produced by Sonja Murto. See the document - Readme_CL.txt - for more details."}
# -
ds_all
#save to netCDF
ds_all.to_netcdf(load_data + 'CL31_ceilometer_ARTofMELT_20230507_20230613_20min_v01.nc')
# +
#test plot
ds_all.sel(cloud_layer=1).cloud_base_altitude.plot(color='r',label='cloud_layer = 1')
ds_all.sel(cloud_layer=2).cloud_base_altitude.plot(color='b',label='cloud_layer = 2')
ds_all.sel(cloud_layer=3).cloud_base_altitude.plot(color='y',label='cloud_layer = 3')
plt.title('')
plt.legend()
plt.show()