[ncl-talk] Error in regridding Stage-4 data and writing NetCDF files
JETAL SUTARIYA
jetal164 at email.arizona.edu
Sat Dec 4 01:29:52 MST 2021
Hi NCL Community,
I am trying to regrid the NCEP 4 km Stage-4 data to NLDAS grid (1/8th
degree). But, I get error while writing netcdf files output.
Error: fatal:Could not create (/20150101.nc)
I have attached few files here: 1) ncl script that I used to complete this
task, 2) Screenshots of the PrintVarSummary error, printminmax, and ncdump
of Stage-4 file and NLDAS file.
Any suggestions are helpful.
Thanks,
Jetal
Below is the script:
;This script converts Stage-4 PRECIP data to NLDAS data grid
begin
diri= "./"
fili = systemfunc("cd "+diri+" ; ls *.nc")
print(fili) ; all file names
nfili = dimsizes(fili)
print(nfili)
do nf=0, nfili-1
a = addfile(diri+fili(nf),"r") ; Read all Stage-4 data files
b = addfile("201907.nc", "r") ; Read one file with NLDAS data grid
lat/lon
le = a->PRECIP(:,:)
if(any(isnan_ieee(le))) then
le at _FillValue = -9999
replace_ieeenan(le,le at _FillValue,0)
end if
le!0 = "PRECIP_y"
le&PRECIP_y = a->LAT(:,0)
le!1 = "PRECIP_x"
le&PRECIP_x = a->LON(0,:)
printVarSummary(le)
printMinMax(le, 1)
lat = b->lat
lon = b->lon
lon!0 = "lon"
lon at long_name = "longitude"
lon at units = "degrees_east"
lon&lon = lon
lat!0 = "lat"
lat at long_name = "latitude"
lat at units = "degrees_north"
lat&lat = lat
flh = linint2_Wrap(le&PRECIP_x, le&PRECIP_y, le, False, lon, lat, 0)
printVarSummary(flh)
printMinMax(flh, 1)
flh at unit = "mm/hr"
flh at long_name = "Precipitation"
flh!0 = "lat"
flh&lat = lat
flh!1 = "lon"
flh&lon = lon
dimNames = (/"lat","lon"/)
dimSizes = (/dimsizes(lat),dimsizes(lon)/)
dimUnlim = (/False,False/)
diroutt = "../"
iy = 2
yyyy = 2015
do mm = 1,12
do dd = 1,iy
if (mm .eq. 1) .or. (mm .eq. 3) .or. (mm .eq. 5) .or. (mm .eq. 7)
.or. (mm .eq. 8) .or. (mm .eq. 10) .or. (mm .eq. 12) then
iy = 31
else if (mm .eq. 4) .or. (mm .eq. 6) .or. (mm .eq. 9) .or. (mm
.eq. 11) then
iy = 30
else if (mod(yyyy,4) .eq. 0) then
iy = 29
else
iy = 28
end if
end if
end if
if (dd .lt. 10)
date = "0" + dd
else
date = dd
end if
if (mm .lt. 10)
month = "0" + mm
else
month = mm
end if
filoutt = yyyy + month + date + ".nc"
system("rm -f "+diroutt+filoutt)
foutt= addfile(diroutt+filoutt,"c")
setfileoption(foutt,"DefineMode",True)
filedimdef(foutt,dimNames,dimSizes,dimUnlim)
foutt->lat = lat
foutt->lon = lon
foutt->PRECIP = flh
end do
end do
end do
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211204/c8f69ce2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Regrid_stage4tonldas_talk.ncl
Type: application/octet-stream
Size: 2410 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211204/c8f69ce2/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_error.docx
Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
Size: 566507 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20211204/c8f69ce2/attachment-0001.docx>
More information about the ncl-talk
mailing list