Skip to content

Commit

Permalink
Fixing HRRR code
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-dixon committed Nov 14, 2024
1 parent 884859d commit dd87a2b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
indir=HCRdir(project,quality,qcVersion,freqData);

%% Go through flights
for ii=1:size(caseList,1)
for ii=9:size(caseList,1)
disp(['IOP ',num2str(ii)]);

startTime=datetime(caseList(ii,1:6));
Expand Down Expand Up @@ -131,12 +131,14 @@
modelData.vSurf=modelOrig.vSurf(rInds(1):rInds(2),cInds(1):cInds(2),:);
modelData.time=modelOrig.time;
end

%% Set up grid
if strcmp(whichModel,'narr') | strcmp(whichModel,'hrrr')
lonMat=double(repmat(modelData.lon,1,1,size(modelData.z,4)));
latMat=double(repmat(modelData.lat,1,1,size(modelData.z,4)));
lonMat=wrapTo360(lonMat);
if strcmp(whichModel,'narr')
lonMat=wrapTo360(lonMat);
end
else
lonMat=double(repmat(modelData.lon,1,size(modelData.z,2),size(modelData.z,4)));
latMat=double(repmat(fliplr(modelData.lat'),size(modelData.z,1),1,size(modelData.z,4)));
Expand Down Expand Up @@ -428,36 +430,36 @@
if strcmp(intFields{ll},'tempHCR')
tempHCR=modelvar;
save([outdir,whichModel,'.',intFields{ll},'.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'tempHCR','-v7.3');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'tempHCR','-v7.3');
elseif strcmp(intFields{ll},'pHCR')
pHCR=modelvar;
save([outdir,whichModel,'.',intFields{ll},'.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'pHCR','-v7.3');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'pHCR','-v7.3');
elseif strcmp(intFields{ll},'rhHCR')
rhHCR=modelvar;
save([outdir,whichModel,'.',intFields{ll},'.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'rhHCR','-v7.3');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'rhHCR','-v7.3');
elseif strcmp(intFields{ll},'uHCR')
uHCR=modelvar;
save([outdir,whichModel,'.',intFields{ll},'.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'uHCR','-v7.3');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'uHCR','-v7.3');
elseif strcmp(intFields{ll},'vHCR')
vHCR=modelvar;
save([outdir,whichModel,'.',intFields{ll},'.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'vHCR','-v7.3');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'vHCR','-v7.3');
end
end
end

disp(['Saving surface data ...']);
timeHCR=data.time;
save([outdir,whichModel,'.time.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'timeHCR');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'timeHCR');

if isfield(modelData,'sstSurf')
sstHCR=surfData.sstHCR;
save([outdir,whichModel,'.sst.',datestr(data.time(1),'YYYYmmDD_HHMMSS'),'_to_',...
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Flight',num2str(ii),'.mat'],'sstHCR');
datestr(data.time(end),'YYYYmmDD_HHMMSS'),'.Iop',num2str(ii),'.mat'],'sstHCR');
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
uIn=readgeoraster(hourFile,Bands=bandUpress);
vIn=readgeoraster(hourFile,Bands=bandVpress);

zIn=zIn./9.806;
%zIn=zIn./9.806;

tps=descr(bandTpress);
rhps=descr(bandRHpress);
Expand Down
12 changes: 9 additions & 3 deletions projDir/qcDualPRTground/doc/run_qc_processes.howto.dualPRTground
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ $PROJ_DIR/qcDualPRTground/dataProcessing/HCRproducts/flag/cfradialVELmasked.m
#################################################################
# Interpolate forecast or reanalysis data
#
# We need model input data from eather ecmwf forecasts or
# We need model input data from eather hrrr forecasts or
# era5 reanalysis

# The variables needed are:
Expand All @@ -246,13 +246,19 @@ $PROJ_DIR/qcDualPRTground/dataProcessing/HCRproducts/flag/cfradialVELmasked.m
# 10 metre U wind component, 10 metre V wind component, Surface pressure

# The model data directory is
/scr/virga1/rsfdata/projects/meow/model/era5
/scr/virga1/rsfdata/projects/meow/model/era5 or
/scr/virga1/rsfdata/projects/meow/model/hrrr

# To get era5 data run $PROJ_DIR/qcDualPRTground/scripts/downloadERA5.pressLev.cset
# To get era5 data run
$PROJ_DIR/qcDualPRTground/scripts/downloadERA5.pressLev.cset
# (There is also a script for surface variables but that needs more testing (downloadERA5.surf.cset)

# If that doesn't work, download the data from https://rda.ucar.edu/datasets/d633000/dataaccess/#

# To get HRRR data, run
$PROJ_DIR/qcDualPRTground/scripts/downloadHRRRfromAWS

# To interpolate the model data, run
# Modify and run $PROJ_DIR/qcDualPRTground/dataProcessing/HCRproducts/modelData/model2HCR4d.m

# Add model data to cfradial files
Expand Down

0 comments on commit dd87a2b

Please sign in to comment.