Esri / wind-js

An demo animation of wind on a Canvas layer in the JSAPI
MIT License
735 stars 214 forks source link

How to Fetch Latest Wind Data #11

Closed Robert-W closed 10 years ago

Robert-W commented 10 years ago

I was trying to implement this app with newer data and was wondering how to set up the call to noaa and the right way to use grib2json to parse the data. Currently I am doing this:

curl "http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs.pl?file=gfs.t00z.pgrbf00.grib2&lev_10_m_above_ground=on&var_UGRD=on&var_VGRD=on&dir=%2Fgfs.2014061700" -o gfs.t00z.pgrbf00.grib2

then this,

grib2json -d -n -o wind-surface-level-gfs-1.0.json gfs.t00z.pgrbf00.grib2

This gives me a json file which looks good but only has one record. In the createBuilder function it expects two records with parameterCategory and parameterNumber of 2,2 and 2,3. This function then returns the records as uComp and vComp.

data.forEach(function(record) { 
  switch (record.header.parameterCategory + "," + record.header.parameterNumber) { 
         case "2,2":
             uComp = record; 
            break; 
         case "2,3": 
            vComp = record; 
            break; 
         default: 
             scalar = record; 
      } 
    });

My call is getting me the record that matches 2,3, which is vComp in the createBuilder function but not 2,2 so I think I am missing something in my call or I need to make two calls in order to get this other record.

How do you make the calls to get both records?

chelm commented 10 years ago

Thanks for adding the issue @Robert-W - We're looking into the issue and just verifying what calls we make.

You'll need to specify the correct surface type values for grib2json to create both the V and U component types from the grib data. Will get back today.

chelm commented 10 years ago

@Robert-W So by default it creates the U-Comp for wind and you'll need to set the parameter naem to "wind" like this:

grib2json --names --data --fp wind --fs 103 --fv 10.0 -o wind-surface-level-gfs-1.0.json gfs.t00z.pgrbf00.grib2

You should be able to print the usage on grib2json to see the various parameter options as well. In this case setting the --fp param to "wind" will include both the U and V components in the output json file.

Robert-W commented 10 years ago

@chelm Thanks a lot man, I appreciate it. I will give it a shot later today.

chelm commented 10 years ago

No problem. Going to close the issue