Comments (2)
Here is the code, for reproducibility:
import atlite
import matplotlib.pyplot as plt
import geopandas as gpd
from pathlib import Path
import xarray as xr
pypsa_eur_dir = Path('/home/fabian/vres/py/pypsa-eur/')
chunked = atlite.Cutout('pypsa-eur.nc', chunks={'time':100})
non_chunked = atlite.Cutout('pypsa-eur.nc', chunks=None)
layout = xr.ones_like(chunked.data.height)
kwargs = dict(layout=layout, hour_shift=3)
heat_demand = xr.Dataset(dict(chunked = chunked.heat_demand(**kwargs),
non_chunked = non_chunked.heat_demand(**kwargs)))
fig, (ax1, ax2) = plt.subplots(2,1, sharex=True)
heat_demand.to_array(name='Total Heat Demand Europe').plot.line(x='time', ax=ax1)
(chunked.data.temperature.mean(['x', 'y']).resample(time='1D').mean() - 273)\
.rename('T [°C]').plot.line(ax=ax2)
fig.tight_layout()
fig.savefig('heat_demand_chunked.png')
from atlite.
Just a small note to clarify: Atlite v0.0.2 or v0.2 before merging the dask compatibility
PR by Fabian had the problem that when they were averaging over days with a active time-shift of f.ex. 2hrs, they would in each window see a day with only 22hrs at the beginning and additional day of 2hrs at the end, over which the averages were computed. This introduced non-unique indices at the boundary as described in #6. One would have had to postprocess these manually by averaging the duplicate entries with the correct weights, ie. use (2*left + 22*right) / 24
at each boundary.
The dask chunks on the other hand know their neighbours and they seem to be combined correctly automatically, so that no postprocessing is necessary, anymore!
from atlite.
Related Issues (20)
- Add heuristic for ERA5 download chunk sizes HOT 3
- Incorrect unit conversion in hydro inflow shift
- ERA5 Solar Position Time Shift Broken for Certain Time Spans HOT 5
- Cutout AttributeError: "EntryPoints" object has no attribute get in Colab HOT 2
- Question about runoff conversion HOT 3
- Include xarray-spatial
- pad_extent leads to rasterio error for global scape
- Licence description on PyPI incorrect HOT 1
- Error cannot convert float nan to int HOT 10
- Issue with build_cutout using alite HOT 5
- reanalysis-era5-single-levels HOT 3
- Atlite errors with ESRI:540060 reprojections and Fiji HOT 4
- 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 3
- 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
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.