Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

Similar presentations


Presentation on theme: "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"— Presentation transcript:

1 Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

2

3

4 %nakedsoftware.org opensource license, copyright 2010 % %developed by Stephane Poirier, M.Sc. Optical Physics, Remote Sensing Application Software Developer ( ) % %this function is part of oifii.org's ar\sp\ Microwave- derived 30-year Canada-Alaska Daily Temperature and Snowcover Databases library % %this function is part of oifii.org's ar\sp\mapfilename application (lauched with ar\sp\mapfilename.m) %oifii.org's ar\sp\affiche_carte application is part of the oifii.org's ar\sp set of applications which %may also contain similar variant versions of this function with identical filename. % %A geophysical research paper about this work has been submitted in June 2009 for publication in JGR-Atmosphere %Royer, A. and Poirier S., Surface temperature spatial and temporal variations in North America from homogenized %satellite SMMR-SSM/I microwave measurements and reanalysis for , Journal of Geophysical Research - Atmosphere, %Submitted June 2009, Poirier_Microwave-derived-daily-surface- temperature_JGR2009JD012760_R2.pdf % %This study's database can be downloaded from the author web site at: %http://www.oifii.org/tsatdb/Royer-Poirier_Microwave-derived- daily-surface-temperature-db_ zip % %this function is used for mapping filenames of the raw microwave raster data (from NSIDC's SMMR and SSMI %satellite data, ref. to the file naming convention of the oifii.org's ar\sp\ library % %fichier extraction_amsr_ftp.m %version 0.0, 20 aout 2007, cette version ne supporte que zonename=721x721 (region='Global') %version 0.1, revision 19 sept 2007, ancienne appellation variable zone modifie pour nouvelle appellation variable region %version 0.2, revision 19 sept 2007, mapfilename now returns extras % %nakedsoftware.org opensource license, copyright 2010

5 %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

6

