I was wondering if anyone is familiar with the udunits package, would it be suitable as the foundation for physical quantities support in python? http://www.unidata.ucar.edu/software/udunits/ According to freshmeat, udunits is released under a BSD-style license.
Hi Darren, We are using it in cdat, we even have a direct python wrapping to it. (I tried to email it to the list but it got held becasue it's too big) On another C project I'm using udunits2 it's much easier to build. Anyhow if you want i can email you our package (unless it gets approved on the list here) and you can either use it, discard it or improve it. Best regards, C. Darren Dale wrote:
I was wondering if anyone is familiar with the udunits package, would it be suitable as the foundation for physical quantities support in python?
http:// www. unidata.ucar.edu/software/udunits/
According to freshmeat, udunits is released under a BSD-style license. _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http:// projects.scipy.org/mailman/listinfo/scipy-dev
Hi Charles 2008/7/29 Charles Doutriaux <doutriaux1@llnl.gov>:
Anyhow if you want i can email you our package (unless it gets approved on the list here) and you can either use it, discard it or improve it.
Rather put such big files on the web, and send us a link. That way, interested parties can download the code, without scipy-dev mailing large attachments to all subscribers. Whereas sharing SVN repositories requires some configuration, bzr and mercurial can be shared very easily (i.e. just dump it on the web, or use launchpad, hgwebdir, ...). On the other hand, a .tar.gz is also perfectly acceptable! Looking forward to seeing what you came up with! Cheers Stéfan
Hi Stepfan Weel it was a tar.gz that wasn't that big (43k) ... anyway you can svn it out at: svn export http://www-pcmdi.llnl.gov/svn/repository/cdat/trunk/Packages/unidata C. Stéfan van der Walt wrote:
Hi Charles
2008/7/29 Charles Doutriaux <doutriaux1@llnl.gov>:
Anyhow if you want i can email you our package (unless it gets approved on the list here) and you can either use it, discard it or improve it.
Rather put such big files on the web, and send us a link. That way, interested parties can download the code, without scipy-dev mailing large attachments to all subscribers. Whereas sharing SVN repositories requires some configuration, bzr and mercurial can be shared very easily (i.e. just dump it on the web, or use launchpad, hgwebdir, ...). On the other hand, a .tar.gz is also perfectly acceptable!
Looking forward to seeing what you came up with!
Cheers Stéfan _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http:// projects.scipy.org/mailman/listinfo/scipy-dev
2008/7/30 Charles Doutriaux <doutriaux1@llnl.gov>:
Weel it was a tar.gz that wasn't that big (43k) ... anyway you can svn it out at: svn export http://www-pcmdi.llnl.gov/svn/repository/cdat/trunk/Packages/unidata
Loos like we need a password for that? Cheers Stéfan
Hi Stefan, No it shouldn't need a password, this is the trunk anybody can access it, what message do you get? C. Stéfan van der Walt wrote:
2008/7/30 Charles Doutriaux <doutriaux1@llnl.gov>:
Weel it was a tar.gz that wasn't that big (43k) ... anyway you can svn it out at: svn export http:// www-pcmdi.llnl.gov/svn/repository/cdat/trunk/Packages/unidata
Loos like we need a password for that?
Cheers Stéfan _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http:// projects.scipy.org/mailman/listinfo/scipy-dev
On Jul 30, 2008, at 5:02 PM, Charles Doutriaux wrote:
No it shouldn't need a password, this is the trunk anybody can access it, what message do you get?
To view this page, you need to log in to area “PCMDI Subversion Repository” on www-pcmdi.llnl.gov:80. Your password will be sent in the clear.
Ok I'm not sure if that's the problem, but our server is now "breaking" links... (too worried we might be sending link to viruses or whatever...) So make sure you DO NOT copy the space in the url between http and www-pcmdi C. Jonathan Guyer wrote:
On Jul 30, 2008, at 5:02 PM, Charles Doutriaux wrote:
No it shouldn't need a password, this is the trunk anybody can access it, what message do you get?
To view this page, you need to log in to area “PCMDI Subversion Repository” on www-pcmdi.llnl.gov:80.
Your password will be sent in the clear. _______________________________________________ Scipy-dev mailing list Scipy-dev@scipy.org http:// projects.scipy.org/mailman/listinfo/scipy-dev
On Jul 30, 2008, at 7:00 PM, Charles Doutriaux wrote:
Ok I'm not sure if that's the problem, but our server is now "breaking" links... (too worried we might be sending link to viruses or whatever...) So make sure you DO NOT copy the space in the url between http and www-pcmdi
I noticed that in your message. There was no space in the URL I tested.
Hi Charles, On Wednesday 30 July 2008 07:00:13 pm Charles Doutriaux wrote:
Ok I'm not sure if that's the problem, but our server is now "breaking" links... (too worried we might be sending link to viruses or whatever...) So make sure you DO NOT copy the space in the url between http and www-pcmdi
Thank you for posting the link, but I also have not been able to access the repository: Authentication realm: <http://www-pcmdi.llnl.gov:80> PCMDI Subversion Repository Password for '***': Darren
Darren, Ok looks like our security update was a bit too strong :) can you try again ? Thx, C. Darren Dale wrote:
Hi Charles,
On Wednesday 30 July 2008 07:00:13 pm Charles Doutriaux wrote:
Ok I'm not sure if that's the problem, but our server is now "breaking" links... (too worried we might be sending link to viruses or whatever...) So make sure you DO NOT copy the space in the url between http and www-pcmdi
Thank you for posting the link, but I also have not been able to access the repository:
Authentication realm: <http:// www-pcmdi.llnl.gov:80> PCMDI Subversion Repository Password for '***':
Darren
Hi Charles, On Thursday 31 July 2008 06:56:33 pm you wrote:
Ok looks like our security update was a bit too strong :) can you try again ?
Thanks, I am able to grab the sources now. I did a search on the web a few days ago to see if udunits can be used on Windows. The answer appeared to be no, but I tried installing your unidata python package on windows anyway. There is no windows binary for Numeric and python-2.5, so I tried a first order workaround by changing the Numeric include in udunits_wrap.c to: #include "numpy/arrayobject.h" This required importing numpy in your setup script and adding numpy.get_include() to the list of include_dirs in your extension constructor. I also had to modify the path where udunits is installed, in both setup.py and udunits.py. (moving udunits.dat into Lib would allow the library to be installed using distutils package_data, I think.) I am happy to say that I was able to build the package with mingw, install it, and run the test script. I didn't see any problems (but I didn't really know what to look for). Would you mind posting a link to your udunits2 package? Based on your nice work here, and the appearance of windows compatibility, it seems like it shouldn't be too difficult to build a physical_quantities object subclassed from numpy.ndarray. Have you considered this possibility? Regards, Darren
Hi Darren, Here are some examples:
a = unidata.udunits(1,'m') a.to('cm') udunits(100.0,"cm")
You can also use: a.known_units() or a.available_units() Come to think of it I should change it so it only shows units compatible with "a" Anyway, sorry I pointed to the "trunk" version, I forgot it is still Numeric based. Or devel version is numpy based. you can access it at: svn export http://www-pcmdi.llnl.gov/svn/repository/cdat/branches/devel/Packages/unidat... user: guest psswd: cdatdevel It is indeed based on udunits (not udunits2). I should upgrade. You're right we could probably subclass numpy. Do you want to do it? Honestly I don't think i'll have time in the next month or so. C. Darren Dale wrote:
Hi Charles,
On Thursday 31 July 2008 06:56:33 pm you wrote:
Ok looks like our security update was a bit too strong :) can you try again ?
Thanks, I am able to grab the sources now.
I did a search on the web a few days ago to see if udunits can be used on Windows. The answer appeared to be no, but I tried installing your unidata python package on windows anyway.
There is no windows binary for Numeric and python-2.5, so I tried a first order workaround by changing the Numeric include in udunits_wrap.c to:
#include "numpy/arrayobject.h"
This required importing numpy in your setup script and adding numpy.get_include() to the list of include_dirs in your extension constructor. I also had to modify the path where udunits is installed, in both setup.py and udunits.py. (moving udunits.dat into Lib would allow the library to be installed using distutils package_data, I think.)
I am happy to say that I was able to build the package with mingw, install it, and run the test script. I didn't see any problems (but I didn't really know what to look for).
Would you mind posting a link to your udunits2 package?
Based on your nice work here, and the appearance of windows compatibility, it seems like it shouldn't be too difficult to build a physical_quantities object subclassed from numpy.ndarray. Have you considered this possibility?
Regards, Darren
Hi Charles, Yes, I think I would like to take a shot at this. I have been meaning to get back to the matplotlib documentation effort, but I really need this for work. I'll look into it this weekend. Thanks, Darren On Friday 01 August 2008 10:28:29 am Charles Doutriaux wrote:
Hi Darren,
Here are some examples:
a = unidata.udunits(1,'m') a.to('cm')
udunits(100.0,"cm")
You can also use: a.known_units() or a.available_units()
Come to think of it I should change it so it only shows units compatible with "a"
Anyway, sorry I pointed to the "trunk" version, I forgot it is still Numeric based. Or devel version is numpy based.
you can access it at: svn export http://www-pcmdi.llnl.gov/svn/repository/cdat/branches/devel/Packages/unida ta user: guest psswd: cdatdevel
It is indeed based on udunits (not udunits2). I should upgrade.
You're right we could probably subclass numpy. Do you want to do it?
Honestly I don't think i'll have time in the next month or so.
C.
Darren Dale wrote:
Hi Charles,
On Thursday 31 July 2008 06:56:33 pm you wrote:
Ok looks like our security update was a bit too strong :) can you try again ?
Thanks, I am able to grab the sources now.
I did a search on the web a few days ago to see if udunits can be used on Windows. The answer appeared to be no, but I tried installing your unidata python package on windows anyway.
There is no windows binary for Numeric and python-2.5, so I tried a first order workaround by changing the Numeric include in udunits_wrap.c to:
#include "numpy/arrayobject.h"
This required importing numpy in your setup script and adding numpy.get_include() to the list of include_dirs in your extension constructor. I also had to modify the path where udunits is installed, in both setup.py and udunits.py. (moving udunits.dat into Lib would allow the library to be installed using distutils package_data, I think.)
I am happy to say that I was able to build the package with mingw, install it, and run the test script. I didn't see any problems (but I didn't really know what to look for).
Would you mind posting a link to your udunits2 package?
Based on your nice work here, and the appearance of windows compatibility, it seems like it shouldn't be too difficult to build a physical_quantities object subclassed from numpy.ndarray. Have you considered this possibility?
Regards, Darren
Hi Darren Darren Dale wrote:
I was wondering if anyone is familiar with the udunits package, would it be suitable as the foundation for physical quantities support in python?
http://www.unidata.ucar.edu/software/udunits/
According to freshmeat, udunits is released under a BSD-style license. FWIW I have a small units-of-measurement class that I've used a bit in my own code.
Example of use is here: http://freesteam.svn.sourceforge.net/viewvc/freesteam/freesteam/trunk/python/example.py?revision=441&view=markup The implementation is here: http://freesteam.svn.sourceforge.net/viewvc/freesteam/freesteam/trunk/measur... The interesting thing about this implementation is that it interfaces with some C++ template-based code that performs units-of-measurement checking at *compile time*, with no runtime overhead. So the idea is that Python is used for a slightly 'heavy' system of storing values (plus their dimension data, eg M L T^-1) and these values are efficiently passed into C/C++ where units-checked calculations are done with no overhead. I'm not suggesting this is a 'mature' and 'complete' system but if anyone's thinking about making some sort of official implementation for this stuff, these ideas might be worth some thought. Also might be worth thinking about efficient storing of arrays of values with the same unit-dimensions eg via numpy. Cheers JP
participants (5)
-
Charles Doutriaux -
Darren Dale -
John Pye -
Jonathan Guyer -
Stéfan van der Walt