Open claytharrison opened 6 months ago
I added a basic Swath reader but nothing for handling specific products yet. For now you can steal the information for a given product from xarray_io.py
.
It tries to implement a spatial filter for the results of the time-based file search, to relatively quickly exclude unnecessary swath files from reading and merging. The concept was graciously stolen from a script of Pavan's. It seems like it works but I haven't done proper testing yet.
Using it should go something like -
from ascat.read_native.swath_collection import SwathFile
from ascat.read_native.swath_collection import SwathGridFiles
from fibgrid.realization import FibGrid
swath_path = "tests/ascat_test_data/hsaf/h129/swaths"
grid = FibGrid(6.25)
sf = SwathGridFiles(
swath_path,
cls=SwathFile,
fn_templ="W_IT-HSAF-ROME,SAT,SSM-ASCAT-METOP{sat}-6.25-H129_C_LIIB_{date}_{placeholder}_{placeholder1}____.nc",
sf_templ={"year_folder": "{year}"},
grid=grid,
fn_read_fmt= lambda timestamp: {
"date": timestamp.strftime("%Y%m%d*"),
"sat": "[ABC]",
"placeholder": "*",
"placeholder1": "*"
},
sf_read_fmt = lambda timestamp:{
"year_folder": {
"year": f"{timestamp.year}"
},
},
)
files = sf.search_period(
datetime(2021, 1, 15),
datetime(2021, 1, 30),
date_field_fmt="%Y%m%d%H%M%S"
)
bbox=(-90, -4, -70, 20)
merged_ds = sf.extract(
datetime(2021, 1, 15),
datetime(2021, 1, 30),
bbox = bbox,
date_field_fmt="%Y%m%d%H%M%S"
)
This pull request aims to reimplement the reading/merging logic for swath and cell files in the structure established by
MultiFileHandler
/ChronFiles
/etc in thefile_handling
module.On this commit, readers for cell files are implemented (RaggedArray and OrthoMulti). The most basic method of operation goes something like:
To do: