Commit 5b675fa8 authored by Niklas Bohn's avatar Niklas Bohn
Browse files

Moved 'Data' variable to band group

parent 012dacc0
Pipeline #2617 passed with stages
in 16 minutes and 23 seconds
......@@ -609,12 +609,11 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
[setattr(data_info_group, attr, api_result[key][tile][band][data_info][attr])
for attr in api_result[key][tile][band][data_info].keys()]
if data_info == 'data':
data_group = band_group.createGroup(data_info)
band_arr = np.asarray(api_result[key][tile][band][data_info])
data_group.createDimension('x', band_arr.shape[2])
data_group.createDimension('y', band_arr.shape[1])
data_group.createDimension('t', band_arr.shape[0])
data = data_group.createVariable('Data', 'i4', ('x', 'y', 't'), fill_value=255)
band_group.createDimension('x', band_arr.shape[2])
band_group.createDimension('y', band_arr.shape[1])
band_group.createDimension('t', band_arr.shape[0])
data = band_group.createVariable('Data', 'i4', ('x', 'y', 't'), fill_value=255)
data.units = "None"
if level == "L1C":
data.long_name = "Top of Atmosphere Reflectance"
......@@ -625,9 +624,9 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
data.valid_range = np.array((-2000.0, 16000.0))
data.actual_range = np.array((np.min(band_arr), np.max(band_arr)))
data[:, :, :] = band_arr
data_group.Band = band.split("_")[0].split("B")[-1]
data_group.Resolution = band.split("_")[-1]
data_group.Central_Wavelength = wl[str(band.split("_")[0])]
band_group.Band = band.split("_")[0].split("B")[-1]
band_group.Resolution = band.split("_")[-1]
band_group.Central_Wavelength = wl[str(band.split("_")[0])]
if key == 'Metadata':
key_group = f.createGroup(key)
......@@ -661,12 +660,11 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
data_info_group.setncattr_string('time',
api_result[key][tile][msk][data_info]['time'])
if data_info == 'data':
data_group = mask_group.createGroup(data_info)
mask_arr = np.asarray(api_result[key][tile][msk][data_info])
data_group.createDimension('x', mask_arr.shape[2])
data_group.createDimension('y', mask_arr.shape[1])
data_group.createDimension('t', mask_arr.shape[0])
data = data_group.createVariable('Data', 'i4', ('x', 'y', 't'), fill_value=255)
mask_group.createDimension('x', mask_arr.shape[2])
mask_group.createDimension('y', mask_arr.shape[1])
mask_group.createDimension('t', mask_arr.shape[0])
data = mask_group.createVariable('Data', 'i4', ('x', 'y', 't'), fill_value=255)
data.units = "None"
data.long_name = "Mask classes"
data.standard_name = "classes"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment