Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
d737a9d
fix: add small fixes to create Items out of RDPS and HRDPS data sets …
henriaidasso Sep 23, 2025
6bde69e
feat: rdps extension added
henriaidasso Sep 23, 2025
911cbe9
feat: rdps collection config added
henriaidasso Sep 23, 2025
b5f0de9
feat: rdps implementation added
henriaidasso Sep 23, 2025
76b37a7
fix: export rdps implementation for cli access
henriaidasso Sep 23, 2025
5e5541a
fix: clean unused code comments
henriaidasso Sep 23, 2025
4d6aba0
fix: clean unused code
henriaidasso Sep 24, 2025
3866246
fix: filename for item id updated
henriaidasso Sep 24, 2025
138f0dd
fix: item validation added
henriaidasso Sep 24, 2025
cd5e801
fix: item validation added
henriaidasso Sep 24, 2025
eb86c50
fix: add properties to item
henriaidasso Sep 26, 2025
bfdd825
feat: hrdps ext. and impl. added
henriaidasso Sep 26, 2025
49804f5
fix: integrate properties
henriaidasso Sep 30, 2025
99868fc
fix: add providers handling
henriaidasso Oct 3, 2025
24066be
feat: cf extension added
henriaidasso Oct 3, 2025
90c30c1
fix: make providers optional
henriaidasso Oct 3, 2025
9ea89d7
feat: file info extension added
henriaidasso Oct 3, 2025
fc8806b
feat: dataclasses-json library added
henriaidasso Oct 7, 2025
ad2bba9
fix: contacts extension added
henriaidasso Oct 8, 2025
6c45ef2
fix: file info extension added
henriaidasso Oct 8, 2025
730763c
fix clean cf extension code
henriaidasso Oct 8, 2025
0ca5211
fix: make contacts optional
henriaidasso Oct 8, 2025
2e6a69e
Merge branch 'master' into rdps
henriaidasso Oct 8, 2025
a8c299d
fix: cordex test file fix
henriaidasso Oct 9, 2025
ec29535
fix: get assets check service_type type
henriaidasso Oct 9, 2025
933352f
Merge remote-tracking branch 'refs/remotes/origin/rdps' into rdps
henriaidasso Oct 9, 2025
27e2a40
fix: get assets check service_type type
henriaidasso Oct 9, 2025
92bc676
fix: contact data model removed
henriaidasso Oct 9, 2025
57a6836
fix: cf extension added using subclasses
henriaidasso Oct 10, 2025
d8c7b97
fix: hrdps impl. updated using subclass
henriaidasso Oct 10, 2025
2c207a7
fix: cf item extension get assets filter
henriaidasso Oct 10, 2025
c03b5cf
fix: remove dataclass-json dependency
henriaidasso Oct 10, 2025
126aa4c
doc: readme updated
henriaidasso Oct 10, 2025
40fda07
fix: file extension added using subclass
henriaidasso Oct 10, 2025
c968b28
fix: hrdps class doctstring updated
henriaidasso Oct 10, 2025
b75bb54
fix: contact rtype update
henriaidasso Oct 10, 2025
f22b369
fix: providers updated
henriaidasso Oct 15, 2025
7e6a764
fix: collection info updated
henriaidasso Oct 15, 2025
c462ecd
fix: file helper updated
henriaidasso Oct 15, 2025
e38ad09
fix: collection links updated
ahenrij Oct 16, 2025
dd7e480
fix: warning fixed
ahenrij Oct 21, 2025
4597fe9
fix: rdps tests updated
ahenrij Oct 21, 2025
29dc7e2
fix: populators updated
ahenrij Oct 21, 2025
ea75a9b
doc: comments added
ahenrij Oct 21, 2025
26d9135
fix: update link title
henriaidasso Oct 22, 2025
acaeea8
fix: add smaller size logo
ahenrij Oct 22, 2025
af3d1fe
fix: merged changes
ahenrij Oct 22, 2025
ffa1021
doc: readme updated
ahenrij Oct 23, 2025
5b60a09
fix: rdps collection info updated
ahenrij Oct 23, 2025
af32a48
fix: update model_fields access
ahenrij Oct 23, 2025
e24834a
fix: service type check in get_assets func
ahenrij Oct 23, 2025
e442359
fix: from data return type
ahenrij Oct 23, 2025
85f70f1
fix: reuse populator session in file helper
ahenrij Oct 23, 2025
faae3a1
fix: reuse populator session in file helper
ahenrij Oct 23, 2025
24a546d
fix: rdps extension updated
ahenrij Oct 23, 2025
0b10d2a
fix: collection level metadata updated
ahenrij Oct 23, 2025
0443acd
fix: update .gitignore
ahenrij Oct 23, 2025
dfe1437
fix: remove blank lines
ahenrij Oct 23, 2025
387baa7
fix: set file asset key in helper init
ahenrij Oct 23, 2025
11029e4
fix: udpate default variable values
ahenrij Oct 23, 2025
f904c4c
fix: optional file size if asset key absent
ahenrij Oct 24, 2025
01ac7da
fix: refactor helpers instantiation
ahenrij Oct 29, 2025
43a5d0b
fix: merged
ahenrij Oct 29, 2025
29b2890
doc: changes updated
ahenrij Oct 30, 2025
293a37e
doc: readme updated
ahenrij Oct 30, 2025
64e39de
fix: collection links updated
ahenrij Oct 31, 2025
660265d
fix: collection contacts updated
ahenrij Oct 31, 2025
afbe940
fix: rdps tests updated to check added fields
ahenrij Oct 31, 2025
64c33b6
fix: add crim as indexer in providers
ahenrij Oct 31, 2025
b73c216
fix: add crim as indexer in contacts only
ahenrij Oct 31, 2025
5b668e9
fix: license links updated
ahenrij Oct 31, 2025
84ab682
fix: dimensions and variables updated
ahenrij Nov 11, 2025
1a0b8aa
fix: dimensions and variables updated
ahenrij Nov 11, 2025
4366e6b
Merge branch 'master' into rdps
henriaidasso Nov 12, 2025
227a7d5
fix: precommit run
ahenrij Nov 12, 2025
30054ea
Merge branch 'master' into rdps
henriaidasso Nov 17, 2025
0dadae7
fix: updated get assets methods for uniformity
ahenrij Nov 17, 2025
49f0d4a
fix: cf iterate on values updated
ahenrij Nov 17, 2025
185ddac
fix: unit str to match validation schema
ahenrij Nov 17, 2025
8cdbc59
fix: return none for file content-length issues
ahenrij Nov 17, 2025
3f033c2
fix: remove unused future imports and adds in thredds
ahenrij Nov 17, 2025
1fea5bd
Merge branch 'master' into rdps
henriaidasso Nov 17, 2025
07696c4
fix: changes version fix
ahenrij Nov 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: file info extension added
  • Loading branch information
