diff --git a/matlab/aps_era5_ECMWF_Python.m b/matlab/aps_era5_ECMWF_Python.m index 12fd9eb..ee6da34 100644 --- a/matlab/aps_era5_ECMWF_Python.m +++ b/matlab/aps_era5_ECMWF_Python.m @@ -18,6 +18,7 @@ % 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. % % By Bekaert Davide -- June 2017 +% Modified by Marin Govorcin -- May 2019 to use CDSapi % % modifications: @@ -26,37 +27,27 @@ day = timing(7:8); htime = timing(9:10); datestr = [year,'-',month,'-',day]; - +target = ['ggap' num2str(timing(1:10)) '00.nc']; pythonsc_path = [timing,'.py']; fid = fopen(pythonsc_path,'w'); fprintf(fid,'#!/usr/bin/env python\n'); fprintf(fid,'\n'); -fprintf(fid,'from ecmwfapi import ECMWFDataServer\n'); +fprintf(fid,'import cdsapi\n'); fprintf(fid,'\n'); fprintf(fid,'# To run this example, you need an API key\n'); fprintf(fid,'# available from https://api.ecmwf.int/v1/key/\n'); fprintf(fid,'\n'); -fprintf(fid,'server = ECMWFDataServer()\n'); +fprintf(fid,'c = cdsapi.Client()\n'); fprintf(fid,'\n'); -fprintf(fid,'server.retrieve({\n'); -fprintf(fid,' ''dataset'' : "era5_test",\n'); -fprintf(fid,' ''type'' : "an",\n'); -fprintf(fid,' ''stream'' : "oper",\n'); -fprintf(fid,' ''levtype'' : "pl",\n'); -fprintf(fid,' ''param'' : "129.128/130.128/157.128/246.128",\n'); -fprintf(fid,' ''date'' : "%s",\n',datestr); +fprintf(fid,'c.retrieve(''reanalysis-era5-pressure-levels'',{\n'); +fprintf(fid,' ''variable'' : [''geopotential'',''relative_humidity'',''temperature''],\n'); +fprintf(fid,' ''pressure_level'' : [''1'',''2'',''3'',''5'',''7'',''10'',''20'',''30'',''50'',''70'',''100'',''125'',''150'',''175'',''200'',''225'',''250'',''300'',''350'',''400'',''450'', ''500'',''550'',''600'',''650'',''700'',''750'',''775'',''800'',''825'',''850'',''875'',''900'',''925'',''950'',''975'',''1000''],\n'); +fprintf(fid,' ''product_type'' : ''reanalysis'',\n'); +fprintf(fid,' ''year'' : "%s",\n',year); +fprintf(fid,' ''month'' : "%s",\n',month); +fprintf(fid,' ''day'' : "%s",\n',day); fprintf(fid,' ''time'' : "%s",\n',htime); -fprintf(fid,' ''format'' : "netcdf",\n'); -fprintf(fid,' ''grid'' : "0.25/0.25",\n'); - - -fprintf(fid,' ''step'' : "0",\n'); -fprintf(fid,' ''levelist'': "1/2/3/5/7/10/20/30/50/70/100/125/150/175/200/225/250/300/350/400/450/500/550/600/650/700/750/775/800/825/850/875/900/925/950/975/1000",\n'); -fprintf(fid,' ''resol'' : "auto",\n'); -fprintf(fid,' ''area'' : "%s",\n',wheatherregstr); - - -fprintf(fid,[' ''target'' : "ggap' num2str(timing(1:10)) '00.nc",\n']); -fprintf(fid,' })\n'); +fprintf(fid,' ''format'' : ''netcdf'',\n'); +fprintf(fid,' },\n "%s")\n',target); diff --git a/matlab/aps_weather_model_InSAR.m b/matlab/aps_weather_model_InSAR.m index 89143f0..c58de89 100644 --- a/matlab/aps_weather_model_InSAR.m +++ b/matlab/aps_weather_model_InSAR.m @@ -62,7 +62,7 @@ ifgday_matfile = getparm_aps('ifgday_matfile'); model_type = lower(model_type); -if strcmpi(model_type,'era') +if strcmpi(model_type,'era') || strcmpi(model_type,'era5') weather_model_datapath = getparm_aps('era_datapath',1); elseif strcmpi(model_type,'merra') || strcmpi(model_type,'merra2') weather_model_datapath = getparm_aps('merra_datapath',1); diff --git a/matlab/aps_weather_model_SAR.m b/matlab/aps_weather_model_SAR.m index c5a94e3..d014877 100644 --- a/matlab/aps_weather_model_SAR.m +++ b/matlab/aps_weather_model_SAR.m @@ -106,6 +106,9 @@ if strcmp(model_type,'narr') timelist_model = ['0000' ;'0300'; '0600' ; '0900'; '1200' ;'1500'; '1800' ;'2100'; '0000']; model_lag = 8*7; % days +elseif strcmp(model_type,'era5') + timelist_model= ['0000' ; '0100';'0200';'0300';'0400' ;'0500';'0600' ;'0700';'0800';'0900';'1000' ;'1100'; '1200' ;'1300';'1400';'1500';'1600' ;'1700'; '1800' ;'1900';'2000';'2100';'2200' ;'2300'; '0000']; % the time interval the model is outputed + model_lag = 0; % ? check lags else timelist_model= ['0000' ; '0600' ; '1200' ; '1800' ; '0000']; % the time interval the model is outputed model_lag = 0; % ? check lags @@ -114,7 +117,7 @@ %%% Updating specific weather model information -if strcmpi(model_type,'era') +if strcmpi(model_type,'era') || strcmpi(model_type,'era5') weather_model_datapath = getparm_aps('era_datapath',1); era_data_type = getparm_aps('era_data_type'); % the datatype of the model either BADC or ERA elseif strcmpi(model_type,'merra') || strcmpi(model_type,'merra2') @@ -197,7 +200,7 @@ else % loading the weather model data - if strcmpi(model_type,'era') + if strcmpi(model_type,'era') [ Temp,e,Geopot,P,longrid,latgrid,xx,yy,lon0360_flag] = aps_load_era(file,era_data_type) ; elseif strcmpi(model_type,'era5') [ Temp,e,Geopot,P,longrid,latgrid,xx,yy,lon0360_flag] = aps_load_era(file,era_data_type) ;