Comments (4)
it's the *=
multiplication operation that's killing the workflow, this works very well:
import iris
from distributed import Client
import dask.array as da
import iris.cube
def run_conv():
client = Client()
cube = iris.cube.Cube(da.arange(1), units='m')
print(cube.units)
cube.units = 'km s-1'
cube.convert_units('m s-1')
print(cube.units)
cube.data
if __name__ == '__main__':
run_conv()
from iris.
the problem is at realizing the data via cube.data
, it gets Unknown for unit, the conversion happens no problems ie running this results in correct print outs of units and converted units
def run_conv():
client = Client()
cube = iris.cube.Cube(da.arange(1), units='m')
print("aa", cube.units)
cube.units *= 's-1'
print("bb", cube.units)
cube.convert_units('m s-1')
print("cc", cube.units)
print("dd", cube)
that prints:
aa m
bb m.s-1
cc m s-1
dd unknown / (m s-1)
from iris.
This can be replicated without iris by calling
>>> from cf_units import Unit
>>> import dask.array as da
>>> from functools import partial
>>> da.map_blocks(partial((Unit("m") * "s-1").convert, other="m s-1"), da.arange(1)).compute()
array([0])
>>> from distributed import Client
>>> client = Client()
>>> da.map_blocks(partial((Unit("m") * "s-1").convert, other="m s-1"), da.arange(1)).compute()
...
<traceback>
...
ValueError: Unable to convert from 'Unit('unknown')' to 'Unit('m s-1')'.
resulting in the same error. This is effectively what iris is calling.
Interestingly, the following works fine:
>>> da.map_blocks(partial(Unit(Unit("m") * "s-1").convert, other="m s-1"), da.arange(1)).compute()
array([0])
I expect this could be fixed by changing this line accordingly:
Line 1147 in 18d24a9
to something like
old_unit = Unit(self.units)
from iris.
Closed by #5349
from iris.
Related Issues (20)
- Loading ERA5 data with `CHUNK_CONTROL` fails with `TypeError` HOT 1
- Add accessibility statement to the documentation HOT 2
- Performance Shift(s): `fb039abd` HOT 1
- Track "all contributors"?
- Try setting PyTest to 'filter out' any `IrisUserWarnings`
- Performance Shift(s): `c5f57daa`
- Performance Shift(s): `64848ab7`
- `np.histogram` for cubes HOT 8
- Overnight benchmark workflow failed: `8546608253` HOT 1
- Rationalising mesh dimension names
- iris.coord_categorisation.add_season_membership creates a boolean coordinate that cannot be saved to netcdf
- Coverage upload is failing from forked repositories HOT 8
- Performance Shift(s): `7a324866` HOT 1
- Typing support
- Overnight benchmark workflow failed: `8840471771` HOT 1
- Overnight benchmark workflow failed: `8855207630` HOT 1
- Iris incorrectly failing valid netcdf names HOT 3
- Performance Shift(s): `16f0cc42` HOT 1
- Performance Shift(s): `b33ccc19` HOT 1
- Performance Shift(s): `16f0cc42` HOT 1
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 iris.