0

My goal is to get the daily wind data from nomads, so I set the grib filter 10m above the ground with and got the url, tried to fetch on js, the response was ok but with empty data, I tried also with axios but always empty data:

function getWindData() {
    const opendapURL =
  "http://nomads.ncep.noaa.gov:80/dods/gfs_1p00/gfs20230814/gfs_1p00_00z";
const gribFilterURL = "https://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_1p00.pl?dir=%2Fgfs.20230814%2F06%2Fatmos&file=gfs.t06z.pgrb2.1p00.anl&var_UGRD=on&var_VGRD=on&all_lev=on";
    fetch(opendapURL)
          .then((data) => {
            console.log(data)
          });
    }

Then I tried openDAP and here basically I got the full html page but I can't understand how to access the field I need. I think it's very strange that it's so difficult access this data, but I didn't found anything on google too.

C-Gian
  • 62
  • 2
  • 19
  • You should really add some proper details here. _"so I set the grib filter 10m above the ground with and got the url"_ - that is absolutely vague, give us a proper example of what you are doing, so that we can check the situation ourselves. – CBroe Aug 15 '23 at 11:47
  • ```fetch(opendapURL).then((res) => res.json())``` isn't going to do much because you ignore the return value – Quentin Aug 15 '23 at 11:50
  • ```fetch(opendapURL).then((data) => { res.json(data); });``` is, all else being equal, going to throw an exception because `res` isn't defined. – Quentin Aug 15 '23 at 11:51
  • You need to provide a real [mcve] which includes the code which determines the data is empty. – Quentin Aug 15 '23 at 11:51
  • I updated the code with the whole function – C-Gian Aug 15 '23 at 12:12
  • `fetch().then(res => res.text())` – Tachibana Shin Aug 15 '23 at 13:48
  • this url returns html and it seems to have no cross domain – Tachibana Shin Aug 15 '23 at 13:50
  • @TachibanaShin yeah I can get html in that way but then I can't understand how to get the data wind... – C-Gian Aug 15 '23 at 16:58

0 Answers0