Commit da7a0c0a authored by Matthias Weidenthaler's avatar Matthias Weidenthaler
Browse files

Added hdu argument to query_metadata function

parent ac09dcfb
...@@ -111,6 +111,7 @@ The helper will send HTTP requests to an external API. CSST_BACKEND_API_URL env ...@@ -111,6 +111,7 @@ The helper will send HTTP requests to an external API. CSST_BACKEND_API_URL env
def query_metadata( def query_metadata(
filter: Dict[str, Any], filter: Dict[str, Any],
key: List[str], key: List[str],
hdu: int = 0
) -> List[Dict[str, Any]]: ) -> List[Dict[str, Any]]:
""" """
Query for file info by metadata values. Query for file info by metadata values.
...@@ -118,6 +119,7 @@ def query_metadata( ...@@ -118,6 +119,7 @@ def query_metadata(
Args: Args:
filter: The filter dict described below. filter: The filter dict described below.
key: A list of string values, corresponding to metadata keys that should be included in the output. key: A list of string values, corresponding to metadata keys that should be included in the output.
hdu: The hdu the filter & key arguments refer to. Default is 0. E.g. 0, 1.
Returns: Returns:
A List[Dict] of matching documents containing a file_path value and the keys set as 'key' parameter under 'metadata'. A List[Dict] of matching documents containing a file_path value and the keys set as 'key' parameter under 'metadata'.
E.g. with key = ["CABEND", "qc_status"] E.g. with key = ["CABEND", "qc_status"]
......
...@@ -5,6 +5,7 @@ from typing import Dict, Any, List ...@@ -5,6 +5,7 @@ from typing import Dict, Any, List
def query_metadata( def query_metadata(
filter: Dict[str, Any], filter: Dict[str, Any],
key: List[str], key: List[str],
hdu: int = 0
) -> List[Dict[str, Any]]: ) -> List[Dict[str, Any]]:
""" """
Query for file info by metadata values. Query for file info by metadata values.
...@@ -12,6 +13,7 @@ def query_metadata( ...@@ -12,6 +13,7 @@ def query_metadata(
Args: Args:
filter: The filter dict described below. filter: The filter dict described below.
key: A list of string values, corresponding to metadata keys that should be included in the output. key: A list of string values, corresponding to metadata keys that should be included in the output.
hdu: The hdu the filter & key arguments refer to. Default is 0. E.g. 0, 1.
Returns: Returns:
A List[Dict] of matching documents containing a file_path value and the keys set as 'key' parameter under 'metadata'. A List[Dict] of matching documents containing a file_path value and the keys set as 'key' parameter under 'metadata'.
E.g. with key = ["dataset", "instrument", "obs_group", "obs_id"] E.g. with key = ["dataset", "instrument", "obs_group", "obs_id"]
...@@ -41,6 +43,7 @@ def query_metadata( ...@@ -41,6 +43,7 @@ def query_metadata(
payload = { payload = {
"filter": filter, "filter": filter,
"key": key, "key": key,
"hdu": hdu
} }
try: try:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment