Télécharger la présentation
La présentation est en train de télécharger. S'il vous plaît, attendez
Publié parGarland Simonnet Modifié depuis plus de 10 années
1
Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%
4
%nakedsoftware.org opensource license, copyright 2010 stephane.poirier@oifii.org % %developed by Stephane Poirier, M.Sc. Optical Physics, Remote Sensing Application Software Developer (1991-2010) % %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\'this folder' application (lauched with ar\sp\'this file'.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 1979-2008, Journal of Geophysical Research - Atmosphere, %Submitted June 2009, http://www.oifii.org/tsatdb/Royer- 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_1979-2008.zip % %this function is used to display the raw microwave raster data (NSIDC's SMMR and SSMI satellite, ref. nsidc.org) % %usage: % 20yymmmdd % %version 0.0, 20yymmmdd, spi, initial function draft % %nakedsoftware.org opensource license, copyright 2010 stephane.poirier@oifii.org
5
%%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%
6
*********************** ** extrait_cartes_era40_160x240(region,anneedebut,anneefin) ** ***********************
7
function extrait_cartes_era40_160x240(region,anneedebut,anneefin) %fonction ecrite par stephane poirier %pour region CAN_L seulement %fonction qui permet d'extraire les cartes era40 160x240 a partir des cartes era40 721x721 %initialement ecrite pour extraire les cartes era40 correspondantes aux donnees SSMI (1988-2002) % %cette fonction traitera tous les fichiers du directory si nomfichier n'est pas specifie %i.e.: extrait_cartes_era40_160x240('Canada',1988,2002); % if(strcmp(upper(region), 'CANADA')~=1) warning('region parameter is not valid'); return; end if (anneedebut 2002) warning('anneedebut parameter is not valid'); return; end if (anneefin 2002) warning('anneefin parameter is not valid'); return; end if (anneedebut > anneefin) warning('anneedebut must be smaller or equal to anneefin'); return; end cheminentree = 'C:\era40\ease-a-convertir\'; %'ERA40_aaaa\' +'jjj' (jjj=001 a jjj=366) cheminsortie = 'C:\era40\ease\'; %'aaaa\' +'easejjj' (jjj=001 a jjj=366) format='float32'; dimentree =[721 721]; %[widthMin widthMax; heightMin heightMax] with respect to [721 721] easegrid dimsortie = [160 240]; %[180 339; 230 469]; %[widthMin widthMax; heightMin heightMax] with respect to [721 721] easegrid %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 160x240 (easegrid partial) %[widthMin widthMax; heightMin heightMax] of [180 339; 230 469] 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:160+180,1+230:240+230) if applied onto full 721x721 easegrid % anneecourante = anneedebut; while(anneecourante<=anneefin) %1) pour chacun des annees (dossiers annees), trouver tous les fichiers %chemincourantentree = [cheminentree, 'ERA40_', num2str(anneecourante)]; chemincourantentree = [cheminentree, num2str(anneecourante)]; chemincourantsortie = [cheminsortie, num2str(anneecourante)]; if(~isdir(chemincourantsortie)) mkdir(chemincourantsortie); end fichiers = dir(chemincourantentree); %files = dir(fullfile(directory,'*')); [nombredefichiers,nombredestructuresparfichiers] = size(fichiers); %2) proceder a l'extraction de chacun des fichiers canada 160x240 for n = 1:nombredefichiers if ~fichiers(n).isdir && fichiers(n).bytes==721*721*4*4 %4*float32=4*4bytes %ne rien faire pour les dossiers ou les fichiers n'ayant pas exactement la meme dimension fichiercourant = fichiers(n).name; %combiner chemin et nomfichier fidentree=fopen(fullfile(chemincourantentree,fichiercourant), 'r'); fidsortie=fopen(fullfile(chemincourantsortie,'ease',fichierco urant), 'w'); %if(fichiers(n).bytes>0) era40entree=fread(fidentree,[1 inf],format); era40entree=reshape(era40entree,dimentree(1,1),dimentree(1,2),4); era40sortie=era40entree(1+180:160+180,1+230:240+230, 1:4); count = fwrite(fidsortie,era40sortie,format); %end fclose(fidentree); fclose(fidsortie); clear fidentree fidsortie nomfichier ; end %3) preparer compteur pour annee suivante anneecourante=anneecourante+1; end %end while(anneecourante<=anneefin) fclose('all'); end
Présentations similaires
© 2024 SlidePlayer.fr Inc.
All rights reserved.