; ; CENTER FOR OCEAN-ATMOSPHERIC PREDICTION STUDIES, ; THE FLORIDA STATE UNIVERSITY ; ; DIRECT ALL QUESTIONS TO: nscat-anim@coaps.fsu.edu ;**************************************************** ; MODIFIED: July 5th, 2001 ; Version : 1.2 ; Author : Josh Grant, COAPS ; Description: Added one argument to the function. Now the function is ; called with 6 arguments. The last argument added is used ; for setting the missing values of the dataset. ;**************************************************** ; ;**************************************************** ; MODIFIED: February 15th, 2001 ; Version : 1.1 ; Author : Josh Grant, COAPS ; Description: Added two arguments to the function. Now the function is ; called with 5 arguments. The last two were added to store ; the latitude and longitude values of the points. Updated ; the example program below to reflect the new changes. ;**************************************************** ; ;*************************************************** ; MODIFIED: August 25th, 2000 ; Version: 1.0 ; Author: Josh Grant, COAPS ; Description: Now instead of saving the arrays to a file, the arrays are ; passed back to the user. ;**************************************************** ; ; Parameters: ; ; input Name of the NetCDF file you wish to read ; u the variable you would like the u wind component saved to ; v the variable you would like the v wind component saved to ; lat the latitude values stored in an array ; lon the longitude values stored in an array ; missing the value you would like all missing values set to ; ; Example: Prints all the u and v component values to the screen with their ; respective latitude and longitude values. ;----------- ; @readncdf.pro ; ; file = "gcv_NSCAT_1997077.nc" ; missing = 9999.0 ; ; readncdf, file, u, v, lat, lon, missing ; ; dims = SIZE(lat) ; latdim = dims[1] ; dims = SIZE(lon) ; londim = dims[1] ; ; FOR i = 0, latdim - 1 DO BEGIN ; FOR j = 0, londim - 1 DO BEGIN ; print, FORMAT="(F6.2,A2,F7.2,A4,F8.2,A2,F8.2,A1)", lat[i], $ ; ', ', lon[j], ' = (', u[j,i], ', ', v[j,i], ')' ; ENDFOR ; ENDFOR ; ; END ;----------- PRO readncdf, input, u, v, lat, lon, missing ; Opens NetCDF for reading and other two files for writing. ncid = NCDF_OPEN(input, /NOWRITE) ; Gets the u and v values from the opened file, plus their scale ; factors. lat_id = NCDF_VARID(ncid, 'lat') lon_id = NCDF_VARID(ncid, 'lon') NCDF_VARGET, ncid, lat_id, lat NCDF_VARGET, ncid, lon_id, lon u_id = NCDF_VARID(ncid, 'u') v_id = NCDF_VARID(ncid, 'v') NCDF_VARGET, ncid, u_id, u NCDF_VARGET, ncid, v_id, v NCDF_ATTGET, ncid, u_id, 'scale_factor', usf NCDF_ATTGET, ncid, v_id, 'scale_factor', vsf NCDF_ATTGET, ncid, u_id, 'missing_value', u_miss NCDF_ATTGET, ncid, v_id, 'missing_value', v_miss ; Multiplies by the scale factor and prints to ouput files. u_bad = where( u EQ u_miss ) v_bad = where( v EQ v_miss ) u = u * usf v = v * vsf u( u_bad ) = missing v( v_bad ) = missing ; Closes *.nc file and output files. NCDF_CLOSE, ncid END