We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The SMAP tutoral 2.0 read_and_plot_smap_data uses h5py and numpy. The whole notebook could be simplified and streamlined by using xarray.
h5py
numpy
xarray
If we stick with h5py a lot of the existing code could also be streamlined and made more transparent.
For example, code cell 3 involves a lot of code to get a list of groups and dataset paths, which can be simplified to the following.
with h5py.File(smap_files[0], 'r') as root: list_of_names = [] root.visit(list_of_names.append) list_of_names
['Metadata', 'Metadata/AcquisitionInformation', 'Metadata/AcquisitionInformation/platform', 'Metadata/AcquisitionInformation/platformDocument', 'Metadata/AcquisitionInformation/radar', 'Metadata/AcquisitionInformation/radarDocument', 'Metadata/AcquisitionInformation/radiometer', 'Metadata/AcquisitionInformation/radiometerDocument', 'Metadata/DataQuality', 'Metadata/DataQuality/CompletenessOmission', 'Metadata/DataQuality/DomainConsistency', 'Metadata/DatasetIdentification', 'Metadata/Extent', 'Metadata/GridSpatialRepresentation', 'Metadata/GridSpatialRepresentation/Column', 'Metadata/GridSpatialRepresentation/GridDefinition', 'Metadata/GridSpatialRepresentation/GridDefinitionDocument',
Code cell 5 that gets soil_moisture for the AM pass could be rewritten to use the path to the dataset
soil_moisture
with h5py.File(smap_files[0], 'r') as root: soil_moisture = root['Soil_Moisture_Retrieval_Data_AM/soil_moisture'][:] soil_moisture
array([[-9999., -9999., -9999., ..., -9999., -9999., -9999.], [-9999., -9999., -9999., ..., -9999., -9999., -9999.], [-9999., -9999., -9999., ..., -9999., -9999., -9999.], ..., [-9999., -9999., -9999., ..., -9999., -9999., -9999.], [-9999., -9999., -9999., ..., -9999., -9999., -9999.], [-9999., -9999., -9999., ..., -9999., -9999., -9999.]], dtype=float32)
But as I note, this is much, much simpler with xarray.
The text was updated successfully, but these errors were encountered:
CRYO-203
Sorry, something went wrong.
andypbarrett
No branches or pull requests
The SMAP tutoral 2.0 read_and_plot_smap_data uses
h5py
andnumpy
. The whole notebook could be simplified and streamlined by usingxarray
.If we stick with
h5py
a lot of the existing code could also be streamlined and made more transparent.For example, code cell 3 involves a lot of code to get a list of groups and dataset paths, which can be simplified to the following.
Code cell 5 that gets
soil_moisture
for the AM pass could be rewritten to use the path to the datasetBut as I note, this is much, much simpler with xarray.
The text was updated successfully, but these errors were encountered: