[ncl-talk] NetCDF output file from NCL not opening in GrADS

gibies george gibiesgeorge at gmail.com
Thu Jul 6 03:13:27 MDT 2017


I have seen those mails from Dr. Dennis and Dr. Adam.

You can use reshape function to add additional coordinate to a variable.
Define some single value coordinate for latitude and longitude.

varname!0 ="time"
varname!1 = "lat"
varname&lat = .......
varname!2 = "lon"
varname&lon = ......




On Jul 6, 2017 2:08 PM, "S Br" <sbr.climate at gmail.com> wrote:

> Hi Gibies,
> NCL also provided the same solution as you have mentioned.
> Could you please tell me how can I add single value coordinates (time,
> lat, lon) to the variable.
> Hope, you can write me the command for me.
>
> Thanks.
> SB
>
> On Wed, Jul 5, 2017 at 5:58 PM, gibies george <gibiesgeorge at gmail.com>
> wrote:
>
>> Yes, you can add single value coordinates (time lat lon) to the variable
>> before saving it to nc file.
>>
>> On Jul 5, 2017 9:58 PM, "S Br" <sbr.climate at gmail.com> wrote:
>>
>>> Is it possible to do something inside the NCL script so that it can be
>>> opened by GrADS.
>>>
>>> On Wed, Jul 5, 2017 at 5:25 PM, gibies george <gibiesgeorge at gmail.com>
>>> wrote:
>>>
>>>> This is because grads required standard file coordinates structure.
>>>> Time lat lon etc.
>>>>
>>>> On Jul 5, 2017 9:43 PM, "S Br" <sbr.climate at gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> I have applied bandpass filter to my one dimentional NetCDF file. I
>>>>> have written the output to a NetCDF file but this output file is not
>>>>> opening in GrADS. I get the following error.
>>>>>
>>>>> ga-> sdfopen tas_aave_Asia_bandpass30-100.nc
>>>>> Scanning self-describing file:  tas_aave_Asia_bandpass30-100.nc
>>>>> gadsdf: SDF file has no discernable X coordinate.
>>>>>   To open this file with GrADS, use a descriptor file with an XDEF
>>>>> entry.
>>>>>   Documentation is at http://cola.gmu.edu/grads/gado
>>>>> c/SDFdescriptorfile.html
>>>>>
>>>>> Could you please suggest if I am doing somewhere wrong in my NCL
>>>>> script . The input file is perfectly fine with GrADS.
>>>>>
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>> begin
>>>>>
>>>>>    fn  = "tas_aave_Asia.nc" ; define filename
>>>>>    in  = addfile(fn,"r")                                 ; open netcdf
>>>>> file
>>>>>     x  = in->tasmask(:,0,0)                                       ;
>>>>> get data
>>>>>
>>>>> ; ***********************************************
>>>>> ; create the filter weights and apply
>>>>> ; ***********************************************
>>>>>
>>>>>   ihp     = 2                             ; band pass
>>>>>   sigma   = 1.0                           ; Lanczos sigma
>>>>>
>>>>>   nWgt    = 201                           ; loose 100 each end
>>>>>   fca     = 1./100.                       ; start freq
>>>>>   fcb     = 1./30.                        ; last  freq
>>>>>   wgt     = filwgts_lanczos (nWgt, ihp, fca, fcb, sigma )
>>>>>   xBPF    = wgt_runave ( x, wgt, 0 )      ; 30-100 days
>>>>>
>>>>>    copy_VarMeta(x,xBPF)
>>>>>    dNames= getvardims(xBPF)
>>>>>    dSIZES=dimsizes(xBPF)
>>>>>    print (dNames)
>>>>>    print (dSIZES)
>>>>>
>>>>> ; ***********************************************
>>>>> ; create new date array for use on the plot
>>>>> ; ***********************************************
>>>>>   filo = "tas_aave_Asia_bandpass30-100.nc"
>>>>>   system ("/bin/rm "+filo) ; remove any pre-existing file
>>>>>   fo = addfile(filo , "c") ; open output file
>>>>>   tasmax=xBPF(:)
>>>>>   fo->tasmax = tasmax ; write ud to a file
>>>>> end
>>>>>
>>>>>
>>>>> Thanks.
>>>>> SB
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170706/b773c4ad/attachment.html 


More information about the ncl-talk mailing list