Issue
The Dataset won't return the target/label when the data loading mode is set to "remote."
__getitem__ won't return target/label when self.file_dict.get(field_type) returns None:
|
if self.file_dict.get(field_type) and field_type in self.var_dict: |
|
self._extract_field(field_type, t_target, target_data) |
which is always the case (see _register_field()):
|
else: |
|
# Remote mode: S3 path is constructed at runtime from the timestamp |
|
self.file_dict[field_type] = None |
One can remove the safeguard if self.file_dict.get(field_type) to temporarily bypass the issue, but the question remains: where is the appropriate place for the safeguard.
Enhancement
- Local files may be stored in subdirectories:
Current code assumes all files are stored in the same directory (see _register_field()):
|
if self.mode == "local": |
|
files = sorted(glob(d.get("path", ""))) |
It would be nice to support a recursive search through all subdirectories.
- Handle irregular timestamps in files:
The current code can only retrieve data for the exact requested timestamp, but since some MRMS products have filenames like MRMS_MergedReflectivityQC_00.50_20201014-000227.grib2.gz, a scheme to search for the nearest timestamp is needed. The current GOES Dataset can handle this and should be straightforward to implement here.
- Initialize the s3fs on the first call to
__getitem__
Next steps
Would like to hear feedback from @charlie-becker and decide how to move forward. Happy to take the lead on the modification as well.
Issue
The Dataset won't return the target/label when the data loading mode is set to "remote."
__getitem__won't return target/label whenself.file_dict.get(field_type)returns None:miles-credit/credit/datasets/MRMS.py
Lines 227 to 228 in f11aed3
which is always the case (see
_register_field()):miles-credit/credit/datasets/MRMS.py
Lines 268 to 270 in f11aed3
One can remove the safeguard
if self.file_dict.get(field_type)to temporarily bypass the issue, but the question remains: where is the appropriate place for the safeguard.Enhancement
Current code assumes all files are stored in the same directory (see
_register_field()):miles-credit/credit/datasets/MRMS.py
Lines 264 to 265 in f11aed3
It would be nice to support a recursive search through all subdirectories.
The current code can only retrieve data for the exact requested timestamp, but since some MRMS products have filenames like MRMS_MergedReflectivityQC_00.50_20201014-000227.grib2.gz, a scheme to search for the nearest timestamp is needed. The current GOES Dataset can handle this and should be straightforward to implement here.
__getitem__Next steps
Would like to hear feedback from @charlie-becker and decide how to move forward. Happy to take the lead on the modification as well.