[ncl-talk] Array reordering in OISST

Atsuyoshi MANDA am at bio.mie-u.ac.jp
Sun May 19 21:46:40 MDT 2019


Hi,

I am trying to reorder the array dimensions in the monthly mean OISST
version 2 dataset, which was downloaded from
ftp://ftp.cdc.noaa.gov/Datasets/noaa.oisst.v2/sst.mnmean.nc.

However, reordering using the named subscripting in my script does not work.

Please see the attached files:
OIV2LR.sst.1982JUL.png (original data)
OIV2LR.sstre.1982JUL.png (reordered data)

Any suggestions would be greatly appreciated.

Here is my script:
;=========================
indir="./"
infle="sst.mnmean.nc"
in=indir+"/"+infle

script_name  = get_script_name()
outdir="BIN_"+systemfunc("basename "+script_name+" .ncl")

dset="OIV2LR"
MM=7

month_abbr = (/"","JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP", \
                    "OCT","NOV","DEC"/)
MMM=month_abbr(MM)

system("mkdir -vp "+outdir)


f=addfile(in, "r")

;printVarSummary(f)
;print(f)

lon=f->lon
lat=f->lat
sst=f->sst
time=f->time

utc_date = cd_calendar(time, 0)

year   = tointeger(utc_date(:,0))    ; Convert to integer for
month  = tointeger(utc_date(:,1))    ; use sprinti
day    = tointeger(utc_date(:,2))
hour   = tointeger(utc_date(:,3))
minute = tointeger(utc_date(:,4))
second = utc_date(:,5)
date_str = sprinti("%0.2iZ ", hour) + sprinti("%0.2i ", day) + \
           month_abbr(month) + " "  + sprinti("%0.4i", year)

yyyys=1982
yyyye=2017

sst_scaled=sst*sst at scale_factor + sst at add_offset
copy_VarAtts(sst,sst_scaled)
copy_VarCoords(sst,sst_scaled)
printVarSummary(sst_scaled)

sstre=sst_scaled(time|:,lon|:,lat|:)
copy_VarAtts(sst_scaled,sst)
copy_VarCoords(sst_scaled,sstre)
printVarSummary(sstre)



dim=dimsizes(year)
nt=dim(0)

do n=7,7 ;0,nt-1

if(year(n) .ge. yyyys .and. year(n) .le. yyyye .and. month(n) .eq. MM)then
print(n+" "+date_str(n))


figdir="FIG_"+systemfunc("basename "+script_name+" .ncl")+"_"+dset
system("mkdir -vp "+figdir)
type="png"



figfle=dset+"."+"sstre."+year(n)+MMM+""
fig=figdir+"/"+figfle

print("figfle="+figfle+"."+type)

wks = gsn_open_wks(type, fig)

res=True
  res at cnFillOn              = True               ; turn on color fill
  res at cnLinesOn             = False              ; turn off contour lines
plot1=gsn_csm_contour_map(wks,sstre(n,:,:),res)



figfle=dset+"."+"sst."+year(n)+MMM+""
fig=figdir+"/"+figfle

print("figfle="+figfle+"."+type)

wks = gsn_open_wks(type, fig)

res=True
  res at cnFillOn              = True               ; turn on color fill
  res at cnLinesOn             = False              ; turn off contour lines
plot1=gsn_csm_contour_map(wks,sst(n,:,:),res)


print("sst(n,90-30,130)="+sst(n,90-30,130)+" "+lon(130)+"E "+lat(90-30)+"N")
print("sstre(n,130,90+30-1)="+sstre(n,130,90+30-1)+" "+lon(130)+"E
"+sstre&lat(90+30-1)+"N")

end if

end do
;=========================

Thank you,
Atsuyoshi

-
Atsuyoshi Manda, Ph.D
Associate Professor,
Mie University
1577 Kurimamachiya-cho Tsu city, Mie 514-8507 JAPAN
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OIV2LR.sst.1982JUL.png
Type: image/png
Size: 130182 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/33b2ea43/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OIV2LR.sstre.1982JUL.png
Type: image/png
Size: 136753 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190520/33b2ea43/attachment-0001.png>


More information about the ncl-talk mailing list