nasa / pyCMR

Client for CMR APIs
Apache License 2.0
24 stars 12 forks source link

What version of CMR is this supposed to use? #41

Closed 7yl4r closed 6 years ago

7yl4r commented 6 years ago

I'm seeing a number of issues with key names leading me to believe that there have been significant changes to the CMR API since this was implemented. I believe #27 is a symptom of this larger issue.

However, the CMR changelog doesn't indicate any major changes that I can correlate to API changes.

What version of the CMR API does this work with?

Below is an illustration of the expected vs actual API results as related to #27. The expected xml should contain a url, but the actual result from the API contains no url at all!

expected

_location = self['Granule']['OnlineAccessURLs']['OnlineAccessURL']['URL']

aka something like

<Granule>
    <OnlineAccessURLS>
        <OnlineAccessURL>
            <URL>ftp://whatever.nasa/whatever</URL>
        </OnlineAccessURL>
    </OnlineAccessURLS>
</Granule>

actual

example query

<Granule>
  <GranuleUR>LAADS:2901442049</GranuleUR>
  <InsertTime>2017-12-12T16:53:35.853000Z</InsertTime>
  <LastUpdate>2017-12-12T16:53:50.667000Z</LastUpdate>
  <Collection>
    <ShortName>MYD01</ShortName>
    <VersionId>6</VersionId>
  </Collection>
  <DataGranule>
    <DayNightFlag>DAY</DayNightFlag>
    <ProductionDateTime>2017-12-12T16:52:38.000000Z</ProductionDateTime>
  </DataGranule>
  <PGEVersionClass>
    <PGEVersion>6.0.26</PGEVersion>
  </PGEVersionClass>
  <Temporal>
    <RangeDateTime>
      <BeginningDateTime>2017-12-11T19:15:00.000000Z</BeginningDateTime>
      <EndingDateTime>2017-12-11T19:20:00.000000Z</EndingDateTime>
    </RangeDateTime>
  </Temporal>
  <Spatial>
    <HorizontalSpatialDomain>
      <Geometry>
        <GPolygon>
          <Boundary>
            <Point>
              <PointLongitude>-73.291070</PointLongitude>
              <PointLatitude>-6.285285</PointLatitude>
            </Point>
            <Point>
              <PointLongitude>-94.213419</PointLongitude>
              <PointLatitude>-9.306309</PointLatitude>
            </Point>
            <Point>
              <PointLongitude>-98.059912</PointLongitude>
              <PointLatitude>8.703975</PointLatitude>
            </Point>
            <Point>
              <PointLongitude>-76.994934</PointLongitude>
              <PointLatitude>11.751337</PointLatitude>
            </Point>
          </Boundary>
        </GPolygon>
      </Geometry>
    </HorizontalSpatialDomain>
  </Spatial>
  <Orderable>1</Orderable>
</Granule>

Note that the ftp download url can be found in the equivalent json API response. (one of the feed.entry[n].links)

lewismc commented 6 years ago

ACK @7yl4r I also noticed this when I was working with the examples. We should probably investigate how far this goes into the code. The examples I was working with were pretty timid to be honest, they did not really provide any advanced or testing functionality from CMR.

7yl4r commented 6 years ago

I've forked and been testing/improving some more, and may be able to submit some more pull requests when I have more concrete results, but what I really want is to get the download URL.

I just opened CMR#401 to address the lack of download url specifically since I don't really want to rewrite pyCMR to use the json endpoint.

7yl4r commented 6 years ago

Ah, here is the trouble. It is not a different version that is needed, pyCMR specifically targets the ECHO10-formatted xml endpoint.

CMR returns a simplified xml reference if the endpoint is not specified, so the fix is to ensure you ask for echo10 in the built url. This is easy to do in `cmr.cfg

search_granule_url = https://%(cmr_host)s/search/granules.echo10