Find and open¶
find_products ¶
find_products(paths: Union[str, Path, Iterable[Union[str, Path]]], *, frame_id: Optional[int] = None, min_version: Optional[str] = None, allow_unsupported: bool = False) -> pd.DataFrame
Return one row per DISP granule, deduplicated and sorted by date.
When the same frame and date pair appears more than once, the highest
product version is kept, then the latest production time. The dropped rows
are in df.attrs["dropped"]. Versions are checked against the product
spec after this deduplication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
str, Path or iterable of them
|
A directory or remote prefix ( |
required |
frame_id
|
int
|
Keep only this frame. Required when the granules span several frames. |
None
|
min_version
|
str
|
Keep only granules with at least this product version. |
None
|
allow_unsupported
|
bool
|
Keep granules whose version the product spec does not support, instead of raising. |
False
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Columns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no granule is found, or the granules span several frames and
|
UnsupportedProductVersionError
|
If a granule's version is outside its product's supported versions. |
Examples:
open_disp ¶
open_disp(paths: PathsLike, *, layers: Optional[Sequence[str]] = None, corrections: bool = False, chunks: ChunkSpec = 'native', frame_id: Optional[int] = None, min_version: Optional[str] = None, check: bool = True) -> xr.Dataset
Open DISP granules of one frame as a lazy dataset.
Displacement is returned as stored: relative to each granule's reference
date (reference_time). Chaining across ministacks is a separate step.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
str, Path, iterable of paths, or DataFrame
|
A directory, files, or the output of
:func: |
required |
layers
|
sequence of str
|
Layers to keep. Defaults to all displacement and quality layers. |
None
|
corrections
|
bool
|
Also open the |
False
|
chunks
|
('native', 'timeseries', 'maps')
|
Dask chunks. |
"native"
|
frame_id
|
int
|
Frame to keep when |
None
|
min_version
|
str
|
Lowest product version to keep. |
None
|
check
|
bool
|
Refuse granules of mixed productions (see
:func: |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Dims |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a requested layer does not exist in the product. |
Examples:
open_disp_tree ¶
open_disp_tree(paths: PathsLike, *, layers: Optional[Sequence[str]] = None, chunks: ChunkSpec = 'native', frame_id: Optional[int] = None, min_version: Optional[str] = None, check: bool = True) -> xr.DataTree
Open a frame as a DataTree that mirrors the granule groups.
Nodes: the root holds the displacement and quality layers (as
:func:open_disp), /corrections the correction layers, and
/identification and /metadata hold the first granule's scalar
values as attributes (xarray cannot decode their byte strings). Values that
change per granule, such as the dates, are in the time and
reference_time coordinates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
PathsLike
|
As for :func: |
required |
layers
|
PathsLike
|
As for :func: |
required |
chunks
|
PathsLike
|
As for :func: |
required |
frame_id
|
PathsLike
|
As for :func: |
required |
min_version
|
PathsLike
|
As for :func: |
required |
check
|
PathsLike
|
As for :func: |
required |
Returns:
| Type | Description |
|---|---|
DataTree
|
|
Examples:
open_static ¶
open_static(like: Dataset, *, static_dir: Optional[Union[str, Path]] = None, files: Optional[Mapping[str, Union[str, Path]]] = None, download: bool = True) -> xr.Dataset
Open the static layers of a DISP frame on the grid of like.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
like
|
Dataset
|
A DISP dataset (from :func: |
required |
static_dir
|
str or Path
|
Where DISP-S1-STATIC files are, or are downloaded to. |
None
|
files
|
mapping
|
Explicit |
None
|
download
|
bool
|
Download missing files ( |
True
|
Returns:
| Type | Description |
|---|---|
Dataset
|
Lazy |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If no static file is found or downloadable for the frame. |
Examples:
open_zarr ¶
open_zarr(store: Union[str, Path, Any], *, chunks: Any = 'shards', group: Optional[str] = None, storage_options: Optional[Mapping[str, Any]] = None, mask_and_scale: bool = False, **kwargs: Any) -> xr.Dataset
Open a Zarr store lazily, one dask chunk per shard.
:func:xarray.open_zarr makes one dask chunk per stored chunk, which
for a :func:to_zarr store is the 64 x 64 read chunk inside each shard:
a full DISP-S1 frame then opens as about 16,000 chunks per variable and
every graph built on it carries them (issue #93: 147,000 tasks for an
OLS fit of five epochs, 217 with one chunk per shard). One chunk per
shard is also the unit :func:to_zarr and region jobs write.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store
|
str, Path or zarr store
|
Local path, URL (with |
required |
chunks
|
"shards" or any :func:`xarray.open_zarr` value
|
|
'shards'
|
group
|
str
|
Group of the store to open instead of the root. |
None
|
storage_options
|
mapping
|
fsspec options for a URL store. |
None
|
mask_and_scale
|
bool
|
Decode fill values to NaN. Off by default, so integer layers keep
their dtype, as :func: |
False
|
**kwargs
|
Any
|
Passed to :func: |
{}
|
Examples:
dxr.search_granules is :func:disp_xr.search.search at the top level (it
needs the aws extra, so it is imported on first use):
search ¶
search(frame_id: int | None = None, product_version: str | None = '1.0', start_datetime: datetime | None = None, end_datetime: datetime | None = None, url_type: UrlType = UrlType.HTTPS, use_uat: bool = False, short_name: str = DISP_S1_SHORT_NAME, session: Session | None = None) -> pd.DataFrame
Query the CMR for granules matching the given frame ID and product version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_id
|
int
|
The frame ID to search for |
None
|
product_version
|
str
|
The product version to search for |
'1.0'
|
start_datetime
|
datetime
|
The start of the temporal range in UTC. |
None
|
end_datetime
|
datetime
|
The end of the temporal range in UTC. |
None
|
url_type
|
UrlType
|
The protocol to use for downloading, either "s3" or "https". |
HTTPS
|
use_uat
|
bool
|
Whether to use the UAT environment instead of main Earthdata endpoint. |
False
|
short_name
|
str
|
CMR collection short name. Defaults to DISP-S1. |
DISP_S1_SHORT_NAME
|
session
|
Session
|
HTTP session to use; a new one is created when omitted. |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
One row per granule found, filtered to the requested time range. |
Examples: