NCL常见错误解决方案.docx
《NCL常见错误解决方案.docx》由会员分享,可在线阅读,更多相关《NCL常见错误解决方案.docx(109页珍藏版)》请在冰点文库上搜索。
NCL常见错误解决方案
NCLFrequentlyAskedQuestions(FAQ)
Basics?
|?
NCLcorelanguage?
|?
Fileinput/output?
|?
Datahandling?
|?
Dataanalysis?
|?
Visualization?
|?
Arrayfunctions?
|Outputformats?
|?
Errormessages?
|?
Memoryissues?
|?
Documentation?
|?
Miscellaneous?
|
Basics
1.WherecanIdownloadNCL
2.I'mhavingproblemsdownloadingNCLfromtheESGwebsite.
3.HowdoIsetupmyenvironmenttorunNCL
4.HowdoIrunNCL
5.HowdoIdeterminetheversionofNCL
6.ArethereanyemaillistsIcanjoin
7.WherecanIseesomeexamplesofhowtouseNCL
8.ArethereanyNCLcommandlineoptionsIcanuse
9.ArethereanyeditorenhancementsforeditingNCLscripts
10.IfI'mrunningNCLinteractively,arethereanycommand-lineshortcutsIcanuse
11.IfI'mrunninginteractively,howcanIloadsomeexistingNCLcode
12.IsthereanywayIcanturnoffthepreceding"(n)"outputwhenIprintabunchofvalues
13.MyNCLscriptisquittingsuddenly,andI'mnotsurewhereand/orwhy.
14.HowdoItellifIhaveanOPeNDAP-enabledNCL
NCLcorelanguage
1.HowdoIcommentalineinNCLIsthereawaytohaveablockofcomments
2.IsthereacontinuationcharacterinNCL
3.HowdoIeasilyconvertanumbertoastring
4.HowdoIcreateanewvariablethatdoesn'tcontaina_FillValueattribute
5.HowdoIcreateadouble,long,short,orbytevariablewithoutusing"new"oroneoftheconversionroutines,like"integertobyte"
6.HowdoIincludethedoublequote(")characterinanNCLstring
7.CanNCLpromptforuserinput
8.IsitpossibletohaveglobalvariablesinNCL
9.HowcanIdeletemultipleNCLvariableswithonestatement
10.HowdoIdeleteanameddimension
11.IsthereawaytoseetheloadedvariablesandtheirdimensionsinNCLsimilarto"whos"inmatlab
12.I'mgettinganunexpectedvaluewhenIusethepower('^')operatorcombinedwithanegativevalue.
13.HowdoIcreatealistofstringintegerswithleadingzeros("008","009","010",etc)
14.HowdoIgetthecurrentdateintoNCLasastring
15.HowdoIgetalistoffilesintoanarrayofstringsinNCL
16.HowcanIrecursivelygetalistoffilesinadirectorytreeintoNCL
17.HowdoIconcatenatestringsandvaluesinNCL
18.HowdoIretrieveanenvironmentvariableinNCL
19.HowdoIprintnicelyformatted,multiplecolumnsofdatainNCL
20.Canmultiplevariablesbereturnedfromausercreatedfunction
Fileinput/output
1.What'stheeasiestwaytoconvertaGRIB1,GRIB2,HDF4,orHDF-EOS2filetoaNetCDFfile
2.HowdoIdumpthecontentsofaGRIB,HDF,orHDF-EOSfile(orvariableonthefile)tothescreen
3.HowdoIconvertalargefiletoaNetCDFfile
4.HowdoIwritealarge(>2GB)variabletoanetCDFfile
5.HowdoIgetthelatesttablesforreadingGRIBfiles
6.WhyhavesomeofmyGRIB2variablenameschangedsinceIupdatedtoNCL?
HowdoIwriteascalartoaNetCDFfile
7.HowdoIretainmetadataforavariablethatwasreadoffaseriesoffilesusing"addfiles"
8.HowdoIaccessanNCLfilevariable,attributes,orcoordinatearraysiftheyhavehyphens/dashes('-')inthename
9.HowdoIread/writeNetCDF,HDF4,HDF-EOS2,GRIB1,GRIB2,orCCMHistoryTapefiles
10.HowdoIread/writeASCIIfiles
11.HowdoIreadCSVfiles
12.HowdoIwriteaformattedASCIIfile
13.HowdoIreadanASCIIfileifIdon'tknowhowmanylinesitcontains
14.HowdoIreadanASCIIfilethatcontainsdelimiters
15.HowdoIread/writebinaryfiles
16.OnceI'veopenedafilewith"addfile",howdoIfindoutwhatvariablesandattributesitcontains
17.Isthereawaytocontrolwhethermybinaryfileisreadorwrittenaslittleendianorbigendian
18.I'mhavingtroublereadingaFortranbinaryfilewithrecords.
19.I'mtryingtoconvertafiletoaNetCDFfileusing"ncl_convert2nc",butgettinganerrormessageaboutviolatingformatconstraints.
20.WhydoIgetdifferentresultswhenreadingmyHDF-EOS2file,dependingonwhetherIusethe".hdf"or".hdfeos"extension
21.CanIreadshapefilesusingNCL
22.HowcanIgetatvgroupdataonmyHDF4file
23.WhenIrunmyscript,I'mgettinganerrormessage"ncclose:
ncid0:
NetCDF:
NotavalidID".
24.WhenItrytoaccesstheClimateDiagnosticsCenter[CDC]OPeNDAPserverviaNCL,Iget"Permissiondenied".
25.I'mrunningintoaproblemwhenopeninglotsoffileswithaddfileoraddfiles("Toomanyfilesopen").
Datahandling
1.HowdoIsetamissingvalueformydata
2.HowdoIdetermineifmydatacontainsanymissingvalues,orcounthowmanymissingvaluesithas
3.HowdoIchangethemissingvaluetoanothervalue
4.HowdoIdealwithNaN(not-a-number)valuesinmydata
5.HowdoIdealwith"Inf"(infinity)valuesinmydata
Dataanalysis
1.HowdoIaveragevaluesinamulti-dimensionedarray
2.HowcanIdoanelement-wiseminimum/maximumbetweentwoarraysofthesamesize
3.HowdoIinterpolatemy2-dimensionalrandomdatatoa2-dimensionalgriddedarray
4.HowdoIinterpolatemy3-dimensionalrandomdatatoa3-dimensionalgriddedarray
5.HowcanIfigureoutifaparticularlatitude/longitudepointiswithinaspecificarea,likeEurope
Visualization
1.HowcanIcreatean"editable"graphicsfilerequiredforjournalpublication
2.HowcanImaximizethesizeofaplotintheframe
3.HowdoIgetmultipleplotsonapage
4.What'sagoodwaytogenerateacolormap(table)
5.Mymapprojectiondoesn'tlookright.
6.HowdoIchangeallofmyfontstobethesameinmyvisualization
7.HowcanIchangethetextfunctioncodetosomethingotherthanacolon
8.HowcanIgetadegreesymbolinatextstring
9.HowcanIgetthingslikeaccentsorumlautsovermytext
10.HowcanIgetspecialcharacters,likeGreeksymbols,inmygraphicaltextstrings
11.CanIuserealPostScriptfontsinmyPostScriptfile
12.I'mhavingtroubleimportingaPSfileintoanapplicationlikeAdobeIllustrator.
13.HowcanIgetthelengthofmyaxestobethesameratioastherangeofmyaxes
14.HowdoIchangetheaspectratioorsizeofmymaporplot
15.CanIsetcolorresourcesbycolornameratherthancolorindexvalues
16.HowcanIspeedupthedrawingoffilledcontoursinNCL
17.CanIchangecolorindexvaluesorcolormapsinmid-frame
18.HowdoIgetmyPostScript/PDFoutputtocovermostofan8-1/2"x11"page
19.HowcanIcontrolthesizeandlocationoftheX11windowthatNCLbringsup
20.HowdoItellNCLtoignoremissingvaluesinmyplot
21.HowcanIgetmorelabelsonmycontourlines
22.MyXorYaxisvaluesarenotlinear.HowcanIchangethis
23.HowdoIgetlogscalingoneitherofmyplotaxes
24.HowdoIfillmycontourlevelswithvariousshadingpatternsand/orsolidcolors
25.HowdoIoverlayacontourplot(oravector/streamlineplot)onamap
26.HowdoIforcethetickmarkstopointinward
27.I'mtryingtocontrolthetickmarksonthetoporrightaxis,andnothingishappening.
28.HowcanIimprovetheresolutionofmymapoutlines
29.WhenIdrawamapusingthehigh-resolutionmapdatabase,Iseemtorandomlygetdifferentresolutions.
30.HowcanIgetmoregeographicaloutlinesinmymap,liketheprovincesofChina
31.IfIamcreatingacolorcontourorvectorplot,howdoIselectmycolorssuchthattheyarespreadacrossmywholecolormap
32.HowdoIgenerateawire-framesurfaceorisosurfaceplotinNCL
33.HowdoIdrawweathersymbols(windbarbs,weatherfrontlines,highandlowpressureindicators,arrows,dots,weathericons,cloudsymbols,lightningbolts,etc.)onamap
34.HowcanIhaveanewlineaspartofagraphicaltextstringinNCL
35.HowcomeIgetdifferentlinethicknessesondifferentoutputdevicesusingthesamethicknessvalue
36.HowcanIputatimestamponmyplot
37.WhyamInotgettingthecolorIexpectwhenIreferenceanamedcolor
38.WhyismylandnotbeingfilledinthecolorIexpect
39.HowdoIsetupmyNCLscriptsothatitusesaresourcefile
40.HowcanImoveandresizemylabelbarand/orlegend
41.HowcanIsettheprecisionofthelabelbarlabels
42.HowcanIgeneratesome"nice"2Drandomdataforacontourand/orvectorplot
Arrayfunctions
1.HowdoIgetthedimensionsofanarray
2.HowdoIcreateuniquerandomsubscripts
3.HowdoIeliminatemissingvaluesfromaone-dimensionalarray
4.HowdoIgenerateaone-dimensionalarrayofequally-spacedintegersorfloatingpointnumbers
5.HowdoIfindorprinttheminimum/maximumvaluesofmydataarray
Outputformats
1.HowdoIchangethedefaultNCGM/PostScript/PDFfilenametosomethingelse
2.HowdoIconvertmyNCLgraphicsfiletoanotherformat,likePNG,toputontheweborinapresentation
3.HowdoIremoveallthewhitespacefromanimage
4.IsthereawaytomakethePostScriptfilesgeneratedbyNCLsmaller
5.CanIproduceaPNGimagedirectlyfromNCL
6.Isthereawaytoremovethe".000001."fromthePNGfilename
7.HowcanItiltanNCLgraphic
8.HowcanIconvertaseriesofPSorEPSfilestoananimation
9.HowcanIproduceGoogleEarthkmzfiles
10.HowdoIconvertmymulti-frameNCLgraphicsfiletoanMPEGmoviefile
11.HowdoIincludeanencapsulatedPostScriptfilefromNCLinaLaTexdocument
Errormessages
1.WhenIrunmyscript,I'mgettinga"fatal:
NclMallocFailed"errormessage.
2.WhenIrunNCL,Igetanerrormessageaboutbeingunabletoloadthe"SystemResourceFile".
3.WhenIrunNCL,IgetanerrormessageabouttheXdriver,like"erroropeningdisplay".
4.What'sthedealwiththeerrormessage"error:
line-1beforeornear..."
5.HowcanIturnoffNCLwarningmessages
6.I'mtryingtolistsomefiles,andgettinganerror"Argumentlisttoolong".
7.WhenItrytorunncl,Igetanerrorabout""notbeingfound.
8.I'mtryingtocompilemyNCARGraphicsprogramusingtheIntelorgfortrancompiler,butgettingsomeundefinedrefer