i'm using fortran to read a grid of 16 bit integers written to a big endian file. i can't figure out what i'm doing incorrectly.
the output values are -9999
c program to try to read the binary SNODAS data
c The grid for the masked data files is 6,935 columns by 3,351 rows
c read in the data
can someone please advice me what is wrong with this code? i've tried all sorts of variations and i haven't hit on the correct one yet.
thank you in advance.
There are two likely sources of error, depending on what your intentions were w.r.t. what to read.
1. You open the file with RECL=2. If you specified the compiler option /assume:byterecl, you would have specified the record length as 2 bytes, which is probably what you want. By default, without that option, the unit for record length is 4 bytes, so RECL=2 would imply a record length of 8 bytes, which is probably not what you want.
2. The statement
will read a single record, namely, the 2nd record, into all the array elements referenced in the double DO loop. This is probably not what you wanted, so you need to specify a record number that is matched to the (i,j) indices. You would need to know the structure of the SNODAS data files to decide what that correspondence should be.