Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult committed Feb 17, 2024
1 parent 9aea7e9 commit 9f305bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
11 changes: 4 additions & 7 deletions ecml_tools/create/functions/actions/opendap.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
from climetlab.utils.patterns import Pattern


def opendap(context, dates, url_pattern, *args, **kwargs):
all_urls = Pattern(url_pattern, ignore_missing_keys=True).substitute(
def execute(context, dates, url_pattern, *args, **kwargs):
urls = Pattern(url_pattern, ignore_missing_keys=True).substitute(
*args, date=dates, **kwargs
)

ds = load_source("empty")
levels = kwargs.get("level", kwargs.get("levelist"))

for url in all_urls:
print("URL", url)
for url in urls:
# print("URL", url)
s = load_source("opendap", url)
s = s.sel(
valid_datetime=[d.isoformat() for d in dates],
Expand All @@ -32,6 +32,3 @@ def opendap(context, dates, url_pattern, *args, **kwargs):
s = s.sel(levelist=levels)
ds = ds + s
return ds


execute = opendap
4 changes: 1 addition & 3 deletions ecml_tools/create/functions/steps/rotate_winds.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ def rotate_winds(lats, lons, x_wind, y_wind, source_projection, target_projectio
source_projection = pyproj.Proj(source_projection)
target_projection = pyproj.Proj(target_projection)

print("source_projection", source_projection)
print("target_projection", target_projection)

transformer = pyproj.transformer.Transformer.from_proj(
source_projection, target_projection
)
Expand All @@ -43,6 +40,7 @@ def rotate_winds(lats, lons, x_wind, y_wind, source_projection, target_projectio
orig_speed = np.sqrt(x_wind**2 + y_wind**2)

x0, y0 = source_projection(lons, lats)
print(x0, y0)
if source_projection.name != "longlat":
x1 = x0 + x_wind
y1 = y0 + y_wind
Expand Down

0 comments on commit 9f305bb

Please sign in to comment.