7 %{ fclose('all'); clear all; close all; clc; %} % ============================================================= ========= % Extraction des fichiers.GZ des CDs du NSIDC (NL grid) % ============================================================= ========= winrarPath = 'C:\Program Files\WinRAR\'; % 'winrarPath'\WinRAR.exe region = 'Global'; zonename1 = '721x721'; cutsection1 = [0 720; 0 720]; % [widthMin widthMax; heightMin heightMax] zonename2 = 'Global'; cutsection2 = [0 720; 0 720]; % du NSIDC : "By convention, grid coordinates (r,s) start in the upper zonename3 = 'Global'; % left corner, at cell (0,0), with r increasing to the right cutsection3 = [0 720; 0 720]; % and s increasing downward at cell (720,720). r=? and s=?" zonenames = strvcat(zonename1, zonename2, zonename3); % [zoneName1; zoneName2; etc.] cutsections = cat(1, cutsection1, cutsection2, cutsection3); % [cutSection1; cutSection2; etc.] %note: spi2spi % %easegrid 721x721 (easegrid full) %[widthMin widthMax; heightMin heightMax] of [0 720; 0 720] correspond to the upperleft 0,0 lowerright 720,720 easegrid indexes %and within matlab we would use a 1-based ids array filter like (1+0:721+0,1+0:721+0) if applied onto full 721x721 easegrid % %canada 281x281 (easegrid partial) %[widthMin widthMax; heightMin heightMax] of [89 369; ] correspond to the upperleft 89,199 lowerright 369,479 easegrid indexes %and within matlab we would use a 1-based ids array filter like (1+89:281+89,1+199: ) if applied onto full 721x721 easegrid % %canada 160x240 (easegrid partial) %[widthMin widthMax; heightMin heightMax] of [ ; ] correspond to the upperleft 180,230 lowerright 339,469 easegrid indexes %and within matlab we would use a 1-based ids array filter like (1+180: ,1+230: ) if applied onto full 721x721 easegrid % %canada 160x240 (easegrid partial) %[widthMin widthMax; heightMin heightMax] of [ ; ] correspond to the upperleft 180,230 lowerright 339,469 easegrid indexes %and within matlab we would use a 1-based ids array filter like (1+xx:160+xx,1+yy:240+yy) if applied onto partial 281x281 easegrid %where xx=180-89=91 and yy= =31 therefore a filter like ( : , : ) % disp('Bienvenue!'); disp(' '); disp('Ce programme fonctionne avec la version Matlab (R14, SP2)'); disp(' '); disp('Auteur: Stephane Poirier'); disp(' '); disp('Ce programme necessite que le logiciel rarlabs.com winrar.exe soit '); disp('installé dans le dossier C:\Program Files\WinRAR\'); disp(' '); %note spi: modification de la version mapfilename.m d'alexandre %note aar: indexFREQ=indexAD+6 zonename = zonename2; cutsection = cutsection2; dataset = 3; % 1=SMMR, 2=SSMI, AMSR-E userSavePath = ['C:\amsre\2007',filesep]; %chemin sortie NSIDCfilesPath = ['C:\amsre\2007',filesep]; % chemin entrée des fichiers.GZ telechargés du site ftp://sidads.colorado.edu/pub/DATASETS/brightness- temperatures/easegrid/ssmi/north (voir ftp_ssmi_2001.m) %1) unzip all files of interest (in here *.gz) files = dir(fullfile(NSIDCfilesPath,'*.gz')); [numberoffiles numberofstructure] = size(files); for n=1:numberoffiles %extract each.gz file disp(['!"' winrarPath 'WinRAR.exe" e -O+ -y -IBCK ' NSIDCfilesPath files(n).name ' ' userSavePath]); eval(['!"' winrarPath 'WinRAR.exe" e -O+ -y -IBCK ' NSIDCfilesPath files(n).name ' ' userSavePath]); end %2) extract section of interest from each 721x721 northern hemisphere easegrid file files = dir(fullfile(NSIDCfilesPath,'*TIM')); [numberoffiles numberofstructure] = size(files); for n=1:numberoffiles %currentfilename = [files(n).name(1:end-3)]; %remove the '.gz' currentfilename = files(n).name; inputpath = NSIDCfilesPath; outputpath = NSIDCfilesPath; fidinput=fopen([inputpath,currentfilename],'r'); %note spi, 19 sept 2007, mapfilename now returns [outputpath outputfilename nl year jd ad vox freq pol], but ignoring extras [outputpath outputfilename] = mapfilename(inputpath,currentfilename,zonename,region,dataset ); %doublet, %degenerescence, %zonename,region if(~isdir(outputpath)) mkdir(outputpath); end fidoutput=fopen([outputpath,outputfilename],'w'); unzippedfiles = dir(fullfile(inputpath,currentfilename)); [numberofunzippedfiles numberofstructure] = size(unzippedfiles); if(~numberofunzippedfiles==1) warning('error');end if(dataset==1 || dataset==2) %SMMR and SSMI if(unzippedfiles(1).bytes== ) %Tb files encoded in 'int16' for SSMI/SMMR and TIM files encoded in 'int16' SMMR only data=fread(fidinput,[1 inf],'int16'); data=reshape(data,721,721,1); data=data(1+180: ,1+230: ,1); count = fwrite(fidoutput,data,'int16'); elseif(unzippedfiles(1).bytes==519841) %TIM files encoded in 'int8' for SSMI only data=fread(fidinput,[1 inf],'int8'); data=reshape(data,721,721,1); data=data(1+180: ,1+230: ,1); count = fwrite(fidoutput,data,'int8'); end elseif(dataset==3) %AMSR-E % for AMSR-E, simple renaming, therefore input size = output size = 721x721 %{ movefile([inputpath,currentfilename], [outputpath, outputfilename]) %renaming file only %} % for AMSR-E, no cutting, therefore input size = output size = 721x721 data=fread(fidinput,[1 inf],'int8'); count = fwrite(fidoutput,data,'int8'); end fclose(fidinput); fclose(fidoutput); clear fidinput fidoutput currentfilename inputpath outputpath; end disp(' '); disp('================'); disp('FIN DU PROGRAMME'); disp('================'); disp(' ');


Download ppt "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"

Similar presentations


Ads by Google