OPENDAP/bes

fileout_covjson module can return invalid JSON reponse

lewismc opened this issue · 3 comments

The fileout_covjson can/does return invalid JSON in OPeNDAP Hyrax (1.16.0). Specifically, if we take SPURS_wg_ASL2.nc.covjson as an example

  • -nan is present in the domain/axes/x/values which is not permitted in JSON syntax
  • no comma is present after the domain/axes object
{
  "type": "Coverage",
  "domain": {
    "type" : "Domain",
    "domainType": "Grid",
    "axes": {
      "x": {
        "values": [...]
      },
      "y": {
        "values": [...]
      },
      "t": {
        "values": ["2018-01-01T00:12:20Z"]
      }
    }    <<<<<<<<<<<<<<<<<< COMMA MISSING HERE
    "referencing": [{
      "coordinates": ["t"],
      "system": {
        "type": "TemporalRS",
        "calendar": "Gregorian"
      }
    },
  • additional commas are present in parameter descriptions
...
    "parameters": {
      "lon_std": {
        "type": "Parameter",
        "description": {
          "en": "Standard deviation for longitude",  <<<<<<<< UNNECESSARY COMMA
        },
        "unit": {
          "label": {
            "en": "degrees_east"
          }
        },
...
  • An additional parameter is present at the end of the parameters block
...
        },
        "observedProperty": {
          "label": {
            "en": "Number of surface current direction measurements used"
          }
        }
      }
    }, <<<<<<<<<<< UNNECESSARY COMMA
  },
  "ranges": {
    "lon_std": {
      "type": "NdArray",
  • the JSON closing syntax is invalid
...
    "cur_dir_ndata": {
      "type": "NdArray",
      "dataType": "float", 
      "axisNames": ["t", "y", "x"],
      "shape": [1],
      "values": [...]
    }
    }
  }] <<<<<<<<<<< CLOSING SQUARE BRACKET AND ADDITIONAL CURLY BRACE RESULT IN INVALID JSON SYNTAX
}

There appear to both other issues as well but I will address them in a separate ticket.

Could you provide a link for the original netCDF file?

Yes @kyang2014 all you do is remove the .covjson file suffix. Here you go

https://opendap.jpl.nasa.gov/opendap/OceanCirculation/insitu/L2/spurs1/waveglider/SPURS_wg_ASL2.nc

Apologies for delayed response.

Thanks @lewismc . I just checked the file. It is listed as a CF trajectoryprofile DSG file, which Coverage json cannot support. See https://covjson.org/. The Hyrax version at the above URL is 1.16.0. The current release version is 1.16.8. See https://github.com/OPENDAP/bes/releases/tag/3.20.13. We've improved the fileout coverage json module a lot since 1.16.0. For supported domain types, all the issues you pointed out in this ticket are fixed except handling the NaN. I need to check if coverage json allows NaN inside. Will do this later.