henriaidasso committed Oct 3, 2025
commit 9ea89d7d828d0d12c5765b840fa032f693c3b50c
55 changes: 55 additions & 0 deletions STACpopulator/extensions/fileinfo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import json
from dataclasses import dataclass
from typing import Generic, Optional, TypeVar, Union, cast

import pystac
from pystac.extensions.base import ExtensionManagementMixin, PropertiesExtension

T = TypeVar("T", pystac.Asset, pystac.Link)
SCHEMA_URI = "https://stac-extensions.github.io/file/v2.1.0/schema.json"


@dataclass
class FileInfo:
"""File Info Properties."""

size: Optional[int] = None
checksum: Optional[str] = None
header_size: Optional[int] = None
byte_order: Optional[str] = None
local_path: Optional[str] = None


class FileInfoExtension(
Generic[T],
PropertiesExtension,
ExtensionManagementMixin[Union[pystac.Asset, pystac.Link]],
):
"""FileInfoExtension class."""

def apply(self, properties: Union[FileInfo, dict[str, any]]) -> None:
"""Apply File Info Extension to the extended STAC Item or Asset."""
if isinstance(properties, dict):
properties = FileInfo(**properties)
data_json = json.loads(properties.model_dump_json(by_alias=True))
for prop, val in data_json.items():
self._set_property(prop, val)

@classmethod
def ext(cls, obj: T, add_if_missing: bool = False) -> "FileInfoExtension[T]":
"""Extend the given STAC Object with properties from the :stac-ext:`FileInfo Extension <cf>`.

This extension can be applied to instances of :class:`~pystac.Asset` or
:class:`~pystac.Link`.

Raises
------
pystac.ExtensionTypeError : If an invalid object type is passed.
"""
cls.ensure_has_extension(obj, add_if_missing)
return cast(FileInfoExtension[T], cls(obj))

@classmethod
def get_schema_uri(cls) -> str:
"""Return this extension's schema URI."""
return SCHEMA_URI