cedadev / nappy

NASA Ames Processing in PYthon (NAPPy) - a Python library for reading, writing and converting NASA Ames files.
BSD 3-Clause "New" or "Revised" License
9 stars 13 forks source link

conversion scripts in Python 3: missing apply() #47

Closed FObersteiner closed 2 years ago

FObersteiner commented 2 years ago

Description

Scripts in the /scripts directory still seem to have some Python 2. That causes for example

[...]/nappy/nappy/script$ python na2nc.py -i '[...]/nappy/tests/testdata/1001.na' -o '[...]/test_out.nc'
Traceback (most recent call last):
  File "[...]/nappy/nappy/script/na2nc.py", line 126, in <module>
    na2nc(args)
  File "[...]/nappy/nappy/script/na2nc.py", line 120, in na2nc
    nc_file = apply(nappy.convertNAToNC, [na_file], arg_dict)
NameError: name 'apply' is not defined

I think this can be fixed pretty easily without breaking anything. For example in na2nc.py, line 118 to 120 would be replaced with

nc_file = nappy.convertNAToNC(**arg_dict)

to run in Python 3. I can make a PR if you want.

agstephens commented 2 years ago

Hi @MrFuppes, thanks for spotting this. I think we need to address those scripts and create them with entry-points in the setup.py file. If you have the knowhow to do this then please put in PR and I'll review. Thanks

FObersteiner commented 2 years ago

you mean to run the scripts via CLI? I think the setup.py does have the entry points, and so far I think I got the na2nc and nc2na working, just the nc2csv is still crashing for some import error. I'd also like to test on my Windows machine.