JAXA — API reference#
JAXA Earth-observation archive backend — earthlens.jaxa. Background,
usage, datasets, and credentials are covered under the other pages in
this section; this page is the rendered API.
earthlens.jaxa
#
JAXA backend — Earth-observation archive over three protocols.
earthlens.jaxa reaches JAXA's Earth-observation catalogue via three
complementary SDKs, selected per-dataset by a protocol discriminator:
protocol: jaxa-earth— authless STAC + COG access through the officialjaxa.earthAPI (AW3D30 elevation, GSMaP precipitation, AMSR2 L3 re-hosts, JASMES MODIS re-hosts, …). The API returns in-memory numpy arrays which the backend writes to north-up GeoTIFFs viapyramids.dataset.Dataset.create_from_array.protocol: gportal— credentialed SFTP access through the communitygportalSDK (raw L1/L2 swaths of GCOM-W AMSR2 / GCOM-C SGLI / ALOS-2 PALSAR-2 / EarthCARE / GPM / …). Requires a free G-Portal account;JaxaAuth(creds, protocol="gportal").configure()resolves the credentials from explicit kwargs or$GPORTAL_USERNAME/$GPORTAL_PASSWORD.protocol: ptree— credentialed plain-FTP access toftp.ptree.jaxa.jpfor near-real-time Himawari-8/9 AHI HSD granules (30-day rolling archive, 10-min cadence, 10 segments per band per slot). Uses stdlibftplibonly — no additional dependency. Requires a free P-Tree account (separate from G-Portal);JaxaAuth(creds, protocol="ptree").configure()resolves the credentials from explicit kwargs or$JAXA_PTREE_USERNAME/$JAXA_PTREE_PASSWORD. Ships raw.DAT.bz2granules only — decoding HSD to arrays issatpy's job (tracked as pyramidsPY-2).
Importing this subpackage does not require the [jaxa] extra —
jaxa.earth and gportal are imported inside their branch modules
lazily, and the ptree branch uses only stdlib. Install
pip install 'earthlens[jaxa]' to enable the two SDK-backed branches.
AuthenticationError
#
Bases: AuthenticationError
Raised when a credentialed JAXA branch has no usable credentials.
Raised by the gportal and ptree branches; the jaxa-earth branch is
authless. The message names the exact fix for the missing pair: for
gportal, pass gportal_username= / gportal_password= to JAXA(...)
or set $GPORTAL_USERNAME / $GPORTAL_PASSWORD; for ptree, pass
ptree_username= / ptree_password= or set $JAXA_PTREE_USERNAME /
$JAXA_PTREE_PASSWORD.
Source code in src/earthlens/jaxa/auth.py
Catalog
#
Bases: AbstractCatalog
Reader for the bundled JAXA dataset catalog.
Subclasses :class:AbstractCatalog so the dict-like surface
(cat["aw3d30"], "aw3d30" in cat, len(cat)) comes for free. The
resolve method maps a friendly alias ("elevation") to its canonical
key ("aw3d30"); :meth:by_protocol lists the keys filtered by
protocol; :meth:get is a thin alias for get_dataset.
Attributes:
| Name | Type | Description |
|---|---|---|
datasets |
dict[str, Dataset]
|
Map from canonical key to its :class: |
available_datasets |
list[str]
|
Sorted canonical keys. |
Examples:
- List the canonical keys, resolve a friendly alias:
Source code in src/earthlens/jaxa/catalog.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
__contains__(name)
#
name in cat — accept both canonical keys and friendly aliases.
Overrides :meth:AbstractCatalog.__contains__, which only checks
self.datasets, so the alias surface ("elevation" in cat)
matches what cat.get("elevation") already accepts.
Examples:
- Aliases and canonical keys both resolve:
Source code in src/earthlens/jaxa/catalog.py
__getitem__(name)
#
cat[name] — accept both canonical keys and friendly aliases.
Overrides :meth:AbstractCatalog.__getitem__ so dict-style
lookup matches the same alias surface as :meth:get. Raises
:class:KeyError on miss (the dict-style contract; callers that
want a did-you-mean hint use :meth:get instead).
Examples:
- Lookup by alias returns the canonical row:
Source code in src/earthlens/jaxa/catalog.py
by_protocol(protocol)
#
Return canonical keys whose protocol matches protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
JaxaProtocol
|
One of |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Sorted canonical keys filtered by protocol. |
Examples:
- The bundled catalog ships all three protocols;
aw3d30is jaxa-earth,sgli-l3-nwlris gportal, andhimawari-ahi-fldkis ptree:
Source code in src/earthlens/jaxa/catalog.py
get(key)
#
Return the :class:Dataset for key (canonical, alias, or raw id).
Resolves key through :meth:resolve first, then returns the
matching curated row when one exists. Raw G-Portal numeric ids
(e.g. "11001002") and raw jaxa.earth STAC collection names
(e.g. "JAXA.G-Portal_GCOM-W.AMSR2_standard.L3-SSW.daytime.v4_global_yearly")
pass through unmapped: a passthrough :class:Dataset row is
synthesized on the fly with the right protocol so the backend
dispatches correctly — the full 799-entry G-Portal universe + the
~119-entry JAXA Earth STAC catalogue are usable without bloating
the bundled YAML with hand-curated rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A canonical key, friendly alias, raw G-Portal id, or raw jaxa.earth STAC collection name. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dataset |
Dataset
|
The matching curated row, or a synthesized passthrough |
Dataset
|
row when |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
- A friendly alias resolves to the same row as the canonical key:
- A raw G-Portal id passes through as a synthesized gportal row:
- An unknown key raises ValueError:
Source code in src/earthlens/jaxa/catalog.py
get_catalog()
#
Return the dataset map (satisfies the abstract contract).
Returns:
| Type | Description |
|---|---|
dict[str, Dataset]
|
dict[str, Dataset]: Same object as :attr: |
Examples:
- Inspect one of the rows by canonical key:
Source code in src/earthlens/jaxa/catalog.py
load(catalog_path=None)
classmethod
#
Read and validate the JAXA catalog from disk (cached).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog_path
|
Path | None
|
Path to the catalog directory (the sharded
default) or a single YAML file (tests / legacy). Defaults
to the module-level :data: |
None
|
Returns:
| Type | Description |
|---|---|
Catalog
|
A fully-populated :class: |
Catalog
|
contributing file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the path has no |
FileNotFoundError
|
If |
Source code in src/earthlens/jaxa/catalog.py
model_post_init(__context)
#
Auto-load the bundled catalog when no datasets were supplied.
Catalog() with no args reads :data:CATALOG_PATH (cached by
(path, mtime)); passing datasets=... skips the disk read (used
in tests). Either way the aliases map is derived from the loaded
rows. available_datasets is populated from the YAML's optional
available_datasets: block (the refresh CLI's --write target —
an informational index of every live SDK id across all three
protocols) or, when that block is absent, defaults to the sorted
curated keys so the dict-like surface (len(cat) etc.) still
works.
Source code in src/earthlens/jaxa/catalog.py
resolve(key)
#
Map a friendly alias / raw id to its canonical key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A canonical key, friendly alias, raw G-Portal numeric
id (e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The canonical catalog key. Raw ids pass through unchanged. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
Examples:
- A canonical key resolves to itself; an alias resolves to its row:
- Raw G-Portal numeric ids pass through unmapped:
Source code in src/earthlens/jaxa/catalog.py
Dataset
#
Bases: BaseModel
One JAXA dataset row.
The row's protocol field is the discriminator the backend dispatches
on (_jaxa_earth.py vs _gportal.py vs _ptree.py). The cross-field
validator enforces that the right identifier is present for each
protocol:
protocol="jaxa-earth"requirescollection(the STAC collection name thejaxa.earthAPI consumes, e.g."JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global").protocol="gportal"requiresshort_name(the G-Portal numeric dataset id, e.g."10003001").protocol="ptree"requiresshort_name(the P-Tree product token, e.g."himawari-ahi-fldk").
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
Canonical catalog key ( |
protocol |
JaxaProtocol
|
One of |
collection |
str | None
|
STAC collection name. Required when
|
short_name |
str | None
|
Protocol-specific product identifier — a G-Portal
numeric dataset id (e.g. |
default_band |
str | None
|
The band selected when the user does not pass
|
aliases |
list[str]
|
Friendly keys that resolve to this row's canonical key
(e.g. |
description |
str
|
Human-readable summary used in docs. |
Examples:
- A
jaxa-earthrow needscollection: - A
gportalrow needsshort_name:
Source code in src/earthlens/jaxa/catalog.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
JAXA
#
Bases: AbstractDataSource
Unified JAXA backend over three protocols (jaxa-earth, gportal, ptree).
Attributes:
| Name | Type | Description |
|---|---|---|
OUTPUT_KIND |
OutputKind
|
Fixed |
Source code in src/earthlens/jaxa/backend.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
auth
property
#
The :class:JaxaAuth bound to this request.
Returns:
| Name | Type | Description |
|---|---|---|
JaxaAuth |
JaxaAuth
|
The optional-credentials auth object. |
JaxaAuth
|
is a no-op for the |
|
JaxaAuth
|
G-Portal credentials for |
|
JaxaAuth
|
credentials for |
Examples:
- The auth object's protocol always matches the backend's:
protocol
property
#
The single protocol this request resolved to.
Returns:
| Name | Type | Description |
|---|---|---|
JaxaProtocol |
JaxaProtocol
|
One of |
Examples:
- Resolving an alias pins the protocol on construction:
__init__(start, end, variables, lat_lim, lon_lim, temporal_resolution='daily', path='', fmt='%Y-%m-%d', *, resolution=None, bands=None, gportal_username=None, gportal_password=None, ptree_username=None, ptree_password=None, catalog=None)
#
Initialise a JAXA backend instance.
Resolves every key against the catalog up front so that an unknown key (or a request that mixes more than one of the three protocols) fails at construction rather than mid-download.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
str
|
Inclusive start of the date window (parsed with |
required |
end
|
str
|
Inclusive end of the date window. |
required |
variables
|
list[str]
|
Catalog dataset keys, canonical or alias. Every key
must resolve to the same protocol — mixing keys from
more than one of |
required |
lat_lim
|
list[float]
|
|
required |
lon_lim
|
list[float]
|
|
required |
temporal_resolution
|
str
|
Advisory label only — JAXA Earth uses
the full date range, G-Portal queries on
|
'daily'
|
path
|
Path | str
|
Output directory (created if missing). |
''
|
fmt
|
str
|
|
'%Y-%m-%d'
|
resolution
|
float | None
|
|
None
|
bands
|
list[str] | None
|
Override the catalog's |
None
|
gportal_username
|
str | None
|
Explicit G-Portal username. When omitted,
|
None
|
gportal_password
|
str | None
|
Explicit G-Portal password. When omitted,
falls back to |
None
|
ptree_username
|
str | None
|
Explicit P-Tree username (the email
registered at eorc.jaxa.jp/ptree). When omitted, falls
back to |
None
|
ptree_password
|
str | None
|
Explicit P-Tree password. When omitted,
falls back to |
None
|
catalog
|
Catalog | None
|
Optional pre-built |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/earthlens/jaxa/backend.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
download(progress_bar=True, aggregate=None)
#
Fetch the requested datasets and return the written paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_bar
|
bool
|
Reserved for future per-download progress;
each branch prints its own progress lines today
(jaxa-earth via |
True
|
aggregate
|
AggregationConfig | None
|
Not supported — JAXA requests return per-date rasters; reducing them across dates is a follow-on. |
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
list[Path]: One or more files per resolved dataset, in request order. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
When |
Examples:
- Passing
aggregate=raises because per-date stacks are not reduced yet:>>> import tempfile >>> from earthlens.jaxa import JAXA >>> backend = JAXA( ... start="2020-01-01", end="2020-12-31", ... variables=["aw3d30"], ... lat_lim=[35.0, 36.0], lon_lim=[138.0, 139.0], ... path=tempfile.gettempdir(), ... ) >>> backend.download(aggregate=object()) # doctest: +ELLIPSIS Traceback (most recent call last): ... NotImplementedError: JAXA does not yet support the aggregate=...
Source code in src/earthlens/jaxa/backend.py
JaxaAuth
#
Bases: AbstractAuth[JaxaCredentials]
Resolve credentials for the bound JAXA protocol.
The class is optional-credentials: the protocol is bound at
construction so the parent contract's no-arg configure() /
is_authenticated() (the methods AbstractDataSource.authenticate()
calls) act on the right side. JaxaAuth(creds, protocol="jaxa-earth")
makes configure() a no-op; JaxaAuth(creds, protocol="gportal") or
JaxaAuth(creds, protocol="ptree") resolves the matching username +
password from explicit credentials or the protocol's env-var pair,
raising :class:AuthenticationError on miss.
After a successful configure() on a credentialed protocol, the
resolved values are available via :attr:username and
:attr:password so the branch can pass them straight into its
transport client (gportal.download(username=, password=),
ftplib.FTP.login(...), paramiko.Transport.connect(...)) instead of
mutating any SDK's module-level globals.
Attributes:
| Name | Type | Description |
|---|---|---|
_creds |
The :class: |
|
_protocol |
JaxaProtocol
|
The bound protocol — one of |
Examples:
- The
jaxa-earthprotocol never needs credentials:
Source code in src/earthlens/jaxa/auth.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
password
property
#
The resolved password (still wrapped in SecretStr).
Returns None until :meth:configure runs. Callers that need
the raw string call .get_secret_value() themselves at the call
site — the wrapper stays on JaxaAuth so it never lands in a
repr or a log line.
protocol
property
#
The protocol bound at construction.
username
property
#
The resolved username, or None until configure() runs.
__init__(credentials, protocol='jaxa-earth')
#
Bind the protocol; does not resolve credentials yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credentials
|
JaxaCredentials
|
The :class: |
required |
protocol
|
JaxaProtocol
|
The protocol this auth instance targets. The
parent's no-arg :meth: |
'jaxa-earth'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
Source code in src/earthlens/jaxa/auth.py
configure()
#
Resolve credentials for the bound protocol.
For "jaxa-earth" the call is a no-op (the JAXA Earth API needs
no auth). For "gportal" and "ptree" the call reads the
explicit credentials (preferred) or the protocol's environment
variables ($GPORTAL_USERNAME / $GPORTAL_PASSWORD and
$JAXA_PTREE_USERNAME / $JAXA_PTREE_PASSWORD respectively) as
fallback, and caches them on the instance for the branch to read
through :attr:username / :attr:password. Idempotent — a
second call after is_authenticated() returns True
short-circuits.
Raises:
| Type | Description |
|---|---|
AuthenticationError
|
When the protocol is credentialed and neither the explicit credentials nor the environment variables supply a usable username + password pair. The message names the env vars and the free-registration URL for the protocol that failed to resolve. |
Examples:
- The jaxa-earth protocol's configure is a no-op:
- With gportal credentials supplied explicitly, configure caches them
for the branch to read via
.username/.password: - The
ptreeprotocol reads its own credential pair:>>> from pydantic import SecretStr >>> from earthlens.jaxa import JaxaAuth, JaxaCredentials >>> creds = JaxaCredentials( ... ptree_username="alice@example.org", ... ptree_password=SecretStr("hunter2"), ... ) >>> auth = JaxaAuth(creds, protocol="ptree") >>> auth.configure() >>> auth.username 'alice@example.org'
Source code in src/earthlens/jaxa/auth.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
is_authenticated()
#
Return True once :meth:configure has run successfully.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Examples:
- Construction does not authenticate; configure flips the flag:
Source code in src/earthlens/jaxa/auth.py
JaxaCredentials
#
Bases: BaseModel
Frozen value object holding the credentialed-branch secrets.
All fields are optional at construction time: None means "resolve
from the corresponding environment variable at :meth:JaxaAuth.configure
time". The real "are credentials available?" gate is
:meth:JaxaAuth.configure, not this model.
G-Portal and P-Tree credentials are stored side-by-side because a
single :class:JAXA instance is bound to one protocol per call — the
unused pair is simply ignored.
Attributes:
| Name | Type | Description |
|---|---|---|
gportal_username |
str | None
|
G-Portal username. |
gportal_password |
SecretStr | None
|
G-Portal password, stored as a |
ptree_username |
str | None
|
P-Tree username (the registered email). |
ptree_password |
SecretStr | None
|
P-Tree password, stored as a |
Examples:
- The password is hidden in
repr: - The same protection applies to the P-Tree password:
- Every field is optional — rely on the environment instead:
Source code in src/earthlens/jaxa/auth.py
RetentionError
#
Bases: ValueError
Raised when a P-Tree request falls outside the 30-day archive.
P-Tree keeps only the last 30 days of HSD granules; older dates return
an FTP 450 No such file or directory (not a permanent 550), which
is opaque. This client-side guard fails fast with the exact archive
window instead so users can adjust the request.
Source code in src/earthlens/jaxa/_ptree.py
clear_catalog_cache()
#
Empty the module-level JAXA catalog parse cache.
Examples:
- Calling it is a no-op when the cache is already empty, and
subsequent
Catalog()calls re-read the YAML from disk:
Source code in src/earthlens/jaxa/catalog.py
earthlens.jaxa.backend
#
JAXA backend — dispatches a request to one of three protocols.
JAXA reaches JAXA's Earth-observation archive via three complementary
SDKs, selected per-dataset by the catalog's protocol discriminator:
protocol: jaxa-earth— authless STAC/COG access through the officialjaxa.earthAPI. The API returns in-memory numpy arrays which the backend writes to north-up GeoTIFFs viapyramids.dataset.Dataset.protocol: gportal— credentialed SFTP access through the communitygportalSDK. The backend authenticates, searches, and downloads matching products into the output directory.protocol: ptree— credentialed FTP access toftp.ptree.jaxa.jp's Himawari-8/9 HSD granules (30-day rolling archive, 10 segments per band per 10-minute slot). Ships raw.DAT.bz2files; decode ispyramids PY-2(satpyreader bridge), not this backend.
Each download() call routes every requested key to its protocol branch
(_jaxa_earth.fetch_jaxa_earth, _gportal.fetch_gportal, or
_ptree.fetch_ptree). The three branches share the request shape
(bbox + dates + a list of dataset keys); the catalog row carries the
protocol-specific identifier, default band, and aliases. Mixing keys
from more than one protocol in one call is rejected — the three paths
emit different file types (GeoTIFFs vs raw SFTP products vs raw HSD
granules) and have different concurrency profiles, so the API forces
one protocol per call.
OUTPUT_KIND = "raster"; download() returns the list of written paths.
The aggregate= argument raises NotImplementedError — multi-date
windowed reductions are a follow-on enhancement once the array-stack
shape stabilises across the catalog (see G6 in the planning doc).
JAXA
#
Bases: AbstractDataSource
Unified JAXA backend over three protocols (jaxa-earth, gportal, ptree).
Attributes:
| Name | Type | Description |
|---|---|---|
OUTPUT_KIND |
OutputKind
|
Fixed |
Source code in src/earthlens/jaxa/backend.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 | |
auth
property
#
The :class:JaxaAuth bound to this request.
Returns:
| Name | Type | Description |
|---|---|---|
JaxaAuth |
JaxaAuth
|
The optional-credentials auth object. |
JaxaAuth
|
is a no-op for the |
|
JaxaAuth
|
G-Portal credentials for |
|
JaxaAuth
|
credentials for |
Examples:
- The auth object's protocol always matches the backend's:
protocol
property
#
The single protocol this request resolved to.
Returns:
| Name | Type | Description |
|---|---|---|
JaxaProtocol |
JaxaProtocol
|
One of |
Examples:
- Resolving an alias pins the protocol on construction:
__init__(start, end, variables, lat_lim, lon_lim, temporal_resolution='daily', path='', fmt='%Y-%m-%d', *, resolution=None, bands=None, gportal_username=None, gportal_password=None, ptree_username=None, ptree_password=None, catalog=None)
#
Initialise a JAXA backend instance.
Resolves every key against the catalog up front so that an unknown key (or a request that mixes more than one of the three protocols) fails at construction rather than mid-download.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
str
|
Inclusive start of the date window (parsed with |
required |
end
|
str
|
Inclusive end of the date window. |
required |
variables
|
list[str]
|
Catalog dataset keys, canonical or alias. Every key
must resolve to the same protocol — mixing keys from
more than one of |
required |
lat_lim
|
list[float]
|
|
required |
lon_lim
|
list[float]
|
|
required |
temporal_resolution
|
str
|
Advisory label only — JAXA Earth uses
the full date range, G-Portal queries on
|
'daily'
|
path
|
Path | str
|
Output directory (created if missing). |
''
|
fmt
|
str
|
|
'%Y-%m-%d'
|
resolution
|
float | None
|
|
None
|
bands
|
list[str] | None
|
Override the catalog's |
None
|
gportal_username
|
str | None
|
Explicit G-Portal username. When omitted,
|
None
|
gportal_password
|
str | None
|
Explicit G-Portal password. When omitted,
falls back to |
None
|
ptree_username
|
str | None
|
Explicit P-Tree username (the email
registered at eorc.jaxa.jp/ptree). When omitted, falls
back to |
None
|
ptree_password
|
str | None
|
Explicit P-Tree password. When omitted,
falls back to |
None
|
catalog
|
Catalog | None
|
Optional pre-built |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/earthlens/jaxa/backend.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
download(progress_bar=True, aggregate=None)
#
Fetch the requested datasets and return the written paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_bar
|
bool
|
Reserved for future per-download progress;
each branch prints its own progress lines today
(jaxa-earth via |
True
|
aggregate
|
AggregationConfig | None
|
Not supported — JAXA requests return per-date rasters; reducing them across dates is a follow-on. |
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
list[Path]: One or more files per resolved dataset, in request order. |
Raises:
| Type | Description |
|---|---|
NotImplementedError
|
When |
Examples:
- Passing
aggregate=raises because per-date stacks are not reduced yet:>>> import tempfile >>> from earthlens.jaxa import JAXA >>> backend = JAXA( ... start="2020-01-01", end="2020-12-31", ... variables=["aw3d30"], ... lat_lim=[35.0, 36.0], lon_lim=[138.0, 139.0], ... path=tempfile.gettempdir(), ... ) >>> backend.download(aggregate=object()) # doctest: +ELLIPSIS Traceback (most recent call last): ... NotImplementedError: JAXA does not yet support the aggregate=...
Source code in src/earthlens/jaxa/backend.py
earthlens.jaxa.catalog
#
Dataset catalog for the JAXA backend.
Hosts :class:Catalog, the pydantic-backed reader for the bundled JAXA
catalog. The catalog ships as a directory of per-mission YAML files at
src/earthlens/jaxa/catalog/ (jaxa-earth.yaml, sgli.yaml,
amsr.yaml, alos-palsar.yaml, earthcare.yaml,
precipitation.yaml, …), plus a single _index.yaml carrying the merged
available_datasets: list — the same sharded layout used by the
gee and ecmwf siblings.
Each catalog row is a Dataset carrying a protocol discriminator
("jaxa-earth", "gportal", or "ptree") plus the protocol-specific
identifier — a jaxa.earth STAC collection name for "jaxa-earth", a
G-Portal numeric dataset id for "gportal", or a P-Tree product token
(e.g. "himawari-ahi-fldk") for "ptree". The catalog's
by_protocol(...) view + dataset-level validator together let the
backend route a request to the right branch without re-parsing the
YAML at every fetch.
The aliases map is a separate small index resolved by :meth:Catalog.resolve,
giving every dataset a friendly key ("elevation" → "aw3d30") on top
of its canonical key. The model is extra="forbid" so typos in the bundled
YAML fail loudly on first load rather than silently being ignored.
CATALOG_PATH points at the bundled catalog directory (or, for tests
that monkey-patch it, a single *.yaml file); :func:clear_catalog_cache
empties the (path, mtime) parse cache used by :meth:Catalog.load.
Catalog
#
Bases: AbstractCatalog
Reader for the bundled JAXA dataset catalog.
Subclasses :class:AbstractCatalog so the dict-like surface
(cat["aw3d30"], "aw3d30" in cat, len(cat)) comes for free. The
resolve method maps a friendly alias ("elevation") to its canonical
key ("aw3d30"); :meth:by_protocol lists the keys filtered by
protocol; :meth:get is a thin alias for get_dataset.
Attributes:
| Name | Type | Description |
|---|---|---|
datasets |
dict[str, Dataset]
|
Map from canonical key to its :class: |
available_datasets |
list[str]
|
Sorted canonical keys. |
Examples:
- List the canonical keys, resolve a friendly alias:
Source code in src/earthlens/jaxa/catalog.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 | |
__contains__(name)
#
name in cat — accept both canonical keys and friendly aliases.
Overrides :meth:AbstractCatalog.__contains__, which only checks
self.datasets, so the alias surface ("elevation" in cat)
matches what cat.get("elevation") already accepts.
Examples:
- Aliases and canonical keys both resolve:
Source code in src/earthlens/jaxa/catalog.py
__getitem__(name)
#
cat[name] — accept both canonical keys and friendly aliases.
Overrides :meth:AbstractCatalog.__getitem__ so dict-style
lookup matches the same alias surface as :meth:get. Raises
:class:KeyError on miss (the dict-style contract; callers that
want a did-you-mean hint use :meth:get instead).
Examples:
- Lookup by alias returns the canonical row:
Source code in src/earthlens/jaxa/catalog.py
by_protocol(protocol)
#
Return canonical keys whose protocol matches protocol.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
protocol
|
JaxaProtocol
|
One of |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: Sorted canonical keys filtered by protocol. |
Examples:
- The bundled catalog ships all three protocols;
aw3d30is jaxa-earth,sgli-l3-nwlris gportal, andhimawari-ahi-fldkis ptree:
Source code in src/earthlens/jaxa/catalog.py
get(key)
#
Return the :class:Dataset for key (canonical, alias, or raw id).
Resolves key through :meth:resolve first, then returns the
matching curated row when one exists. Raw G-Portal numeric ids
(e.g. "11001002") and raw jaxa.earth STAC collection names
(e.g. "JAXA.G-Portal_GCOM-W.AMSR2_standard.L3-SSW.daytime.v4_global_yearly")
pass through unmapped: a passthrough :class:Dataset row is
synthesized on the fly with the right protocol so the backend
dispatches correctly — the full 799-entry G-Portal universe + the
~119-entry JAXA Earth STAC catalogue are usable without bloating
the bundled YAML with hand-curated rows.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A canonical key, friendly alias, raw G-Portal id, or raw jaxa.earth STAC collection name. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dataset |
Dataset
|
The matching curated row, or a synthesized passthrough |
Dataset
|
row when |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
- A friendly alias resolves to the same row as the canonical key:
- A raw G-Portal id passes through as a synthesized gportal row:
- An unknown key raises ValueError:
Source code in src/earthlens/jaxa/catalog.py
get_catalog()
#
Return the dataset map (satisfies the abstract contract).
Returns:
| Type | Description |
|---|---|
dict[str, Dataset]
|
dict[str, Dataset]: Same object as :attr: |
Examples:
- Inspect one of the rows by canonical key:
Source code in src/earthlens/jaxa/catalog.py
load(catalog_path=None)
classmethod
#
Read and validate the JAXA catalog from disk (cached).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog_path
|
Path | None
|
Path to the catalog directory (the sharded
default) or a single YAML file (tests / legacy). Defaults
to the module-level :data: |
None
|
Returns:
| Type | Description |
|---|---|
Catalog
|
A fully-populated :class: |
Catalog
|
contributing file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the path has no |
FileNotFoundError
|
If |
Source code in src/earthlens/jaxa/catalog.py
model_post_init(__context)
#
Auto-load the bundled catalog when no datasets were supplied.
Catalog() with no args reads :data:CATALOG_PATH (cached by
(path, mtime)); passing datasets=... skips the disk read (used
in tests). Either way the aliases map is derived from the loaded
rows. available_datasets is populated from the YAML's optional
available_datasets: block (the refresh CLI's --write target —
an informational index of every live SDK id across all three
protocols) or, when that block is absent, defaults to the sorted
curated keys so the dict-like surface (len(cat) etc.) still
works.
Source code in src/earthlens/jaxa/catalog.py
resolve(key)
#
Map a friendly alias / raw id to its canonical key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A canonical key, friendly alias, raw G-Portal numeric
id (e.g. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The canonical catalog key. Raw ids pass through unchanged. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
Examples:
- A canonical key resolves to itself; an alias resolves to its row:
- Raw G-Portal numeric ids pass through unmapped:
Source code in src/earthlens/jaxa/catalog.py
Dataset
#
Bases: BaseModel
One JAXA dataset row.
The row's protocol field is the discriminator the backend dispatches
on (_jaxa_earth.py vs _gportal.py vs _ptree.py). The cross-field
validator enforces that the right identifier is present for each
protocol:
protocol="jaxa-earth"requirescollection(the STAC collection name thejaxa.earthAPI consumes, e.g."JAXA.EORC_ALOS.PRISM_AW3D30.v3.2_global").protocol="gportal"requiresshort_name(the G-Portal numeric dataset id, e.g."10003001").protocol="ptree"requiresshort_name(the P-Tree product token, e.g."himawari-ahi-fldk").
Attributes:
| Name | Type | Description |
|---|---|---|
key |
str
|
Canonical catalog key ( |
protocol |
JaxaProtocol
|
One of |
collection |
str | None
|
STAC collection name. Required when
|
short_name |
str | None
|
Protocol-specific product identifier — a G-Portal
numeric dataset id (e.g. |
default_band |
str | None
|
The band selected when the user does not pass
|
aliases |
list[str]
|
Friendly keys that resolve to this row's canonical key
(e.g. |
description |
str
|
Human-readable summary used in docs. |
Examples:
- A
jaxa-earthrow needscollection: - A
gportalrow needsshort_name:
Source code in src/earthlens/jaxa/catalog.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | |
clear_catalog_cache()
#
Empty the module-level JAXA catalog parse cache.
Examples:
- Calling it is a no-op when the cache is already empty, and
subsequent
Catalog()calls re-read the YAML from disk:
Source code in src/earthlens/jaxa/catalog.py
earthlens.jaxa.auth
#
Credentials and resolution for the JAXA backend's credentialed branches.
JAXA's archive is reached through three protocols, two of which need credentials:
protocol: jaxa-earth— open STAC + COG access through the officialjaxa.earthAPI. Authless.protocol: gportal— G-Portal mission archive accessed via SFTP through the communitygportalSDK. Needs a free G-Portal account.protocol: ptree— near-real-time Himawari-8/9 HSD granules onftp.ptree.jaxa.jp(30-day rolling archive). Needs a free P-Tree account, distinct from G-Portal registration.
JaxaAuth mirrors OpenaqAuth (optional secret resolved from explicit kwargs
or environment variables) but binds the target protocol at construction time
so the parent's no-arg AbstractAuth.configure() / is_authenticated() —
the contract AbstractDataSource.authenticate() calls — does the right
thing per protocol:
JaxaAuth(creds, protocol="jaxa-earth")makesconfigure()a no-op (no credentials needed).JaxaAuth(creds, protocol="gportal")makesconfigure()resolve and store the username + password from explicit credentials or from$GPORTAL_USERNAME/$GPORTAL_PASSWORD, raising :class:AuthenticationErroron miss.JaxaAuth(creds, protocol="ptree")does the same for P-Tree, readingptree_username/ptree_passwordoff the credentials or falling back to$JAXA_PTREE_USERNAME/$JAXA_PTREE_PASSWORD. The two credential pairs never share values — P-Tree registration is separate from G-Portal.
The resolved username / password are exposed as :attr:JaxaAuth.username
and :attr:JaxaAuth.password (the latter is a :class:pydantic.SecretStr)
so each credentialed branch can pass them straight to its transport client
as kwargs — no module-level mutation of the SDK is required.
AuthenticationError
#
Bases: AuthenticationError
Raised when a credentialed JAXA branch has no usable credentials.
Raised by the gportal and ptree branches; the jaxa-earth branch is
authless. The message names the exact fix for the missing pair: for
gportal, pass gportal_username= / gportal_password= to JAXA(...)
or set $GPORTAL_USERNAME / $GPORTAL_PASSWORD; for ptree, pass
ptree_username= / ptree_password= or set $JAXA_PTREE_USERNAME /
$JAXA_PTREE_PASSWORD.
Source code in src/earthlens/jaxa/auth.py
JaxaAuth
#
Bases: AbstractAuth[JaxaCredentials]
Resolve credentials for the bound JAXA protocol.
The class is optional-credentials: the protocol is bound at
construction so the parent contract's no-arg configure() /
is_authenticated() (the methods AbstractDataSource.authenticate()
calls) act on the right side. JaxaAuth(creds, protocol="jaxa-earth")
makes configure() a no-op; JaxaAuth(creds, protocol="gportal") or
JaxaAuth(creds, protocol="ptree") resolves the matching username +
password from explicit credentials or the protocol's env-var pair,
raising :class:AuthenticationError on miss.
After a successful configure() on a credentialed protocol, the
resolved values are available via :attr:username and
:attr:password so the branch can pass them straight into its
transport client (gportal.download(username=, password=),
ftplib.FTP.login(...), paramiko.Transport.connect(...)) instead of
mutating any SDK's module-level globals.
Attributes:
| Name | Type | Description |
|---|---|---|
_creds |
The :class: |
|
_protocol |
JaxaProtocol
|
The bound protocol — one of |
Examples:
- The
jaxa-earthprotocol never needs credentials:
Source code in src/earthlens/jaxa/auth.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | |
password
property
#
The resolved password (still wrapped in SecretStr).
Returns None until :meth:configure runs. Callers that need
the raw string call .get_secret_value() themselves at the call
site — the wrapper stays on JaxaAuth so it never lands in a
repr or a log line.
protocol
property
#
The protocol bound at construction.
username
property
#
The resolved username, or None until configure() runs.
__init__(credentials, protocol='jaxa-earth')
#
Bind the protocol; does not resolve credentials yet.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
credentials
|
JaxaCredentials
|
The :class: |
required |
protocol
|
JaxaProtocol
|
The protocol this auth instance targets. The
parent's no-arg :meth: |
'jaxa-earth'
|
Raises:
| Type | Description |
|---|---|
ValueError
|
When |
Source code in src/earthlens/jaxa/auth.py
configure()
#
Resolve credentials for the bound protocol.
For "jaxa-earth" the call is a no-op (the JAXA Earth API needs
no auth). For "gportal" and "ptree" the call reads the
explicit credentials (preferred) or the protocol's environment
variables ($GPORTAL_USERNAME / $GPORTAL_PASSWORD and
$JAXA_PTREE_USERNAME / $JAXA_PTREE_PASSWORD respectively) as
fallback, and caches them on the instance for the branch to read
through :attr:username / :attr:password. Idempotent — a
second call after is_authenticated() returns True
short-circuits.
Raises:
| Type | Description |
|---|---|
AuthenticationError
|
When the protocol is credentialed and neither the explicit credentials nor the environment variables supply a usable username + password pair. The message names the env vars and the free-registration URL for the protocol that failed to resolve. |
Examples:
- The jaxa-earth protocol's configure is a no-op:
- With gportal credentials supplied explicitly, configure caches them
for the branch to read via
.username/.password: - The
ptreeprotocol reads its own credential pair:>>> from pydantic import SecretStr >>> from earthlens.jaxa import JaxaAuth, JaxaCredentials >>> creds = JaxaCredentials( ... ptree_username="alice@example.org", ... ptree_password=SecretStr("hunter2"), ... ) >>> auth = JaxaAuth(creds, protocol="ptree") >>> auth.configure() >>> auth.username 'alice@example.org'
Source code in src/earthlens/jaxa/auth.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
is_authenticated()
#
Return True once :meth:configure has run successfully.
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
|
Examples:
- Construction does not authenticate; configure flips the flag:
Source code in src/earthlens/jaxa/auth.py
JaxaCredentials
#
Bases: BaseModel
Frozen value object holding the credentialed-branch secrets.
All fields are optional at construction time: None means "resolve
from the corresponding environment variable at :meth:JaxaAuth.configure
time". The real "are credentials available?" gate is
:meth:JaxaAuth.configure, not this model.
G-Portal and P-Tree credentials are stored side-by-side because a
single :class:JAXA instance is bound to one protocol per call — the
unused pair is simply ignored.
Attributes:
| Name | Type | Description |
|---|---|---|
gportal_username |
str | None
|
G-Portal username. |
gportal_password |
SecretStr | None
|
G-Portal password, stored as a |
ptree_username |
str | None
|
P-Tree username (the registered email). |
ptree_password |
SecretStr | None
|
P-Tree password, stored as a |
Examples:
- The password is hidden in
repr: - The same protection applies to the P-Tree password:
- Every field is optional — rely on the environment instead: