-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated various CDF attributes/variable names to match expected nomenclature #813
Changes from 2 commits
422cfef
59d5b21
f694917
466ab28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ class CoDICEL1aPipeline: | |
Create an ``xarray`` dataset for the unpacked science data. | ||
get_acquisition_times() | ||
Retrieve the acquisition times via the Lo stepping table. | ||
get_esa_sweep_values() | ||
get_energy_table() | ||
Retrieve the ESA sweep values. | ||
unpack_science_data() | ||
Decompress, unpack, and restructure science data arrays. | ||
|
@@ -136,27 +136,19 @@ def create_science_dataset( | |
np.arange(self.num_positions), | ||
name="inst_az", | ||
dims=["inst_az"], | ||
attrs=cdf_attrs.get_variable_attributes("inst_az_attrs"), | ||
attrs=cdf_attrs.get_variable_attributes("inst_az"), | ||
) | ||
spin_sector = xr.DataArray( | ||
np.arange(self.num_spin_sectors), | ||
name="spin_sector", | ||
dims=["spin_sector"], | ||
attrs=cdf_attrs.get_variable_attributes("spin_sector_attrs"), | ||
attrs=cdf_attrs.get_variable_attributes("spin_sector"), | ||
) | ||
energy_steps = xr.DataArray( | ||
esa_step = xr.DataArray( | ||
np.arange(self.num_energy_steps), | ||
name="energy", | ||
dims=["energy"], | ||
attrs=cdf_attrs.get_variable_attributes("energy_attrs"), | ||
) | ||
|
||
# Define labels | ||
energy_label = xr.DataArray( | ||
energy_steps.values.astype(str), | ||
name="energy_label", | ||
dims=["energy_label"], | ||
attrs=cdf_attrs.get_variable_attributes("energy_label"), | ||
name="esa_step", | ||
dims=["esa_step"], | ||
attrs=cdf_attrs.get_variable_attributes("esa_step"), | ||
) | ||
|
||
# Create the dataset to hold the data variables | ||
|
@@ -165,8 +157,7 @@ def create_science_dataset( | |
"epoch": epoch, | ||
"inst_az": inst_az, | ||
"spin_sector": spin_sector, | ||
"energy": energy_steps, | ||
"energy_label": energy_label, | ||
"esa_step": esa_step, | ||
Comment on lines
-168
to
+160
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you remove those labels, you are gonna get error for data whose dimension have more than Eg.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah yes, I forgot that I added There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good to know. I am surprised that you were able to reuse dimension cdf attrs for labels like this
I thought it has to be metadata type. |
||
}, | ||
attrs=cdf_attrs.get_global_attributes(self.dataset_name), | ||
) | ||
|
@@ -183,7 +174,7 @@ def create_science_dataset( | |
self.num_energy_steps, | ||
) | ||
) | ||
dims = ["epoch", "inst_az", "spin_sector", "energy"] | ||
dims = ["epoch", "inst_az", "spin_sector", "esa_step"] | ||
elif self.instrument == "hi": | ||
variable_data_arr = np.array(variable_data).reshape( | ||
( | ||
|
@@ -193,7 +184,7 @@ def create_science_dataset( | |
self.num_spin_sectors, | ||
) | ||
) | ||
dims = ["epoch", "energy", "inst_az", "spin_sector"] | ||
dims = ["epoch", "esa_step", "inst_az", "spin_sector"] | ||
|
||
# Get the CDF attributes | ||
cdf_attrs_key = ( | ||
|
@@ -211,17 +202,17 @@ def create_science_dataset( | |
|
||
# Add ESA Sweep Values and acquisition times (lo only) | ||
if self.instrument == "lo": | ||
self.get_esa_sweep_values() | ||
self.get_energy_table() | ||
self.get_acquisition_times() | ||
dataset["esa_sweep_values"] = xr.DataArray( | ||
self.esa_sweep_values, | ||
dims=["energy"], | ||
attrs=cdf_attrs.get_variable_attributes("esa_sweep_attrs"), | ||
self.energy_table, | ||
dims=["esa_step"], | ||
attrs=cdf_attrs.get_variable_attributes("energy_table"), | ||
) | ||
dataset["acquisition_times"] = xr.DataArray( | ||
self.acquisition_times, | ||
dims=["energy"], | ||
attrs=cdf_attrs.get_variable_attributes("acquisition_times_attrs"), | ||
dims=["esa_step"], | ||
attrs=cdf_attrs.get_variable_attributes("acquisition_time_per_step"), | ||
) | ||
|
||
return dataset | ||
|
@@ -270,7 +261,7 @@ def get_acquisition_times(self) -> None: | |
row_number = np.argmax(energy_steps == str(step_number), axis=1).argmax() | ||
self.acquisition_times.append(lo_stepping_values.acq_time[row_number]) | ||
|
||
def get_esa_sweep_values(self) -> None: | ||
def get_energy_table(self) -> None: | ||
""" | ||
Retrieve the ESA sweep values. | ||
|
||
|
@@ -299,7 +290,7 @@ def get_esa_sweep_values(self) -> None: | |
|
||
# Get the appropriate values | ||
sweep_table = sweep_data[sweep_data["table_idx"] == sweep_table_id] | ||
self.esa_sweep_values = sweep_table["esa_v"].values | ||
self.energy_table = sweep_table["esa_v"].values | ||
|
||
def unpack_science_data(self, science_values: str) -> None: | ||
""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure you want this to be 128? Just double checking
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled this from the L1A validation CDFs that joey gave me but I do think it should be 127. I will double check with Joey.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joey confirmed that this should be
127
(and that the exact values in his validation CDFs should not be considered the strict requirement).