igmk / pamtra

Passive and Active Microwave TRAnsfer model
GNU General Public License v3.0
19 stars 16 forks source link

Python3 #27

Closed MeraX closed 3 years ago

MeraX commented 3 years ago

Hi Max,

thanks for starting the python3 port!

But it seems, that certain changes in that branch are not only required for python3, but also for python2 when using novel Numpy versions (I have 1.16.6).

First error occurred in https://github.com/igmk/pamtra/blob/5fbee815c12a41533d32593c43a043b193d3cb28/python/pyPamtra/libWrapper.py#L236-L247

Error: TypeError: len() of unsized object

Regarding the code comment, I guess, that it has to do with numpy, not python.

Could this modification make sense?

def lenFortStrAr(arr):
  '''
  get string length of a fortran string array

  This change is probably related to numpy 1.12 -> 1.16
  '''
  try:
    return len(arr)
  except TypeError:
    return arr.dtype.itemsize
maahn commented 3 years ago

Hi Marek, great that you were able to test that, I did not dare to touch my working Python 2.7 setup ;-). Your solution is much better, please commit the patch to the python3 branch. I'm closing this issue, if there is a follow up question, please use #15