podaac / l2ss-py

Level 2 subsetter with Harmony integration
https://podaac.github.io/l2ss-py/
Apache License 2.0
11 stars 11 forks source link

Error is raised when no variables are specified at the CLI for a netCDF that has groups #143

Closed danielfromearth closed 1 year ago

danielfromearth commented 1 year ago

To reproduce:

  1. To avoid affecting the original test data file, copy the OCO3 test data file (I chose this file because it has groups) from tests/data/OCO3/OCO3_L2_LITE_SIF.EarlyR/oco3_LtSIF_200226_B10206r_200709053505s.nc4 to a new directory, let's say ~/test_temp/oco3_LtSIF_200226_B10206r_200709053505s.nc4.

  2. Then run the subsetter — without any variables specified — at the command line:

    poetry run l2ss-py ~/test_temp/oco3_LtSIF_200226_B10206r_200709053505s.nc4 ~/test_temp/oco3_LtSIF_200226_B10206r_200709053505s_subsetted.nc4 --bbox -180 -90 180 90

The following error is raised:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/dkaufma3/projects/l2ss-py/podaac/subsetter/run_subsetter.py", line 116, in main
    run_subsetter(sys.argv[1:])
  File "/Users/dkaufma3/projects/l2ss-py/podaac/subsetter/run_subsetter.py", line 95, in run_subsetter
    subset.subset(
  File "/Users/dkaufma3/projects/l2ss-py/podaac/subsetter/subset.py", line 1080, in subset
    variables = ['/' + var if not var.startswith('/') else var for var in variables]
TypeError: 'NoneType' object is not iterable