cychang1@atmos_umd_edu
New Member
I am used to use GrADS (or GrADSnc) to analyze data. While the output data of CAM3 can directly be accessed by using gradsnc, the POP output data cannot.
I don't know why it can't, but since the CCSM3 user guide says that an NCL script "pop_remap.ncl" can be used for remapping the pop data, I assumed that after using the pop_remap.ncl script (maybe this is not a correct assumption).
So I run an example run following the user guide (TestB, which is a T42_gx1v3 run), and download the remap weight " gx1v3 to T42 remapping (conservative)" from the ESG website (under the link that says "NCL POP Remapping Weights") and wrote this simple ncl script:
-----------------------------------------------------------------------
begin
focn=addfile("TestB.pop.h.1989-01.nc","r")
fP = addfile("map_gx1v3_to_T42_aave_da_020607.nc","r") ; SCRIP weigts netCDF file
temp =focn->SHF
dim_temp = dimsizes( temp ) ; temp is the variable to be remapped
nDtemp = dimsizes( dim_temp ) ; rank [# dimensions]
dim_src = fP->src_grid_dims ; size of source grid
; error check
if (dim_temp(nDtemp-2).ne.dim_src(1) .or. dim_temp(nDtemp-1).ne.dim_src(0)) then
print (" Input grid and Remap sizes do not match")
exit
end if
dst_add = fP->row ; destination grid [linear]
src_add = fP->col ; source grid [linear]
map_wts = fP->S2 ; wts
dim_dst = fP->dst_grid_dims ; size destination grid
mx = dim_dst(0) ; output # elements in "x"
ny = dim_dst(1) ; output # elements in "y"
xout_1D = new (ny*mx, typeof(temp)) ; (temporary) return grid [1D]
xin_1D = ndtooned ( temp ) ; convert to 1D
pop_remap(xout_1D, map_wts, dst_add, src_add, xin_1D)
XOUT = onedtond(xout_1D, (/1,ny,mx/) ) ; new grid
fo=addfile("pop_SHF.nc","nc")
nlat=64
nlon=128
ntime=-1
dim_names = (/ "time", "lat", "lon" /)
dim_sizes = (/ ntime , nlat , nlon /)
dimUnlim = (/ True , False , False /)
filedimdef( fo, dim_names, dim_sizes, dimUnlim )
filevardef( fo, "SHF", "float", dim_names)
SHF_Att=0
SHF_Att@long_name = "Total Surface Heat Flux, Including SW"
SHF_Att@units = "watts/m^2"
SHF_Att@_FillValue = 9.96921e+36
filevarattdef(fo, "SHF", SHF_Att )
fo->SHF = XOUT
end
----------------------------------------------------
However, when I used gradsnc to open the output of this ncl script, the response is still "SDF file has no discernable X coordinate." the same as that for the original output data of POP.
I am just learning NCL because the CCSM3 user guide mentions it, so I am no expert at all. I don't know if it's the script has problem or something else is wrong.
Can somebody give me a hint or a direction about how to read the POP output data by using gradsnc? (For example, the POP output data that are placed at PCMDI/IPCC website are readable by gradsnc. They are all in netCDF format. Does anyone know how to process the direct POP output data into the format of the IPCC?)
Thank you for your help in advance
Ching-Yee
I don't know why it can't, but since the CCSM3 user guide says that an NCL script "pop_remap.ncl" can be used for remapping the pop data, I assumed that after using the pop_remap.ncl script (maybe this is not a correct assumption).
So I run an example run following the user guide (TestB, which is a T42_gx1v3 run), and download the remap weight " gx1v3 to T42 remapping (conservative)" from the ESG website (under the link that says "NCL POP Remapping Weights") and wrote this simple ncl script:
-----------------------------------------------------------------------
begin
focn=addfile("TestB.pop.h.1989-01.nc","r")
fP = addfile("map_gx1v3_to_T42_aave_da_020607.nc","r") ; SCRIP weigts netCDF file
temp =focn->SHF
dim_temp = dimsizes( temp ) ; temp is the variable to be remapped
nDtemp = dimsizes( dim_temp ) ; rank [# dimensions]
dim_src = fP->src_grid_dims ; size of source grid
; error check
if (dim_temp(nDtemp-2).ne.dim_src(1) .or. dim_temp(nDtemp-1).ne.dim_src(0)) then
print (" Input grid and Remap sizes do not match")
exit
end if
dst_add = fP->row ; destination grid [linear]
src_add = fP->col ; source grid [linear]
map_wts = fP->S2 ; wts
dim_dst = fP->dst_grid_dims ; size destination grid
mx = dim_dst(0) ; output # elements in "x"
ny = dim_dst(1) ; output # elements in "y"
xout_1D = new (ny*mx, typeof(temp)) ; (temporary) return grid [1D]
xin_1D = ndtooned ( temp ) ; convert to 1D
pop_remap(xout_1D, map_wts, dst_add, src_add, xin_1D)
XOUT = onedtond(xout_1D, (/1,ny,mx/) ) ; new grid
fo=addfile("pop_SHF.nc","nc")
nlat=64
nlon=128
ntime=-1
dim_names = (/ "time", "lat", "lon" /)
dim_sizes = (/ ntime , nlat , nlon /)
dimUnlim = (/ True , False , False /)
filedimdef( fo, dim_names, dim_sizes, dimUnlim )
filevardef( fo, "SHF", "float", dim_names)
SHF_Att=0
SHF_Att@long_name = "Total Surface Heat Flux, Including SW"
SHF_Att@units = "watts/m^2"
SHF_Att@_FillValue = 9.96921e+36
filevarattdef(fo, "SHF", SHF_Att )
fo->SHF = XOUT
end
----------------------------------------------------
However, when I used gradsnc to open the output of this ncl script, the response is still "SDF file has no discernable X coordinate." the same as that for the original output data of POP.
I am just learning NCL because the CCSM3 user guide mentions it, so I am no expert at all. I don't know if it's the script has problem or something else is wrong.
Can somebody give me a hint or a direction about how to read the POP output data by using gradsnc? (For example, the POP output data that are placed at PCMDI/IPCC website are readable by gradsnc. They are all in netCDF format. Does anyone know how to process the direct POP output data into the format of the IPCC?)
Thank you for your help in advance
Ching-Yee