[ncl-talk] ncl CODE BUG IN CONVERTING NETCDF FILE IN INTERMEDIATE FORMAT

Dennis Shea shea at ucar.edu
Wed Nov 16 11:06:15 MST 2022


You have:

*lat=f->lat*
*lon=f->lon*
*printVarSummary(sst)*
*sst=sst(0,::-1,:)*

The *lat* array is in the original order.

After *sst=sst(0,::-1,:)*

the latitude coordinate variable *[sst&lat*] is reversed*. * See
*printVarSummary(sst)*

Maybe add:
*   print("opt at deltalat="+opt at deltalat)*
to see if this is as
*expected*

I do not know wh*a*t happens in
*wrf_wps_write_int(WPS_IM_root_name,Field,units,desc,sst(0,:,:),opt)*
[I do not want to look at that code]

but maybe that is the issue



On Wed, Nov 16, 2022 at 4:26 AM jayanti pal via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Sir,
>
> I am tryin to convert netcdf file to intermediate format usinf following
> code
>
> *f=addfile("gfs_2020160512.nc <http://gfs_2020160512.nc>", "r")*
> *TT=f->time*
> *sst=f->t_2*
> *lat=f->lat*
> *lon=f->lon*
> *printVarSummary(sst)*
> *sst=sst(0,::-1,:)*
> *printVarSummary(sst)*
> *utc_d=cd_calendar(TT,0)*
> *ymdh=cd_calendar(TT,-3)*
> *yyyy=tointeger(utc_d(:,0))*
> *mm=tointeger(utc_d(:,1))*
> *dd=tointeger(utc_d(:,2))*
> *hh=tointeger(utc_d(:,3))*
> *date=yyyy+"-0"+mm+"-"+dd+"_0"+hh*
> *WPS_IM_root_name="SST"*
> *output_file_name=WPS_IM_root_name+":"+date*
> *Field="sst"*
> *units="degC"*
> *desc="Sea Surface Temperature"*
> *sst=sst(0,:,:)*
> *print(sst&lat(0))*
> *opt = True*
> *opt at projection = 0*
> *opt at date = date*
> *opt at startloc = "SWCORNER"*
> *opt at startlon = sst&lon(0)*
> *opt at startlat = sst&lat(0)*
> *opt at deltalon = sst&lon(1)-sst&lon(0)*
> *opt at deltalat = sst&lat(1)-sst&lat(0)*
> *opt at is_wind_earth_relative = False*
> *opt at level = 1*
> *opt at source = "NOAA High-resolution Blended Analysis"*
> *printVarSummary(sst)*
> *wrf_wps_write_int(WPS_IM_root_name,Field,units,desc,sst(0,:,:),opt)*
>
>
>
> The above successfully run and create intermediate format which content is
> as follow
> *================================================*
> *FIELD = TT*
> *UNITS = k DESCRIPTION = Temperature*
> *DATE = 2020-05-16_012 FCST = 0.000000*
> *SOURCE = Unknown data source*
> *LEVEL = 1.000000*
> *I,J DIMS = 1440, 721*
> *IPROJ = 0  PROJECTION = LAT LON*
> *  REF_X, REF_Y = 1.000000, 1.000000*
> *  REF_LAT, REF_LON = 0.000000, 0.000000*
> *  DLAT, DLON = 0.000000, 0.000000*
> *  EARTH_RADIUS = 6367.470215*
> *DATA(1,1)=230.716217*
>
>
>
>
> Errors line is marked in red.
> ref lat, ref lon are thought to be start lat and lon and lat lon interval
> (dlat, dlon are -0.25 and 0.25 respectively)
>
> Using ungrib in WRF when same file is used, the folowing content is there
> *FIELD = TT*
> *UNITS = K DESCRIPTION = Temperature*
> *DATE = 2020-05-16_12:00:00 FCST = 0.000000*
> *SOURCE = NCEP GFS Model*
> *LEVEL = 200100.000000*
> *I,J DIMS = 1440, 721*
> *IPROJ = 0  PROJECTION = LAT LON*
> *  REF_X, REF_Y = 1.000000, 1.000000*
> *  REF_LAT, REF_LON = 90.000000, 0.000000*
> *  DLAT, DLON = -0.250000, 0.250000*
> *  EARTH_RADIUS = 6371.229492*
> *DATA(1,1)=271.702606*
>
>
> pLEASE HELP ME TO RECTIFY THE ncl SCRIPT.
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20221116/a08f91ac/attachment-0001.htm>


More information about the ncl-talk mailing list