[ncl-talk] Error writing strings to netcdf

Andrew Kren - NOAA Affiliate andrew.kren at noaa.gov
Fri May 4 11:19:30 MDT 2018


Hi,

In my previous programs I have used the tochar function to convert strings
to characters for writing string data to netcdf using NCL. However, for
some reason, its not working for me this time. It fails with this error:

ncdimdef: ncid 65536: NetCDF: String match to name in use

fatal:["Execute.c":8575]:Execute: Error occurred at or near line 806 in
file nam_foothills.ncl

My section to write the netcdf file is here:

filo = "/home/arsenic1/scripts/nam/00z/saved_foothills_variables_nam.nc"

system("rm -rf "+filo) ; remove any pre-existing file

p = addfile(filo,"c")

p at title = "Saved Foothills Variables for comparison page"

p at source = filo

p at creation_date = systemfunc("date")

filedimdef(p,"time",-1,True) ; make time unlimited dimension


p->temperature_top = temperature_top

p->wnd_spd_top = wnd_spd_top

p->clouds = clouds

p->lightning = lightning

p->precip_chance = precip_chance

p->precip_type_top = precip_type_top

p->precip_amount = precip_6hr_top

p->wnd_dir_top_string = (/tochar(wnd_dir_top_string)/)

p->day_of_week_string = (/tochar(day_of_week_string)/)

p->months = (/tochar(months)/)

p->valid_day = (/tochar(valid_day)/)

Line 806 is the first line where it tries to write the wind direction
string:

p->wnd_dir_top_string = (/tochar(wnd_dir_top_string)/)

Is there any remedy to this? I've looked online, but have not found much
help.

Thanks,



-- 
Andrew Kren
Assistant Scientist
CIMAS & NOAA/AOML
325 Broadway, Boulder, CO 80305
(303) 497-5418
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180504/8fb72e96/attachment.html>


More information about the ncl-talk mailing list