qscat & grads

Mohammed Haggag haggag-moh at HIROSHIMA-U.AC.JP
Tue Sep 16 22:25:51 EDT 2008


Dear Mr. Murphy,

I have used QSCAT data in the past, and I am glad to share my past
experience with you. I downloaded QSCAT data from the Remote Sensing
Systems web site at (http://www.ssmi.com). The QSCAT  data are encoded
in single byte values, not NETCDF format. I modified a FORTRAN code to
convert the raw data into grads format. The process is much simple than
it looks. You just need to understand the format of the raw data files,
and the code is pretty easy. In the following you can find both the
FORTRAN code for conversion and the grads control file.
########################################################################################################################################################
C.modefied by mohammed haggag on 2007/06/27
        Program  GET_SCAT_DAILY_V03

! compilation ifort filename

        !This program reads Remote Sensing Systems Scatterometer Level-3
gridded bytemap daily files, Version-3a, GMF: Ku-2001
        !        The data are returned in 1440 x 720 x 4 x 2 arrays.
        !                 the first index of the array is the longitude
in 1/4 degrees
        !                 the second index of the array is the latitude
in 1/4 degrees
        !                 the third index of the array is the data type
(min gmt,wind speed,wind direction and rain bitflag)
        !                 and the fourth is the morning/evening
(ascending/descending) orbit segments
        !
        !The center of the first cell of the 1440 column and 720 row map
is at 0.125 E longitude and -89.875 latitude.
        !The center of the second cell is 0.375 E longitude, -89.875
latitude.
        !               XLAT=0.25*ILAT-90.125
        !               XLON=0.25*ILON-0.125
        !
      !This main program can be adapted to your needs.  It also calls a
subroutine that extracts the rain data.
        !               Data Types:
        !                IVAL = ICHAR(data_array(ilon,ilat,parameter,iasc)
        !                       1       GMT
Time                                        : mingmt  = IVAL * 6
(Minute of day GMT)
        !                       2   Wind
Speed                              : windspd = IVAL*0.2  (10m surface
wind speed in m/s)
        !                       3       Wind
Direction                      : winddir = IVAL*1.5  (direction wind is
flowing to, North is 0 deg)
        !                       4       Combination Rain Data
: use bit extraction to access all data
        !                                           bit pos 0
SCATEROMETER rainflag (0=no rain, 1=rain)
        !                                           bit pos 1
collocated SSMI, TMI or AMSR observation within 60 min=1, else=0
        !                                           bit pos 2-7
0-63: radiometer rain where:

!
0= absolutely no rain

!
1= rain in one of the adjacent cells

!
2= Radiometer columnar RR = 0.5  km*mm/hr

!
3= Radiometer columnar RR = 1.0

!
4: Radiometer columnar RR = 1.5  etc.

!
Rain subroutine will extract these bit flags and return 2 arrays

!
scatflag (0=no rain, 1 = rain) and

!
radrain:  -999.0 = no rad data

!
-1.0 = adjacent rain exists

!
0.0-31.0 = radiometer columnar rain rate in km*mm/hr
        !
        !Please make sure your system/compiler reads the data as an
array of 8-bit unsigned integer values (0-255)
        !the code in this routine reads the data as a character(1) array
to accomplish this.  Adjust for your achitecture if needed.
        !
        !If you have questions, contact RSS support:
        ! http://www.remss.com/support
        !
        !
        ! Written by D. Smith  January 2002
        ! Amended by D. Smith to new format  December 2002
        ! Renamed to get_qscat_daily_v03.f by D. Smith   August 2003
        ! Altered to read both qscat and seawinds files and -99. changed
to -999. for consistency by D. Smith  July 2004
        ! Added cell definition information and signed integer stop
D.Smith  March 2005
        ! Fixed error with signed integer stop code  D.Smith  Feb 2006
        ! added comment for v3a data  D.Smith Jan 2007
!*******************************************************************************************************************
!*******************************************************************************************************************
        logical(4)      lexist

        character(1)    data_array(1440,720,4,2)
        character(120)  filename

        real(4)                 windspd(1440,720,2),winddir(1440,720,2)
        real(4)                 uu(1440,720,2),vv(1440,720,2)
        real(4)         mingmt(1440,720,2), radrain(1440,720,2)
        integer(4)      scatflag(1440,720,2)
        integer(4)      ival(1440,720)
        integer(4)              iasc
        integer(4)      IERR
        integer inft,stime
        character infn*30


        iyear=2007
        imonth=06
        init=01
        stime=7     ! number of days of concern with the available data
files

************************************************************************************************
! Open Grads Output file
      open(100,file='QSCAT.grads',status='new',form='unformatted')

        do k=1,stime

          inft=k+5
          idate=init+k
          write(infn,'(I4,I2.2,I2.2)')iyear,imonth,idate
          write(*,*)'infn = ',infn
! Open Raw data files from Remote Sensing Systems
          open(inft,file=infn,STATUS='old',RECL=8294400,
     .  ACCESS='direct',FORM='unformatted')
        READ(inft,rec=1) data_array
        CLOSE(inft)

        ! Assign data to arrays
        DO iasc=1,2

                !time
                ival   = ICHAR(data_array(:,:,1,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                mingmt(:,:,iasc) = ival*6.0

                !wind speed
                ival   = ICHAR(data_array(:,:,2,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                WHERE (ival .le. 250)
                        windspd(:,:,iasc) = ival*0.2
                ELSEWHERE
                        windspd(:,:,iasc) = -999.0
                ENDWHERE
                !wind direction
                ival  = ICHAR(data_array(:,:,3,iasc))
                if(MINVAL(ival).lt.0) stop 'ival must be 0-255'
                WHERE (ival.le.250)
                        winddir(:,:,iasc) = ival*1.5

uu(:,:,iasc)=windspd(:,:,iasc)*SIND(winddir(:,:,iasc))

vv(:,:,iasc)=windspd(:,:,iasc)*COSD(winddir(:,:,iasc))
                ELSEWHERE
                        winddir (:,:,iasc) = -9999.0
                        uu              (:,:,iasc) = -9999.0
                        vv              (:,:,iasc) = -9999.0
               ENDWHERE

                 write(100)mingmt(:,:,iasc)
                 write(100)windspd(:,:,iasc)
                 write(100)uu(:,:,iasc)
                 write(100)vv(:,:,iasc)

        ENDDO   !iasc
        enddo   !k
        stop
        END
#######################################################################################################################################################

The Grads control file looks like this

DSET      QSCAT.grads
TITLE     QSCAT
OPTIONS   sequential
UNDEF     -9999
XDEF      1440  LINEAR     0.125     0.25
YDEF      720  LINEAR     -89.875     0.25
ZDEF      1  LINEAR   0.00000     1.00000
TDEF    14  LINEAR     00:00Z02JUN2007 12hr
VARS 4
mingmt   0  99  Observation time of the day (mingmt)
windspd   0  99 10m ocean surface wind magnitude (m/sec)
uu   0  99 10m ocean zonal surface wind  (m/sec)
vv   0  99 10m ocean meridional surface wind  (m/sec)
ENDVARS

Hoping that it works with you.
Good luck.


Ph.D candidate Mohammed Elsayed Abou-Elhaggag
laboratory of Earth Environment Simulator,
Graduate School for International Development and Cooperation,
Hiroshima University.
Mobile: +81-080-3875-3847
E-mail: haggag-moh at hiroshima-u.ac.jp



Michael J Murphy wrote:
>
> GRADSUSR list,
>
>    I have downloaded a QSCAT data file in  netcdf format and have been
> trying to view the data with GrADS by creating a .ddf (data descriptor
> file) along with using the xdfopen command.  I have read though all
> the GrADS documentation and have been unsuccessful in converting the
> dimensions of the data into a format that GrADS can read.
>
>   I have added the contents of an ncdump command I did on the file at
> the end of this email.  As you can see the only dimensions specified
> are time and cross_track cells.  I understand how the file is divided
> up into swaths with a variable for latitude and longitude for each
> swath.  What I don't understand is how to put this convention into a
> .ddf format that GrADS can read.
>
>   I emailed the people who supply the data and they said I should be
> able to open the file by using a sdfopen command.  This has not worked
> however because the .nc file does not appear to be in COARDS format (I
> get an error message about there being no discerable X coordinate).
>  Any advice someone might have with this issue will be
> greatly appreciated.
>
> Thanks,
> MJ
>
>
>
>
> > ncdump -c QSCAT.2006092.nc
> netcdf QSCAT.2006092 {
> dimensions:
>         time = UNLIMITED ; // (23157 currently)
>         cross_track_cells = 76 ;
>
> variables:
>         long Row_Mean_Time(time) ;
>                 Row_Mean_Time:long_name = "average time" ;
>                 Row_Mean_Time:units = "seconds from 1-1-1999 00:00:00" ;
>                 Row_Mean_Time:actual_range = 228787201, 228873597 ;
>                 Row_Mean_Time:scale_factor = 1 ;
>                 Row_Mean_Time:add_offset = 0 ;
>                 Row_Mean_Time:missing_value = 0 ;
>         short WVC_lon(time, cross_track_cells) ;
>                 WVC_lon:long_name = "longitude" ;
>                 WVC_lon:units = "degrees" ;
>                 WVC_lon:actual_range = 0.f, 359.98999f ;
>                 WVC_lon:scale_factor = 0.0099999998f ;
>                 WVC_lon:add_offset = 180.f ;
>                 WVC_lon:missing_value = 32767s ;
>         short WVC_lat(time, cross_track_cells) ;
>                 WVC_lat:long_name = "latitude" ;
>                 WVC_lat:units = "degrees" ;
>                 WVC_lat:actual_range = -73.68f, 79.919998f ;
>                 WVC_lat:scale_factor = 0.0099999998f ;
>                 WVC_lat:add_offset = 0.f ;
>                 WVC_lat:missing_value = 32767s ;
>         short Wind_Dir(time, cross_track_cells) ;
>                 Wind_Dir:long_name = "wind direction" ;
>                 Wind_Dir:units = "degrees (oceanic convention)" ;
>                 Wind_Dir:actual_range = 0.f, 360.f ;
>                 Wind_Dir:scale_factor = 0.0099999998f ;
>                 Wind_Dir:add_offset = 180.f ;
>                 Wind_Dir:missing_value = 32767s ;
>         short Wind_Speed(time, cross_track_cells) ;
>                 Wind_Speed:long_name = "wind speed" ;
>                 Wind_Speed:units = "m/s" ;
>                 Wind_Speed:actual_range = 0.f, 69.f ;
>                 Wind_Speed:scale_factor = 0.0099999998f ;
>                 Wind_Speed:add_offset = 0.f ;
>                 Wind_Speed:missing_value = 32767s ;
>         byte Rain_Flag_combination(time, cross_track_cells) ;
>                 Rain_Flag_combination:long_name = "rain flag" ;
>                 Rain_Flag_combination:units = "none" ;
>                 Rain_Flag_combination:actual_range = 0s, 1s ;
>                 Rain_Flag_combination:scale_factor = 1.f ;
>                 Rain_Flag_combination:add_offset = 0.f ;
>                 Rain_Flag_combination:missing_value = 255s ;
>                 Rain_Flag_combination:rain_threshold = 1s ;
>         byte Rain_Flag_rad(time, cross_track_cells) ;
>                 Rain_Flag_rad:long_name = "radiometer rain flag" ;
>                 Rain_Flag_rad:units = "none" ;
>                 Rain_Flag_rad:actual_range = 0s, 1s ;
>                 Rain_Flag_rad:scale_factor = 1.f ;
>                 Rain_Flag_rad:add_offset = 0.f ;
>                 Rain_Flag_rad:missing_value = 255s ;
>                 Rain_Flag_rad:rain_threshold = 1s ;
>
> // global attributes:
>                 :build_id = "2.3.2/2000-04-07" ;
>                 :Model_function = "Ku-2001" ;
>                 :sensor_name = "SeaWinds on QuikSCAT" ;
>                 :first_data_time = "02 April 2006 00:00:01" ;
>                 :last_data_time = "02 April 2006 23:59:57" ;
>                 :wind_reference_height = "10m" ;
>                 :history = "Created on 04 April 2006 by COAPS/FSU" ;
>                 :contact_info = "scat_sci at coaps.fsu.edu" ;
>
> data:
> }
>



More information about the gradsusr mailing list