Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
floriankrb committed Sep 15, 2023
1 parent bb9275e commit 989adcf
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions climetlab/scripts/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,6 @@ class LoadersCmd:
def do_create(self, args):
format = args.format

import zarr

try:
zarr.open(args.path, "r")
if not args.force:
raise Exception(
f"{args.path} already exists. Use --force to overwrite."
)
except zarr.errors.PathNotFoundError:
pass

if args.timeout:
import signal

Expand Down Expand Up @@ -172,6 +161,18 @@ def dummy_context():
if args.init:
assert args.config, "--init requires --config"
assert args.path, "--init requires --target"

import zarr

try:
zarr.open(args.path, "r")
if not args.force:
raise Exception(
f"{args.path} already exists. Use --force to overwrite."
)
except zarr.errors.PathNotFoundError:
pass

loader = loader_class.from_config(**kwargs)
loader.initialise()
exit()
Expand Down

0 comments on commit 989adcf

Please sign in to comment.