Skip to content
Snippets Groups Projects
Commit b3950f85 authored by Paolo Veglio's avatar Paolo Veglio
Browse files

changed some types to decrease memory usage

parent 51c4ba9f
No related branches found
No related tags found
No related merge requests found
...@@ -264,6 +264,7 @@ def main( ...@@ -264,6 +264,7 @@ def main(
cmin = np.minimum( cmin = np.minimum(
np.power(cmin_g1 * cmin_g2 * cmin_g3 * cmin_g4 * cmin_g5, 1 / utils.group_count(qabit)), np.power(cmin_g1 * cmin_g2 * cmin_g3 * cmin_g4 * cmin_g5, 1 / utils.group_count(qabit)),
cmin, cmin,
dtype=np.float32,
) )
# cmin_3d[i, :, :] = cmin # cmin_3d[i, :, :] = cmin
# cmin_3d = np.minimum(cmin_3d, cmin) # cmin_3d = np.minimum(cmin_3d, cmin)
...@@ -408,7 +409,7 @@ def main( ...@@ -408,7 +409,7 @@ def main(
# cmin, # cmin,
# bits['r06'])[idx] # bits['r06'])[idx]
cmin_final = cmin csc = cmin
# bits translation MVCM-python -> MVCM-C # bits translation MVCM-python -> MVCM-C
# 01 13 test_11um # 01 13 test_11um
...@@ -423,12 +424,12 @@ def main( ...@@ -423,12 +424,12 @@ def main(
# 15 16 test_1_38um_high_clouds # 15 16 test_1_38um_high_clouds
# 16 17 thin_cirrus_4_12um_BTD_test # 16 17 thin_cirrus_4_12um_BTD_test
csc = cmin_final
integer_cloud_mask = np.zeros(csc.shape, dtype=np.byte) integer_cloud_mask = np.zeros(csc.shape, dtype=np.byte)
integer_cloud_mask[csc > 0.99] = 3 integer_cloud_mask[csc > 0.99] = 3
integer_cloud_mask[(csc <= 0.99) & (csc > 0.95)] = 2 integer_cloud_mask[(csc <= 0.99) & (csc > 0.95)] = 2
integer_cloud_mask[(csc <= 0.95) & (csc > 0.66)] = 1 integer_cloud_mask[(csc <= 0.95) & (csc > 0.66)] = 1
integer_cloud_mask[csc <= 0.66] = 0 integer_cloud_mask[csc <= 0.66] = 0
integer_cloud_mask = integer_cloud_mask.astype(np.int8)
# logger.debug(f"Memory: {tracemalloc.get_traced_memory()}") # logger.debug(f"Memory: {tracemalloc.get_traced_memory()}")
cloud_mask = np.zeros((6, csc.shape[0], csc.shape[1]), dtype=np.byte) cloud_mask = np.zeros((6, csc.shape[0], csc.shape[1]), dtype=np.byte)
...@@ -442,7 +443,7 @@ def main( ...@@ -442,7 +443,7 @@ def main(
"sensor_azimuth": {"dims": ("x", "y"), "data": viirs_data.sensor_azimuth.values}, "sensor_azimuth": {"dims": ("x", "y"), "data": viirs_data.sensor_azimuth.values},
"solar_zenith": {"dims": ("x", "y"), "data": viirs_data.solar_zenith.values}, "solar_zenith": {"dims": ("x", "y"), "data": viirs_data.solar_zenith.values},
"solar_azimuth": {"dims": ("x", "y"), "data": viirs_data.solar_azimuth.values}, "solar_azimuth": {"dims": ("x", "y"), "data": viirs_data.solar_azimuth.values},
"confidence": {"dims": ("x", "y"), "data": cmin_final}, "confidence": {"dims": ("x", "y"), "data": csc},
"cloud_mask": {"dims": ("bits", "x", "y"), "data": cloud_mask}, "cloud_mask": {"dims": ("bits", "x", "y"), "data": cloud_mask},
"quality_assurance": {"dims": ("x", "y", "qa"), "data": quality_assurance}, "quality_assurance": {"dims": ("x", "y", "qa"), "data": quality_assurance},
"integer_cloud_mask": {"dims": ("x", "y"), "data": integer_cloud_mask}, "integer_cloud_mask": {"dims": ("x", "y"), "data": integer_cloud_mask},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment