Skip to content

Commit

Permalink
Delay xarray import
Browse files Browse the repository at this point in the history
  • Loading branch information
HCookie committed Sep 23, 2024
1 parent 50bd6a3 commit bcb3907
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/anemoi/inference/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
from typing import TypeVar

import numpy as np
import xarray as xr

if TYPE_CHECKING:
import earthkit.data as ekd
import xarray as xr

Array = TypeVar("Array")

Expand Down Expand Up @@ -169,6 +169,7 @@ def from_xarray(
>>> Condition.from_xarray(ds, flatten="{variable}_{lat}"))
Condition(['air_75.0', 'air_72.5', 'air_70.0', 'air_67.5', 'air_65.0', 'air_62.5', 'air_60.0', 'air_57.5', 'air_55.0', 'air_52.5', 'air_50.0', 'air_47.5', 'air_45.0', 'air_42.5', 'air_40.0', 'air_37.5', 'air_35.0', 'air_32.5', 'air_30.0', 'air_27.5', 'air_25.0', 'air_22.5', 'air_20.0', 'air_17.5', 'air_15.0'], private_info = None)
"""
import xarray as xr

# Flatten the data if required
if flatten is not None:
Expand Down

0 comments on commit bcb3907

Please sign in to comment.