Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jejjohnson committed Feb 26, 2024
2 parents 0668dea + 203b423 commit 68e0386
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
3 changes: 2 additions & 1 deletion rs_tools/_src/data/modis/bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

MODIS_CHANNEL_NUMBERS = [
str(i) for i in range(1, 39)
] + ['13lo', '14lo', '13hi', '14hi']
] + ['13lo', '14lo', '13hi', '14hi']
}
2 changes: 1 addition & 1 deletion scripts/goes-download.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def _check_save_dir(save_dir: str) -> bool:
return True
else:
try:
os.mkdir(save_dir)
os.makedirs(save_dir)
return True
except:
msg = "Save directory does not exist"
Expand Down
2 changes: 1 addition & 1 deletion scripts/modis-download.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _check_save_dir(save_dir: str) -> bool:
return True
else:
try:
os.mkdir(save_dir)
os.makedirs(save_dir)
return True
except:
msg = "Save directory does not exist"
Expand Down
23 changes: 14 additions & 9 deletions scripts/pipeline/preprocess_modis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,28 @@ class MODISGeoProcessing:
save_path: str = "./"
channels: list[str] = MODIS_CHANNEL_NUMBERS

def geoprocess_files(self, params: GeoProcessingParams, files: List[str]):
save_path: str = params.save_path.join(self.save_path)
target_grid: np.ndarray = create_latlon_grid(params.region, self.resolution) # create using np.linspace?
# def geoprocess_files(self, params: GeoProcessingParams, files: List[str]):
# resolution: float = 0.25 # in degrees?
# save_path: str = "./"

# def geoprocess(self, params: GeoProcessingParams, files: List[str]):
# save_path: str = params.save_path.join(self.save_path)
# target_grid: np.ndarray = create_latlon_grid(params.region, self.resolution) # create using np.linspace?

# loop through files
# open dataset
# stack variables to channels
# resample
# convert units (before or after resampling???)
# save as netcdf
# # loop through files
# # open dataset
# # stack variables to channels
# # resample
# # convert units (before or after resampling???)
# # save as netcdf

def geoprocess_file(self, file: str, save_name: str="test") -> None:

# load MODIS SCENE
ds, time_stamp = self.load_modis_scene(file)
# convert units
ds = self.convert_units(file)
# TODO: resample
# save to raster
time_stamp = time_stamp.strftime("%Y%m%d%H%M")
save_name =f"modis_{time_stamp}.tif"
Expand Down

0 comments on commit 68e0386

Please sign in to comment.