Hi,
I'm having some issues with data extraction from a cube.
I'm opening a GRIB2 file from NOAA (you can find it here:
https://copy.com/9DnUVd2W9zkl) , that if I use wgrib2 with it, I get the following information (only showing 10 records of 255):
1:0:06Z16jan2014:WDIR Wind Direction (from which blowing) [deg]:lvl1=(1,1) lvl2=(255,missing):surface:anl:
2:28715:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:anl:
3:44159:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:anl:
4:54536:06Z16jan2014:WDIR Wind Direction (from which blowing) [deg]:lvl1=(1,1) lvl2=(255,missing):surface:1 hour fcst:
5:83772:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:1 hour fcst:
6:98217:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:1 hour fcst:
7:108464:06Z16jan2014:WDIR Wind Direction (from which blowing) [deg]:lvl1=(1,1) lvl2=(255,missing):surface:2 hour fcst:
8:137555:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,1) lvl2=(255,missing):1 in sequence:2 hour fcst:
9:151239:06Z16jan2014:SWDIR Direction of Swell Waves [deg]:lvl1=(241,2) lvl2=(255,missing):2 in sequence:2 hour fcst:
10:161535:06Z16jan2014:WDIR Wind Direction (from which blowing) [deg]:lvl1=(1,1) lvl2=(255,missing):surface:3 hour fcst:
From this I infer that the file contains information about Wind direction and Direction of Swell Waves....I'm just starting with GRIB2/Multi-dimensional files, so forgive my ignorance if something of what I say sounds ridicoulous...:D
If I get more specific about a record, say number 10, for instance:
10:161535:vt=
2014011609:surface:3 hour fcst:WDIR Wind Direction (from which blowing) [deg]:
ndata=76845:undef=61318:mean=198.327:min=113.51:max=330.03
grid_template=0:winds(N/S):
lat-lon grid:(327 x 235) units 1e-06 input WE:NS output WE:SN res 48
lat 49.100000 to 40.910000 by 0.035000
lon 267.799984 to 284.099968 by 0.050000 #points=76845
This looks like its telling me that this reacord has 76845 "data" points, mean value for it is 198.327, max 330.03, min 113.51, etc...right?
Ok, now I go back to IRIS and open the same file:
filename = 'glw.grl.WDIR.grb2'
cubes = iris.load(filename)
print cubes
The output is:
0: unknown / (unknown) (time: 85; latitude: 235; longitude: 327)
1: unknown / (unknown) (time: 85; latitude: 235; longitude: 327)
2: unknown / (unknown) (time: 85; latitude: 235; longitude: 327)
I really like the concept of Cube from IRIS, it does make a lot of sense to me. From this output, I understand the that file holds info about 3 phenomena that IRIS packed into 3 "cubes" with dimensions 85x235x327 each. Now...why is IRIS printing unknown/unknown...does that mean that the file is corrupt or header information incomplete?
Going deeper, say I get the first cube:
time = cubes[0]
Get the first element of the data array:
print time[0,0,0]
Output:
unknown / (unknown) (scalar cube)
Scalar coordinates:
forecast_period: 0 hours
latitude: 49.1 degrees
longitude: 267.799984 degrees
originating_centre: US National Weather Service, National Centres for Environmental Predic...
time: 2014-01-16 00:00:00
Some questions...how to I get the actual value? I can't see it anywhere...from my understanding [0,0,0] should represent an actual discrete data point right? probably at a given time, latitude, longitude?
Thanks!
Alejandro