function get_data_1997,x year_name='1997' ; ~~~~~~~~~~~ change ntime=365 ; ~~~~~~~~~~~ change noaa_sate = 'NOAA14_G_' ; ~~~~~~~~~~~ change epslon = 0.1 ; [1-365] ;====================================================================== ; An IDL program to ; 1) read in global Pathfinder Version 5.0 ; Daily nighttime SST proxy ; 2) Mask the land as 9999 in the SST data and ; 8888 in the QUAL data ; 3) Flag the -32768 value to 32367 ; 4) Flag low quality data to 32367 ; 5) Output the data in binary form to a directory ;====================================================================== ;n_col = 8192 ; total number of columns ;n_row = 4096 ; total number of rows ;sst(8192,4096) ;lat(4096,1) : 89.980003 --> -89.980003 with interval 0.043945313 ;lon(8192,1) : -179.98198 --> 179.98198 with interval 0.043945313 ;---------------------------------------------------------------------- ; Land file dir_in_land = '/nobackupp2/jli13/data/source/PF52/' file_name_land = 'land_ocean_lake_river_mask_pfv52.nc' ;Open file: new_id = ncdf_open(dir_in_land+file_name_land) ncdf_varget, new_id, 'mask', landmask ncdf_close, new_id ;---------------------------------------------------------------------- ; SST and qual dir_in = '/nobackupp2/jli13/data/source/PF52/SST_daily_' dir_out ='/nobackupp2/jli13/data/derived/pf52/data_gap/SST_daily_' dir_in = dir_in + year_name + '/' dir_out = dir_out + year_name + '/' ;---------------------------------------------------------------------- ; time for t=1,ntime do begin print,'t=',t date_name=strtrim(string(t),2) len_t=strlen(date_name) case len_t of 1: begin file_in = 'NODC-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.2_' + noaa_sate $ + year_name + '00' + date_name + '_night-v02.0-fv01.0.nc' end 2: begin file_in = 'NODC-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.2_' + noaa_sate $ + year_name + '0' + date_name + '_night-v02.0-fv01.0.nc' end 3: begin file_in = 'NODC-L3C_GHRSST-SSTskin-AVHRR_Pathfinder-PFV5.2_' + noaa_sate $ + year_name + date_name + '_night-v02.0-fv01.0.nc' end endcase ;---------------------------------------------------------------------- ; SST data new_id = ncdf_open(dir_in+file_in) ncdf_varget, new_id, 'sea_surface_temperature', sst ncdf_close, new_id ; QUAL data new_id = ncdf_open(dir_in + file_in) ncdf_varget, new_id, 'pathfinder_quality_level', qual ncdf_close, new_id ;---------------------------------------------------------------------- ; Flag -32768 in SST files to 32367 invalid_ind = where(abs(sst+32768) lt epslon, count) if (count gt 0) then sst(invalid_ind) = 32367 invalid_ind = 0 ; Flag low quality data to 32367 in_valid = where(qual ge 4 and qual le 7, count_valid, COMPLEMENT=ind_bad, NCOMPLEMENT=count_bad) if (count_bad gt 0) then sst(ind_bad) = 32367 in_valid = 0 & ind_bad = 0 ;---------------------------------------------------------------------- ; Flag the sst = 9999 and qual to 8888 on land land_ind=where(abs(landmask) lt epslon, count) if (count gt 0) then begin sst(land_ind)= 9999 qual(land_ind)=byte(8888) endif ;---------------------------------------------------------------------- ; write SST to binary data case len_t of 1: file_name_out = strcompress(string(year_name,'00',date_name,'_sst.dat'), $ /remove_all) 2: file_name_out = strcompress(string(year_name,'0',date_name,'_sst.dat'), $ /remove_all) 3: file_name_out = strcompress(string(year_name,date_name,'_sst.dat'), $ /remove_all) endcase openw, unit_outdata, filepath(file_name_out, root_dir=dir_out), /get_lun writeu, unit_outdata, sst close, unit_outdata free_lun, unit_outdata ;write QUAL to binary data case len_t of 1: file_name_out = strcompress(string(year_name,'00',date_name,'_qual.dat'), $ /remove_all) 2: file_name_out = strcompress(string(year_name,'0',date_name,'_qual.dat'), $ /remove_all) 3: file_name_out = strcompress(string(year_name,date_name,'_qual.dat'), $ /remove_all) endcase openw, unit_outdata, filepath(file_name_out, root_dir=dir_out), /get_lun writeu, unit_outdata, qual close, unit_outdata free_lun, unit_outdata endfor ;---------------------------------------------------------------------- ;---------------------------------------------------------------------- ;---------------------------------------------------------------------- print, '--------------------------------------------------------------' print, '--------------------------Done, Bye-bye.----------------------' ;---------------------------------------------------------------------- ;---------------------------------------------------------------------- return,x end