[Numpy-discussion] Sea Ice Concentrations from Nimbus-7 SMMR and DMSP SSM/I Passive Microwave Data

Dag Sverre Seljebotn dagss@student.matnat.uio...
Fri Feb 26 07:11:45 CST 2010

Nicolas wrote:
> Hello
> a VERY specific question, but I thought someone in the list might have
> used this dataset before and could give me some advice
> I am trying to read the daily Antarctic Sea Ice Concentrations from
> Nimbus-7 SMMR and DMSP SSM/I Passive Microwave Data, as provided by
> the national snow and ice data center (http://nsidc.org), more
> specifically, these are the files as downloaded from their ftp site
> (ftp://sidads.colorado.edu/pub/DATASETS/seaice/polar-stereo/nasateam/final-gsfc/south/daily)
> they are provided in binary files (e.g. nt_19980101_f13_v01_s.bin for
> the 1st of Jan. 1998)
> the metadata information
> (http://nsidc.org/cgi-bin/get_metadata.pl?id=nsidc-0051) gives the
> following information (for the polar stereographic projection):
> """
> Data are scaled and stored as one-byte integers in flat binary arrays
> geographical coordinates
> N: 90°     S: 30.98°     E: 180°     W: -180°
> Latitude Resolution: 25 km
> Longitude Resolution: 25 km
> Distribution Size: 105212 bytes per southern file
> """
> I am unfamiliar with non self-documented files (used to hdf and netcdf
> !) and struggle to make sense of how to read these files and plot the
> corresponding maps, I've tried using the array module and the
> fromstring function
> file=open(filename,'rb')
> a=array.array('B',file.read())
> var=numpy.fromstring(a,dtype=np.int)

numpy.fromfile(f, dtype=np.int8)

or uint8, depending on whether the data is signed or not. What you did 
is also correct except that the final dtype must be np.int8.

(You can always do var = var.astype(np.int) *afterwards* to convert to a 
bigger integer type.)

Dag Sverre

More information about the NumPy-Discussion mailing list