@@ -62,7 +62,7 @@ def waves(self):
62
62
63
63
@property
64
64
def xarray (self ):
65
- da = xr .DataArray (self .data )
65
+ return xr .DataArray (self .data )
66
66
67
67
68
68
class FUV_PDS (QUBE ):
@@ -78,6 +78,7 @@ def __init__(self, fname, freq):
78
78
self .freq = freq
79
79
self .timestr = self .ds .start_time_str [:20 ] + "000"
80
80
self .n_integrations = self .ds ["integrations" ].size
81
+ self .orig_dims = list (self .ds .dims .keys ())
81
82
82
83
@property
83
84
def start_time (self ):
@@ -96,6 +97,18 @@ def times(self):
96
97
)
97
98
return times
98
99
100
+ @property
101
+ def spatial_dim (self ):
102
+ for dim in self .orig_dims :
103
+ if dim .startswith ("spatial_dim" ):
104
+ return dim
105
+
106
+ @property
107
+ def spectral_dim (self ):
108
+ for dim in self .orig_dims :
109
+ if dim .startswith ("spectral_dim" ):
110
+ return dim
111
+
99
112
100
113
class HSP (UVIS_NetCDF ):
101
114
@@ -222,14 +235,14 @@ class FUV(UVIS_NetCDF):
222
235
223
236
def __init__ (self , fname , freq = "1s" ):
224
237
super ().__init__ (fname , freq )
225
- self .n_spec_bins = self .ds ["spectral_dim_0" ].size
238
+ self .n_spec_bins = self .ds [self . spectral_dim ].size
226
239
self .waves = np .linspace (self .wave_min , self .wave_max , self .n_spec_bins )
227
240
self .ds ["times" ] = xr .DataArray (self .times .values , dims = "integrations" )
228
- self .ds ["wavelengths" ] = xr .DataArray (self .waves , dims = "spectral_dim_0" )
241
+ self .ds ["wavelengths" ] = xr .DataArray (self .waves , dims = self . spectral_dim )
229
242
self .ds = self .ds .swap_dims (
230
- {"integrations" : "times" , "spectral_dim_0" : "wavelengths" }
243
+ {"integrations" : "times" , self . spectral_dim : "wavelengths" }
231
244
)
232
- self .ds = self .ds .rename ({"window_0" : "counts" , "spatial_dim_0" : "pixels" })
245
+ self .ds = self .ds .rename ({"window_0" : "counts" , self . spatial_dim : "pixels" })
233
246
234
247
@property
235
248
def data (self ):
0 commit comments