Comments (6)
Fine, then I'll just re-raise the MergeError exception from xarray and we'll leave it at that, that is at least more descriptive than what you get now.
from atlite.
I think this is fixed by commit 193164d. I'd appreciate if you could test!
from atlite.
I think this is fixed by commit 193164d. I'd appreciate if you could test!
Here is the result
WARNING:atlite.utils:
Found an old-style directory-like cutout. It can manually be recreated using
cutout = atlite.Cutout("../cutouts/western-asia-2016-era5.nc",
module="era5",
time=slice("2016-01", "2016-12"),
x=slice(24.899999618530273, 64.19999694824219),
y=slice(44.099998474121094, 10.800000190734863)
cutout.prepare()
but we are trying to offer an automated migration as well ...
WARNING:atlite.utils:Automatic migration failed. Re-create the cutout with the command above!
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-8-96088e8e5a64> in <module>
5 x=slice(25,64),
6 y=slice(44,11),
----> 7 time="2016"
8 )
~/miniconda/envs/atlite-v0.2/lib/python3.7/site-packages/atlite/cutout.py in __init__(self, name, data, cutout_dir, **cutoutparams)
92 elif os.path.isdir(os.path.join(self.cutout_dir, self.name)):
93 data = utils.migrate_from_cutout_directory(os.path.join(self.cutout_dir, self.name),
---> 94 self.name, self.cutout_fn, cutoutparams)
95 self.is_view = True
96 else:
~/miniconda/envs/atlite-v0.2/lib/python3.7/site-packages/atlite/utils.py in migrate_from_cutout_directory(old_cutout_dir, name, cutout_fn, cutoutparams)
85 logger.warning("Automatic migration failed. Re-create the cutout with the command above!")
86
---> 87 data.attrs['prepared_features'] = list(sys.modules['atlite.datasets.' + data.attrs["module"]].features)
88
89 return data
UnboundLocalError: local variable 'data' referenced before assignment
I think the warning offered is helpful enough and provides all the commands a user needs to quickly get back into the game.
Providing a unprepared cutout instead is I think not a good solution:
Either the loading of the prepared cutout fails (preferred) or succeeds.
But importing a prepared cutout and recieving an unprepared cutout is not what I would expect as a user.
Maybe just throw an additional exception when the automigration / merging fails?
from atlite.
One must say, you do have a peculiar cutout there, with time-dependent roughness value in one month and an independent one in another?
MergeError: conflicting values for variable 'roughness' on objects to be combined:
first value: <xarray.Variable (y: 112, x: 132)>
dask.array<shape=(112, 132), dtype=float32, chunksize=(112, 132)>
Attributes:
units: m
long_name: Forecast surface roughness
second value: <xarray.Variable (time: 8784, y: 112, x: 132)>
dask.array<shape=(8784, 112, 132), dtype=float32, chunksize=(1440, 112, 132)>
Attributes:
units: m
long_name: Forecast surface roughness
from atlite.
Sorry to disappoint, but except for one details that is just a standard cutout downloaded with the cdsapi
via the era5.py
module. No time indepdendent/dependent roughness there:
> for dspath in pathlib.Path("../cutouts/western-asia-2016-era5/").glob("2016*.nc"):
> with xr.open_dataset(dspath) as ds:
> print(dspath,":", "time" in ds.roughness.coords, ds.roughness.size)
../cutouts/western-asia-2016-era5/201601.nc : False 14784
../cutouts/western-asia-2016-era5/201602.nc : False 14784
../cutouts/western-asia-2016-era5/201603.nc : False 14784
../cutouts/western-asia-2016-era5/201604.nc : False 14784
../cutouts/western-asia-2016-era5/201605.nc : False 14784
../cutouts/western-asia-2016-era5/201606.nc : False 14784
../cutouts/western-asia-2016-era5/201607.nc : False 14784
../cutouts/western-asia-2016-era5/201608.nc : False 14784
../cutouts/western-asia-2016-era5/201609.nc : False 14784
../cutouts/western-asia-2016-era5/201610.nc : False 14784
../cutouts/western-asia-2016-era5/201611.nc : False 14784
../cutouts/western-asia-2016-era5/201612.nc : False 14784
from atlite.
Ok, I don't understand the MergeError output then, but it also does not matter too much, anyway.
from atlite.
Related Issues (20)
- reanalysis-era5-single-levels HOT 3
- Atlite errors with ESRI:540060 reprojections and Fiji HOT 7
- Read from url for `excluder.add_raster` and `excluder.add_geometry` HOT 2
- PV conversion: New model based on Bloomfield et al. (2019)
- Wind Conversion: potential bug when power curve does not end with zero after cutout speed HOT 1
- Weather/climate data variable descriptions (for alternate model data use) HOT 2
- Problems with `convert_and_aggregate` for long timespans? HOT 12
- Data type error when building cutout with SARAH v3 HOT 4
- Merging cutouts / Integrate downloaded SARAH data into existing ERA-5 cutout HOT 1
- Setting the "capacity_factor_timeseries = True" the results seem not to change HOT 2
- Time misalignment between ERA5 and SARAH? HOT 6
- "Optimal" orientation does always lead to more output HOT 4
- Migrate to new CDS infrastructure
- CSP has capacity factors > 1 when passing shapes HOT 7
- `compute_shape_availability` triggers numpy failure: Python integer 255 out of bounds for int8 HOT 3
- Unable to generate SARAH cutouts HOT 1
- The problem of calculating average weather using normalized layout HOT 5
- Dramatically different download speeds between versions HOT 15
- Allow wind speeds to be corrected by a location-specific linear factor (e.g. from GWA)
- export/save function for final eligible area
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atlite.