function read_NSCAT_winds, file_name, miss, time, lat, lon, dir, spd, $ cross_track_cells, along_track_cells ; Reads stresses from the COAPS/NSCAAT level 2 (swath) stresses. ; ; Input: ; file_name A character string providing the name (path and file ; name) of the data file to be read. For example, ; file_name = '/nscat/data/nc_stress/stress.1997034.nc' ; miss The value of the missing value to be used in output. ; For example, miss = -9999. ; ; Output: ; time A one dimensional LONG array containing the mean time of the ; observations. Given as the number of minutes from the ; beginning of 1980. Each value in the array corresponds to ; one row of observations (i.e., the index corresponds to the ; along track time and position). ; lat A two dimensional FLOAT array containing the latitude of the ; stresses. The first index corresponds to the cross swath ; position, and the second index corresponds to the along ; track position. ; dir A two dimensional FLOAT array containing the direction of the ; stress vector. Note that the program converts (reverses) ; the direction from the project's oceanographical ; direction convention, to a meteorological convention. ; The first index corresponds to the cross swath ; position, and the second index corresponds to the along ; track position. ; spd A two dimensional FLOAT array containing the wind speed. ; The first index corresponds to the cross ; swath position, and the second index corresponds to the ; along track position. ; cross_track_cells The number of cells perpendicular to the satellite ; track (first index in arrays) ; along_track_cells The number of cells along the satellite track ; (second index in the arrays). ; ; ; Developed by Mark A. Bourassa ; ; Dr. Bourassa is currently (Feb. 1999) a reasearch associate at COAPS. ; Please send comments, suggestions, and requests for added features to ; Dr. Mark Bourassa ; Center for Ocean-Atmospheric Prediction Studies ; Florida State University ; Tallahassee, FL 32306-2840 ; ; Email: bourassa@coaps.fsu.edu ; Phone: (850) 644-6923 print, 'opening satellite file ', file_name ; check that the file exists OPENR, test, file_name, ERROR = err, /GET_LUN if ( err GE 0 ) then begin FREE_LUN, test ncid = NCDF_OPEN(file_name, /NOWRITE ) varid = NCDF_VARID(ncid, 'Mean_Time') NCDF_VARGET, ncid, varid, meantime varid = NCDF_VARID(ncid, 'WVC_lat') NCDF_VARGET, ncid, varid, lat NCDF_ATTGET, ncid, varid, 'scale_factor', lat_sf NCDF_ATTGET, ncid, varid, 'add_offset', lat_ao NCDF_ATTGET, ncid, varid, 'missing_value', missv imiss = WHERE(lat EQ missv ) lat = FLOAT( lat * lat_sf + lat_ao ) if imiss(0) GE 0 then lat(imiss) = miss varid = NCDF_VARID(ncid, 'WVC_lon') NCDF_VARGET, ncid, varid, lon NCDF_ATTGET, ncid, varid, 'scale_factor', lon_sf NCDF_ATTGET, ncid, varid, 'add_offset', lon_ao NCDF_ATTGET, ncid, varid, 'missing_value', missv imiss = WHERE( lon EQ missv ) lon = FLOAT ( lon * lon_sf + lon_ao ) if imiss(0) GE 0 then lon(imiss) = miss ind = WHERE( lon LT 0.0 AND lon NE miss ) if ind(0) NE -1 then lon(ind) = lon(ind) + 360.0 varid = NCDF_VARID(ncid, 'Wind_Dir') NCDF_VARGET, ncid, varid, dir NCDF_ATTGET, ncid, varid, 'scale_factor', dir_sf NCDF_ATTGET, ncid, varid, 'add_offset', dir_ao NCDF_ATTGET, ncid, varid, 'missing_value', missv imiss = WHERE( dir EQ missv ) dir = FLOAT( dir * dir_sf + dir_ao ) if imiss(0) GE 0 then dir(imiss) = miss dum = SIZE( dir ) cross_track_cells = dum(1) along_track_cells = dum(2) varid = NCDF_VARID(ncid, 'Wind_Speed') NCDF_VARGET, ncid, varid, spd NCDF_ATTGET, ncid, varid, 'scale_factor', spd_sf NCDF_ATTGET, ncid, varid, 'add_offset', spd_ao NCDF_ATTGET, ncid, varid, 'missing_value', missv imiss = WHERE(spd EQ missv ) spd = FLOAT( spd * spd_sf + spd_ao ) if imiss(0) GE 0 then spd(imiss) = miss NCDF_CLOSE, ncid bad = WHERE( spd EQ 0.0 AND dir EQ 0.0 ) spd( bad ) = miss dir( bad ) = miss ; convert to meteorological wind convention imiss = where( dir EQ miss ) dir = ( dir + 180 ) mod 360 if imiss[0] NE -1 THEN dir(imiss) = miss ; convert from seconds since 1996 to minutes since 1980 time = LONG( (meantime + 30L) / 60L + 60L * 24L * (365L * 16L + 4L) ) endif else begin print, 'file ', file_name, ' does not exist.' endelse return, err END