Search with wget won't work
-
- Posts: 8
- Joined: Mon Oct 24, 2022 4:51 pm America/New_York
Search with wget won't work
Tried the example for command line interface provided on the "Search and Download" page:
wget -q --post-data="sensor=octs&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&addurl=1&results_as_file=1&search=*DAY_CHL*" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
Got an error message:
<h1>An error has occurred</h1>
Filename pattern invalid
Can I get help on how to modify the search? Thank you!
wget -q --post-data="sensor=octs&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&addurl=1&results_as_file=1&search=*DAY_CHL*" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
Got an error message:
<h1>An error has occurred</h1>
Filename pattern invalid
Can I get help on how to modify the search? Thank you!
Filters:
-
- Posts: 396
- Joined: Mon Jun 22, 2020 5:24 pm America/New_York
- Has thanked: 8 times
- Been thanked: 8 times
Re: Search with wget won't work
Try: "O*DAY_CHL*"
wget -q --post-data="results_as_file=1&std_only1&subType1&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&search=O*DAY_CHL*&sensor_id=9" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
wget -q --post-data="results_as_file=1&std_only1&subType1&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&search=O*DAY_CHL*&sensor_id=9" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
-
- Posts: 8
- Joined: Mon Oct 24, 2022 4:51 pm America/New_York
Re: Search with wget won't work
Thanks! This works!
How should I modify the search command to be able make it work in general? My goal is to get a list of files for daily and monthly MODIS Aqua chlorophyll-a data files, and check for new files to download (so that the data is up to date locally).
I tried to search the MODIS Aqua chlorophyll-a data, this is the command generated on the page after a manual search on the API. But it didn't work on my computer.
wget -q --post-data="results_as_file=1&std_only1&subType1&search=A2019*.L3m_MO_CHL_chlor_a_4km.nc" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
Would you help me figure out how to modify this one and alike? Thank you very much!
Daisy
How should I modify the search command to be able make it work in general? My goal is to get a list of files for daily and monthly MODIS Aqua chlorophyll-a data files, and check for new files to download (so that the data is up to date locally).
I tried to search the MODIS Aqua chlorophyll-a data, this is the command generated on the page after a manual search on the API. But it didn't work on my computer.
wget -q --post-data="results_as_file=1&std_only1&subType1&search=A2019*.L3m_MO_CHL_chlor_a_4km.nc" -O - https://oceandata.sci.gsfc.nasa.gov/api/file_search
Would you help me figure out how to modify this one and alike? Thank you very much!
Daisy
-
- Posts: 396
- Joined: Mon Jun 22, 2020 5:24 pm America/New_York
- Has thanked: 8 times
- Been thanked: 8 times
Re: Search with wget won't work
Hi Daisy,
Your wget command works for me. In general, there are instructions here: https://oceancolor.gsfc.nasa.gov/data/download_methods/ We will look into what went wrong with the API search. A new version with updated search capabilities is being developed so please stay tuned.
Your wget command works for me. In general, there are instructions here: https://oceancolor.gsfc.nasa.gov/data/download_methods/ We will look into what went wrong with the API search. A new version with updated search capabilities is being developed so please stay tuned.
-
- Posts: 8
- Joined: Mon Oct 24, 2022 4:51 pm America/New_York
Re: Search with wget won't work
Hi, thanks for helping me!
I used a python script with the call function for the wget command:
call(['wget','-q', '--post-data="results_as_file=1&std_only1&subType1&search=A2019*.L3m_MO_CHL_chlor_a_4km.nc"','-O', '-', 'https://oceandata.sci.gsfc.nasa.gov/api/file_search'])
But I got the below error message in the output html page:
<h1>An error has occurred</h1>
Filename pattern invalid
It is strange that the same command won't work in the python script.
The earlier search after I modified it according to your suggestion worked with the same script:
call(['wget','-q', '--post-data="results_as_file=1&std_only1&subType1&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&search=O*DAY_CHL*&sensor_id=9"','-O','-','https://oceandata.sci.gsfc.nasa.gov/api/file_search'])
Do you have an idea why and how I can fix it?
Thanks!
Daisy
I used a python script with the call function for the wget command:
call(['wget','-q', '--post-data="results_as_file=1&std_only1&subType1&search=A2019*.L3m_MO_CHL_chlor_a_4km.nc"','-O', '-', 'https://oceandata.sci.gsfc.nasa.gov/api/file_search'])
But I got the below error message in the output html page:
<h1>An error has occurred</h1>
Filename pattern invalid
It is strange that the same command won't work in the python script.
The earlier search after I modified it according to your suggestion worked with the same script:
call(['wget','-q', '--post-data="results_as_file=1&std_only1&subType1&sdate=1996-11-01&edate=1997-01-01&dtype=L3b&search=O*DAY_CHL*&sensor_id=9"','-O','-','https://oceandata.sci.gsfc.nasa.gov/api/file_search'])
Do you have an idea why and how I can fix it?
Thanks!
Daisy
-
- Posts: 396
- Joined: Mon Jun 22, 2020 5:24 pm America/New_York
- Has thanked: 8 times
- Been thanked: 8 times
Re: Search with wget won't work
try: call(['wget','-q', '--post-data="results_as_file=1&std_only1&subType=1&sdate=1999-01-01&edate=1999-12-31&search=A*MO_CHL_*4km*"','-O', '-', 'https://oceandata.sci.gsfc.nasa.gov/api/file_search'])
-
- Posts: 8
- Joined: Mon Oct 24, 2022 4:51 pm America/New_York
Re: Search with wget won't work
Thanks again!
I tried the command suggested, but I still got the same error message:
<h1>An error has occurred</h1>
Filename pattern invalid
I modified the search here and there, e.g., "subType1", "search=*MO_CHL*4km*"', but kept getting the same error message.
Do you have other suggestions how I can modify the commend?
Thank you,
Daisy
I tried the command suggested, but I still got the same error message:
<h1>An error has occurred</h1>
Filename pattern invalid
I modified the search here and there, e.g., "subType1", "search=*MO_CHL*4km*"', but kept getting the same error message.
Do you have other suggestions how I can modify the commend?
Thank you,
Daisy
-
- Posts: 396
- Joined: Mon Jun 22, 2020 5:24 pm America/New_York
- Has thanked: 8 times
- Been thanked: 8 times
Re: Search with wget won't work
Hi Daisy,
The search just uses regex and you can try patterns until something works. There are still some differences between your search and mine. I would recommend matching the beginning pattern of the file type you are looking for (aqua, snpp) in addition to the product suite (chl, rrs) and, if desired, resolution (4km, 9km). You can see a listing of files in the direct data access area of our site and our filenaming conventions to become more familiar with valid options to request.
Alicia
The search just uses regex and you can try patterns until something works. There are still some differences between your search and mine. I would recommend matching the beginning pattern of the file type you are looking for (aqua, snpp) in addition to the product suite (chl, rrs) and, if desired, resolution (4km, 9km). You can see a listing of files in the direct data access area of our site and our filenaming conventions to become more familiar with valid options to request.
Alicia