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 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

7 %version 0.1 create a.nc file wrapper for 28-years tsat db function tsat2netcdf(yaxis) if nargin<1 yaxis='up';end %yaxis='down' for mapserver/gdal optimization, yaxis='up' for hdf explorer %{ note: other netcdf utility applications are not able to open matlab cdf files. i.e. C:\Docteurordi\telechargements\unidata-ucar- edu\netcdf\java\toolsUI-2.2.22.jar, C:\Program Files\HDF Explorer\HdfExp.exe sp. Common Data Format (CDF) cdfepochConstruct cdfepoch object from date string or number cdfinfoReturn information about CDF file cdfread Read CDF file cdfwrite Write CDF file todatenum Convert cdfepoch object to MATLAB datenum cdfwrite(file, variablelist) cdfwrite(..., 'PadValues', padvals) cdfwrite(..., 'GlobalAttributes', gattrib) cdfwrite(..., 'VariableAttributes', vattrib) cdfwrite(..., 'WriteMode', mode) cdfwrite(..., 'Format', format) %timestamp the netcdf file cdfwrite('mytestfile',{'Time_val',cdfepoch(now)}); cdfinfo('mytestfile'); %} %{ %code imported from function tsat2hdf5 for year=1979:2007 tic; %set filename outputfilename=['G:\tsat_cdf\','tsat_',num2str(year),'.cdf']; %get latitude and longitude data data_lon=zeros(160,240); data_lat=zeros(160,240); for row=1:160 for col=1:240 %get latitude and longitude if strcmp(yaxis,'up') [x_pix,y_pix]=pixel2pix(col,161- row,'canada'); elseif strcmp(yaxis,'down') [x_pix,y_pix]=pixel2pix(col,row,'canada'); else display('case not valid, yaxis has to be set to ''up'' or ''down'''); return; end [longitude,latitude]=pix2latlon(x_pix,y_pix); data_lon(row,col)=longitude; data_lat(row,col)=latitude; end%for col end%for row %write latitude data dataset=data_lat; dataset_details.Location=['/']; dataset_details.Name='lat'; %create the HDF5 file hdf5write(outputfilename,dataset_details,dataset... );%,'WriteMode','append'); attr1='Latitude'; attr1_details.Name='Description'; attr1_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr1_details.AttachType='dataset'; %'group' attr2='2'; attr2_details.Name='Rank'; attr2_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr2_details.AttachType='dataset'; %'group' attr3='[160 240]'; attr3_details.Name='Dimensions'; attr3_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr3_details.AttachType='dataset'; %'group' % hdf5write(outputfilename...,attr1_details,attr1...,attr2_details,attr2...,attr3_details,attr3...,'WriteMode','append'); %longitude data dataset=data_lon; dataset_details.Location=['/']; dataset_details.Name='lon'; %create the HDF5 file hdf5write(outputfilename,dataset_details,dataset...,'WriteMode','append'); attr1='Longitude'; attr1_details.Name='Description'; attr1_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr1_details.AttachType='dataset'; %'group' attr2='2'; attr2_details.Name='Rank'; attr2_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr2_details.AttachType='dataset'; %'group' attr3='[160 240]'; attr3_details.Name='Dimensions'; attr3_details.AttachedTo=[dataset_details.Location,dataset_de tails.Name]; attr3_details.AttachType='dataset'; %'group' % hdf5write(outputfilename...,attr1_details,attr1...,attr2_details,attr2...,attr3_details,attr3...,'WriteMode','append'); %raster data for day=1:366 if((day==366)&&(((~rem(year,4)&rem(year,100))|~rem(year,400)) ==0));continue;end inputfilename=['D:\tsat\canada\',num2str(year),'\',sprintf('% 03d',day)]; [pathstr,name,ext,versn]=fileparts(inputfilename); [d1 d2 f]=autodimformat(pathstr,name); dim=[d1 d2]; format=f; fid=fopen(inputfilename,'r'); if(fid~=-1) data=fread(fid,[1 inf],format); if strcmp(yaxis,'up') data=reshape(data,160,240); elseif strcmp(yaxis,'down') data=reshape(data,160,240); data=rot90(data');%flipup else display('case not valid, yaxis has to be set to ''up'' or ''down'''); return; end fclose(fid); else disp('error'); return; end %{ %create an HDF5 h5array object dataset=hdf5.h5array(data);%dataset=hdf5.h5array(data); %assign data to the HDF5 h5array object %setData(dataset,data); %assign a name to the HDF5 h5array object dataset.setName(datejj(day,year)); %setName(dataset,datejj(day,year)); %dataset.setName('satellite temperature - daily'); if(day==1) %create the HDF5 file hdf5write(outputfilename,['/',sprintf('%03d',day)],dataset); else %append the HDF5 file hdf5write(outputfilename,['/',sprintf('%03d',day)],dataset,'W riteMode','append'); end %} dataset=data; dataset_details.Location=['/tsat/',moisjj(day,year,'num'),'/',sprintf('%03d',day)]; dataset_details.Name=datejj(day,year); %append the HDF5 file hdf5write(outputfilename,dataset_details,dataset...,'WriteMode','append'); attr1='Satellite Temperature - Daily'; attr1_details.Name='Description'; attr1_details.AttachedTo= ['/tsat/',moisjj(day,year,'num'),'/',sprintf('%03d',day),'/', datejj(day,year)]; attr1_details.AttachType='dataset'; %'group' attr2='2'; attr2_details.Name='Rank'; attr2_details.AttachedTo= ['/tsat/',moisjj(day,year,'num'),'/',sprintf('%03d',day),'/', datejj(day,year)]; attr2_details.AttachType='dataset'; %'group' attr3='[160 240]'; attr3_details.Name='Dimensions'; attr3_details.AttachedTo= ['/tsat/',moisjj(day,year,'num'),'/',sprintf('%03d',day),'/', datejj(day,year)]; attr3_details.AttachType='dataset'; %'group' % hdf5write(outputfilename...,attr1_details,attr1...,attr2_details,attr2...,attr3_details,attr3...,'WriteMode','append'); end toc hdf5info(outputfilename) end %} end


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

Similar presentations


Ads by Google