Skip to content

Commit

Permalink
post -processing Greenland rghn
Browse files Browse the repository at this point in the history
  • Loading branch information
JulioTBacmeister committed Nov 4, 2021
1 parent 8c054d9 commit 3183677
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 0 deletions.
38 changes: 38 additions & 0 deletions postproc/addatts.ncl
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

f=addfile("test.nc","rw")
; Add long names and units:
; MXDIS ---
var=f->MXDIS
var@long_name="Obstacle Height"
var@units="m"
f->MXDIS=var

; CLNGT ---
var=f->CLNGT
var@long_name="Ridge Length estimate"
var@units="km"
f->CLNGT=var

; HWDTH ---
var=f->HWDTH
var@long_name="Ridge Width estimate"
var@units="km"
f->HWDTH=var

; ANGLL ---
var=f->ANGLL
var@long_name="Ridge Orientation angle; clockwise from N-S in lat-lon frame"
var@units="degrees (0-180)"
f->ANGLL=var

; ANGLX ---
var=f->ANGLX
var@long_name="Ridge Orientation angle; clockwise from beta-axis in alpha-beta frame"
var@units="degrees (0-180)"
f->ANGLX=var

; GBXAR ---
var2=f->GBXAR
var2@long_name="Grid cell area"
var2@units="Steradians"
f->GBXAR=var2
62 changes: 62 additions & 0 deletions postproc/enhance_sgh30.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
pro enhance_sgh30,dummy=d

soo2 = file_search( '../output/','fv_0.9x1.25_nc3000_NoAniso_Co008_Fi001*' )
soo1 = file_search( '../output/','fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001*' )




fi2 = soo2(0) ;'../output/fv_0.9x1.25_nc3000_Nsw006_Nrs002_Co008_Fi001_ZR_test_vX_20161130_1207.nc'
fi1 = soo1(0) ; 'fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_160505.nc'

print,' Replacing SGH30 in .... '
print,fi2

rncvar,f=fi2,get='SGH',dat=sgh
rncvar,f=fi1 ,get='SGH30',dat=sgh30


sgh2 = SQRT( sgh^2 + sgh30^2 )

skoo = strsplit( soo1(0), '_',/ext )
nskoo=n_elements(skoo)
skoo(nskoo-1) = 'GRNL_'+skoo(nskoo-1)
fo = strjoin( skoo, '_' )
spawn,"cp "+fi1+' '+fo

rncvar,f=fo ,get='LANDFRAC',dat=landf

sgh30x = sgh30

for j=158,185 do begin
for i=235,278 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh2(i,j)
endif
endfor
endfor
; remove Iceland
for j=162,167 do begin
for i=267,278 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor
; remove Baffin
for j=157,168 do begin
for i=232,240 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor

sgh2 = sgh30x

rncvar_replace,replace="SGH30",f=fo,data=sgh2

end



62 changes: 62 additions & 0 deletions postproc/enhance_sgh30_FV_1x1.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
pro enhance_sgh30,dummy=d

soo2 = file_search( '../output/','fv_0.9x1.25_nc3000_NoAniso_Co008_Fi001*' )
soo1 = file_search( '../output/','fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001*' )




fi2 = soo2(0) ;'../output/fv_0.9x1.25_nc3000_Nsw006_Nrs002_Co008_Fi001_ZR_test_vX_20161130_1207.nc'
fi1 = soo1(0) ; 'fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_160505.nc'

print,' Replacing SGH30 in .... '
print,fi2

rncvar,f=fi2,get='SGH',dat=sgh
rncvar,f=fi1 ,get='SGH30',dat=sgh30


sgh2 = SQRT( sgh^2 + sgh30^2 )

skoo = strsplit( soo1(0), '_',/ext )
nskoo=n_elements(skoo)
skoo(nskoo-1) = 'GRNL_'+skoo(nskoo-1)
fo = strjoin( skoo, '_' )
spawn,"cp "+fi1+' '+fo

rncvar,f=fo ,get='LANDFRAC',dat=landf

sgh30x = sgh30

for j=158,185 do begin
for i=235,278 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh2(i,j)
endif
endfor
endfor
; remove Iceland
for j=162,167 do begin
for i=267,278 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor
; remove Baffin
for j=157,168 do begin
for i=232,240 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor

sgh2 = sgh30x

rncvar_replace,replace="SGH30",f=fo,data=sgh2

end



68 changes: 68 additions & 0 deletions postproc/enhance_sgh30_fv_2x2.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
pro enhance_sgh30_fv_2x2,dummy=d

soo2 = file_search( '../output/','fv_0.9x1.25_nc3000_NoAniso_Co008_Fi001*' )
soo1 = file_search( '../output/','fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001*' )




fi2 = 'fv_1.9x2.5_nc3000_NoAniso_Co008_Fi001_20190318.nc' ; soo2(0) ;'../output/fv_0.9x1.25_nc3000_Nsw006_Nrs002_Co008_Fi001_ZR_test_vX_20161130_1207.nc'
fi1 = 'fv_1.9x2.5_nc3000_Nsw084_Nrs016_Co120_Fi001_ZR_061116.nc' ; soo1(0) ; 'fv_0.9x1.25_nc3000_Nsw042_Nrs008_Co060_Fi001_ZR_160505.nc'

print,' Replacing Greenland SGH30 in ... '
print,fi1
print,' with SGH in .... '
print,fi2

rncvar,f=fi2,get='SGH',dat=sgh
rncvar,f=fi1 ,get='SGH30',dat=sgh30


sgh2 = SQRT( sgh^2 + sgh30^2 )

skoo = strsplit( fi1 , '_',/ext )
nskoo=n_elements(skoo)
skoo(nskoo-1) = 'GRNL_'+skoo(nskoo-1)
fo = strjoin( skoo, '_' )


STOP

spawn,"cp "+fi1+' '+fo

rncvar,f=fo ,get='LANDFRAC',dat=landf

sgh30x = sgh30

for j=158/2,185/2 do begin
for i=235/2,278/2 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh2(i,j)
endif
endfor
endfor
; remove Iceland
for j=162/2,167/2 do begin
for i=267/2,278/2 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor
; remove Baffin
for j=157/2,168/2 do begin
for i=232/2,240/2 do begin
if landf(i,j) gt .1 then begin
sgh30x(i,j)=sgh30(i,j)
endif
endfor
endfor

sgh2 = sgh30x

rncvar_replace,replace="SGH30",f=fo,data=sgh2

end



0 comments on commit 3183677

Please sign in to comment.