NCL常见错误解决方案_第1页
NCL常见错误解决方案_第2页
NCL常见错误解决方案_第3页
NCL常见错误解决方案_第4页
NCL常见错误解决方案_第5页
已阅读5页,还剩351页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

NCL常见错误解决方案NCL常见错误解决方案NCL常见错误解决方案xxx公司NCL常见错误解决方案文件编号:文件日期:修订次数:第1.0次更改批准审核制定方案设计,管理制度NCLFrequentlyAskedQuestions(FAQ)Basics

|

NCLcorelanguage

|

Fileinput/output

|

Datahandling

|

Dataanalysis

|

Visualization

|

Arrayfunctions

|Outputformats

|

Errormessages

|

Memoryissues

|

Documentation

|

Miscellaneous

|BasicsWherecanIdownloadNCLI'mhavingproblemsdownloadingNCLfromtheESGwebsite.HowdoIsetupmyenvironmenttorunNCLHowdoIrunNCLHowdoIdeterminetheversionofNCLArethereanyemaillistsIcanjoinWherecanIseesomeexamplesofhowtouseNCLArethereanyNCLcommandlineoptionsIcanuseArethereanyeditorenhancementsforeditingNCLscriptsIfI'mrunningNCLinteractively,arethereanycommand-lineshortcutsIcanuseIfI'mrunninginteractively,howcanIloadsomeexistingNCLcodeIsthereanywayIcanturnoffthepreceding"(n)"outputwhenIprintabunchofvaluesMyNCLscriptisquittingsuddenly,andI'mnotsurewhereand/orwhy.HowdoItellifIhaveanOPeNDAP-enabledNCLNCLcorelanguageHowdoIcommentalineinNCLIsthereawaytohaveablockofcommentsIsthereacontinuationcharacterinNCLHowdoIeasilyconvertanumbertoastringHowdoIcreateanewvariablethatdoesn'tcontaina_FillValueattributeHowdoIcreateadouble,long,short,orbytevariablewithoutusing"new"oroneoftheconversionroutines,like"integertobyte"HowdoIincludethedoublequote(")characterinanNCLstringCanNCLpromptforuserinputIsitpossibletohaveglobalvariablesinNCLHowcanIdeletemultipleNCLvariableswithonestatementHowdoIdeleteanameddimensionIsthereawaytoseetheloadedvariablesandtheirdimensionsinNCLsimilarto"whos"inmatlabI'mgettinganunexpectedvaluewhenIusethepower('^')operatorcombinedwithanegativevalue.HowdoIcreatealistofstringintegerswithleadingzeros("008","009","010",etc)HowdoIgetthecurrentdateintoNCLasastringHowdoIgetalistoffilesintoanarrayofstringsinNCLHowcanIrecursivelygetalistoffilesinadirectorytreeintoNCLHowdoIconcatenatestringsandvaluesinNCLHowdoIretrieveanenvironmentvariableinNCLHowdoIprintnicelyformatted,multiplecolumnsofdatainNCLCanmultiplevariablesbereturnedfromausercreatedfunctionFileinput/outputWhat'stheeasiestwaytoconvertaGRIB1,GRIB2,HDF4,orHDF-EOS2filetoaNetCDFfileHowdoIdumpthecontentsofaGRIB,HDF,orHDF-EOSfile(orvariableonthefile)tothescreenHowdoIconvertalargefiletoaNetCDFfileHowdoIwritealarge(>2GB)variabletoanetCDFfileHowdoIgetthelatesttablesforreadingGRIBfilesWhyhavesomeofmyGRIB2variablenameschangedsinceIupdatedtoNCL

HowdoIwriteascalartoaNetCDFfileHowdoIretainmetadataforavariablethatwasreadoffaseriesoffilesusing"addfiles"HowdoIaccessanNCLfilevariable,attributes,orcoordinatearraysiftheyhavehyphens/dashes('-')inthenameHowdoIread/writeNetCDF,HDF4,HDF-EOS2,GRIB1,GRIB2,orCCMHistoryTapefilesHowdoIread/writeASCIIfilesHowdoIreadCSVfilesHowdoIwriteaformattedASCIIfileHowdoIreadanASCIIfileifIdon'tknowhowmanylinesitcontainsHowdoIreadanASCIIfilethatcontainsdelimitersHowdoIread/writebinaryfilesOnceI'veopenedafilewith"addfile",howdoIfindoutwhatvariablesandattributesitcontainsIsthereawaytocontrolwhethermybinaryfileisreadorwrittenaslittleendianorbigendianI'mhavingtroublereadingaFortranbinaryfilewithrecords.I'mtryingtoconvertafiletoaNetCDFfileusing"ncl_convert2nc",butgettinganerrormessageaboutviolatingformatconstraints.WhydoIgetdifferentresultswhenreadingmyHDF-EOS2file,dependingonwhetherIusethe".hdf"or".hdfeos"extensionCanIreadshapefilesusingNCLHowcanIgetatvgroupdataonmyHDF4fileWhenIrunmyscript,I'mgettinganerrormessage"ncclose:ncid0:NetCDF:NotavalidID".WhenItrytoaccesstheClimateDiagnosticsCenter[CDC]OPeNDAPserverviaNCL,Iget"Permissiondenied".I'mrunningintoaproblemwhenopeninglotsoffileswithaddfileoraddfiles("Toomanyfilesopen").DatahandlingHowdoIsetamissingvalueformydataHowdoIdetermineifmydatacontainsanymissingvalues,orcounthowmanymissingvaluesithasHowdoIchangethemissingvaluetoanothervalueHowdoIdealwithNaN(not-a-number)valuesinmydataHowdoIdealwith"Inf"(infinity)valuesinmydataDataanalysisHowdoIaveragevaluesinamulti-dimensionedarrayHowcanIdoanelement-wiseminimum/maximumbetweentwoarraysofthesamesizeHowdoIinterpolatemy2-dimensionalrandomdatatoa2-dimensionalgriddedarrayHowdoIinterpolatemy3-dimensionalrandomdatatoa3-dimensionalgriddedarrayHowcanIfigureoutifaparticularlatitude/longitudepointiswithinaspecificarea,likeEuropeVisualizationHowcanIcreatean"editable"graphicsfilerequiredforjournalpublicationHowcanImaximizethesizeofaplotintheframeHowdoIgetmultipleplotsonapageWhat'sagoodwaytogenerateacolormap(table)Mymapprojectiondoesn'tlookright.HowdoIchangeallofmyfontstobethesameinmyvisualizationHowcanIchangethetextfunctioncodetosomethingotherthanacolonHowcanIgetadegreesymbolinatextstringHowcanIgetthingslikeaccentsorumlautsovermytextHowcanIgetspecialcharacters,likeGreeksymbols,inmygraphicaltextstringsCanIuserealPostScriptfontsinmyPostScriptfileI'mhavingtroubleimportingaPSfileintoanapplicationlikeAdobeIllustrator.HowcanIgetthelengthofmyaxestobethesameratioastherangeofmyaxesHowdoIchangetheaspectratioorsizeofmymaporplotCanIsetcolorresourcesbycolornameratherthancolorindexvaluesHowcanIspeedupthedrawingoffilledcontoursinNCLCanIchangecolorindexvaluesorcolormapsinmid-frameHowdoIgetmyPostScript/PDFoutputtocovermostofan8-1/2"x11"pageHowcanIcontrolthesizeandlocationoftheX11windowthatNCLbringsupHowdoItellNCLtoignoremissingvaluesinmyplotHowcanIgetmorelabelsonmycontourlinesMyXorYaxisvaluesarenotlinear.HowcanIchangethisHowdoIgetlogscalingoneitherofmyplotaxesHowdoIfillmycontourlevelswithvariousshadingpatternsand/orsolidcolorsHowdoIoverlayacontourplot(oravector/streamlineplot)onamapHowdoIforcethetickmarkstopointinwardI'mtryingtocontrolthetickmarksonthetoporrightaxis,andnothingishappening.HowcanIimprovetheresolutionofmymapoutlinesWhenIdrawamapusingthehigh-resolutionmapdatabase,Iseemtorandomlygetdifferentresolutions.HowcanIgetmoregeographicaloutlinesinmymap,liketheprovincesofChinaIfIamcreatingacolorcontourorvectorplot,howdoIselectmycolorssuchthattheyarespreadacrossmywholecolormapHowdoIgenerateawire-framesurfaceorisosurfaceplotinNCLHowdoIdrawweathersymbols(windbarbs,weatherfrontlines,highandlowpressureindicators,arrows,dots,weathericons,cloudsymbols,lightningbolts,etc.)onamapHowcanIhaveanewlineaspartofagraphicaltextstringinNCLHowcomeIgetdifferentlinethicknessesondifferentoutputdevicesusingthesamethicknessvalueHowcanIputatimestamponmyplotWhyamInotgettingthecolorIexpectwhenIreferenceanamedcolorWhyismylandnotbeingfilledinthecolorIexpectHowdoIsetupmyNCLscriptsothatitusesaresourcefileHowcanImoveandresizemylabelbarand/orlegendHowcanIsettheprecisionofthelabelbarlabelsHowcanIgeneratesome"nice"2Drandomdataforacontourand/orvectorplotArrayfunctionsHowdoIgetthedimensionsofanarrayHowdoIcreateuniquerandomsubscriptsHowdoIeliminatemissingvaluesfromaone-dimensionalarrayHowdoIgenerateaone-dimensionalarrayofequally-spacedintegersorfloatingpointnumbersHowdoIfindorprinttheminimum/maximumvaluesofmydataarrayOutputformatsHowdoIchangethedefaultNCGM/PostScript/PDFfilenametosomethingelseHowdoIconvertmyNCLgraphicsfiletoanotherformat,likePNG,toputontheweborinapresentationHowdoIremoveallthewhitespacefromanimageIsthereawaytomakethePostScriptfilesgeneratedbyNCLsmallerCanIproduceaPNGimagedirectlyfromNCLIsthereawaytoremovethe".000001."fromthePNGfilenameHowcanItiltanNCLgraphicHowcanIconvertaseriesofPSorEPSfilestoananimationHowcanIproduceGoogleEarthkmzfilesHowdoIconvertmymulti-frameNCLgraphicsfiletoanMPEGmoviefileHowdoIincludeanencapsulatedPostScriptfilefromNCLinaLaTexdocumentErrormessagesWhenIrunmyscript,I'mgettinga"fatal:NclMallocFailed"errormessage.WhenIrunNCL,Igetanerrormessageaboutbeingunabletoloadthe"SystemResourceFile".WhenIrunNCL,IgetanerrormessageabouttheXdriver,like"erroropeningdisplay".What'sthedealwiththeerrormessage"error:line-1beforeornear..."HowcanIturnoffNCLwarningmessagesI'mtryingtolistsomefiles,andgettinganerror"Argumentlisttoolong".WhenItrytorunncl,Igetanerrorabout""notbeingfound.I'mtryingtocompilemyNCARGraphicsprogramusingtheIntelorgfortrancompiler,butgettingsomeundefinedreferences.WhenIrunnclversionIgetanerror"warning:ut_calendar:Invalidspecificationstring."WhenIrunncl,Igetanerroraboutlibpngnotbeingcurrent.I'mgettinganerrorfromWRAPITaboutbeingunabletofind"-lgfortran".I'mgettingastrange"workspacereallocation"errormessage.Iamtryingtocreateacontourplotandgettinganerroraboutthescalarfieldbeingconstant.IamtryingtocreateacontourplotandgettingerrorsaboutsfXArrayandsfYArrayhavinganincorrectdimensionsize.I'mgettingan"ARSCAM/ARPRAMALGORITHMFAILURE"errormessage.I'mgettingtheerrormessage"PLCHHQ-CHARACTERNUMBER10(w)ISNOTALEGALFUNCTIONCODE".I'mgettingtheerror"fatal:NhlCvtStringToEnum:Unabletoconvertstring".I'mgettinganerrorfromthe""scriptabout"copy_VarCoords"beinganundefinedprocedure.Whenrunningascriptwithoverlaidplots,I'mgettinganerror"cannotdrawPlotMember".WhenIuseNCL'ssystemfunconaX/Cygwinsystem,Igettheerror"cannotcreatechildprocess".WhenIcompileanNCARGraphicsprogram,Igeterrorsaboutundefinedsymbolslike"_png_set_rows","_png_destroy_write_struct","_png_malloc",etc.WhenIuse"ncargex"or"ncargf77",Igetanerror"cannotfind-lpng".I'mtryingtoassignavaluetoanNCLvariable,butgettinga"righthandsidecan'tbecoercedtotypeoflefthandside"errormessage.I'mcallingNCLfromashellscriptandgettingafatalerroronline-1.I'mgettingan"MDRGSF/MDRGOF-ERROROPENINGRANGS/GSHHSCATFILE"errormessage.I'mtryingtodrawprimitives(markers,lines,polygons)onmyplot,andgettinganerroressage"tfPolyDrawListelement0isinvalid".WhenIcalloneofthegsn_csm_xxxx_mapplottingscripts,Igetanerrormessageaboutaunitsattributenotbeingcorrect.I'mtryingtocreateacontour,vector,orcontourplot,andgettingaweirderroraboutsplineapproximation.WhenIprintsomethinginNCL,IgetanerroraboutmyPAGERenvironmentvariable.MemoryissuesWhat'sthebiggestarraythatNCLcanallocateI'mrunningintoamemoryissuewhenIcreatelotsofstrings.DocumentationIsthereawayIcandownloadtheNCLwebsitedocumentationsoIcanaccessitlocallyonmymachineWherecanIseealistofalltheNCLresourcesWherecanIseealistofalltheNCLfunctionsandproceduresWherecanIseealistoflinkstodashpatterns,markerstyles,colortables,etcMiscellaneousHowshouldIciteNCLHowcanIaddalogotoanNCLplotHowdoIcallaCorFortranfunctionorprocedurefromNCLHowdoImakesurethataC/FortranroutineIwanttowrapdoesn'tconflictwitharoutinethatmightalreadybepartofNCLHowdoIfixbufferingissueswithNCLIfIobscureanNCLX11windowwithanotherapplication,theX11windowdoesn'trefreshwhenIbringitbacktotheforeground.BasicsWherecanIdownloadNCLSeethe

NCLdownloadpage

forfullinstructions.YoucandownloadprecompiledbinariesforaspecificUNIXsystem,orsourcecode.I'mhavingproblemsdownloadingNCLfromtheESGwebsite.Pleaseseeour

ESGtroubleshootingguide

forhelp.Ifthisdoesn'thelp,thensendemailtothe

ncl-install

emaillist.HowdoIsetupmyenvironmenttorunNCLSettheNCARG_ROOTenvironmentvariableandyoursearchpathtowhereNCL/NCARGresidesInordertousethesoftware,youmustsetyourNCARG_ROOTenvironmentvariabletotheparentdirectorywheretheNCLexecutablesandaccompanyingfileswereinstalled.YoualsoneedtomakesurethatthedirectorywheretheNCL/NCARGexecutablesresideareonyoursearchpath.Itisbesttodothisfromoneofyour.*filesinyourhomedirectory.Ifyouarenotsurewhichshellyouarerunning,youcandoan"ls-a"inyourhomedirectorytoseewhatkindoffilesyouhavethatstartwith".",andthenlookinthesefilestoseehowenvironmentvariablesareset.Intheexampleabove,wewouldsetthesewiththefollowing:FromC-shell(csh):setenvNCARG_ROOT/usr/localsetenvPATH=/usr/local/bin:$PATHFrombashorksh:exportNCARG_ROOT=/usr/localexportPATH=/usr/local/bin:$PATHFromsh:NCARG_ROOT=/usr/localPATH=/usr/local/bin:$PATHexportNCARG_ROOTexportPATHYoushouldnowbesetforusingNCLand/orNCARGraphics.Ifyouhaveanyproblems,orquestionsaboutinstallingNCLfromsourcecodeorbinaries,pleasesendemailto

(youneedtosubscribefirst).SettheDISPLAYenvironmentvariabletoindicatewheretodisplaygraphicsThisisnotanNCLspecificenvironmentvariable,butratheronethatisusedbyanyX11Windowsapplicationthatyourun.ForNCLorNCARGraphics,itisneededwhenyoudisplayyourgraphicstoanX11window,orifyouuse

ictrans,

ctrans,or

idt

toviewyour

NCGM

files.ThisvariablemustbesettotheIPaddressornameofthemachineyouwanttodisplayyourgraphicson,forexample"localhost:".Ifyouarenotrunningonaremotemachine,thenyoucantrysettingitto":".Pleasecontactyoursystemadministratorifyouarenotsurewhattosetitto.Forexample,fromC-shell(csh):setenvDISPLAY:setenvDISPLAY:0setenvDISPLAYlocalhost:Frombash:exportDISPLAY=:exportDISPLAY=:0exportDISPLAY=localhost:Puta".hluresfile"fileinyourhomedirectoryInordertobettercustomizetheNCLgraphicalenvironment,wehighlyrecommendthatyoucopya.hluresfile

toyourhomedirectory.Youcancustomizethisfiletoyourliking,butataminimum,youwanttochangethedefaultfont,thedefaultcolortable,andthetextfunctioncode.Specialinstructionsifyouhavean

OPeNDAP-enabledversionofNCL[Youdon'tneedtoworryabouttheseinstructionsifyouarenotusingOPenDAP.]OPeNDAP-enabledbinariesrequiresomelibrariestobeinstalledonyourhostcomputer:SecureSocketsLayer

(SSL)libraryOPeNDAP

librariesOnceyouhavetheselibraries,youmayberequiredtosettheenvironmentvariableLD_LIBRARY_PATH(DYLD_LIBRARY_PATHforMacs)tocontainthedirectorywheretheyarelocatedonyourhostsysteminorderforOPeNDAP-enabledversionsofNCLtoworkproperly.HowdoIrunNCLOnceyouhaveNCLinstalled,youcanrunitinteractivelybytypingontheUNIXcommandline:nclThiswillechosomeinformationtothescreen,andgiveyouaprompt:Copyright(C)1995-2008-AllRightsReservedUniversityCorporationforAtmosphericResearchNCARCommandLanguageVersionTheuseofthissoftwareisgovernedbyaLicenseAgreement.Seeformoredetails.ncl0>Toquitoutofinteractivemode,type"quit"(withoutthedoublequotes).TorunNCLonanexistingNCLscriptcalled"",typeontheUNIXcommandline:nclHowdoIdeterminetheversionofNCLTheversionnumberisechoedwheneveryourunNCL.Youcanalsotype"ncl-V"ontheUNIXcommandlinetogettheversionnumber.ArethereanyemaillistsIcanjoinYes.ForbasicquestionsaboutinstallingNCLandsettingupyourenvironmenttouseit:allotherquestionsonNCL:questionsrelatingspecificallytoNCARGraphics:canIseesomeexamplesofhowtouseNCLToseehundredsofNCLapplicationexamples,seethe

categorylistofapplicationpages.TheseexamplesarefullNCLscriptsthatyoucandownload.Someofthe

datasets

areprovidedasaseparatelink.IfyouareacompletebeginnertoNCL,thenthere'sa

tutorialwithexamples

thataredescribedline-by-line.ArethereanyNCLcommandlineoptionsIcanuseYes,seethe"NCLcommandlineoptions"sectioninthe

NCLReferenceManual.ArethereanyeditorenhancementsforeditingNCLscriptsYes,seethe

supportpage

foralist.IfI'mrunningNCLinteractively,arethereanycommand-lineshortcutsIcanuseThereareshortcutsthatallowyoutonavigatethroughpreviouscommandsandeditthem.Formoreinformation,gotothe"NCLCommandLineShortcuts"sectioninthe

NCLReferenceManual.IfI'mrunninginteractively,howcanIloadsomeexistingNCLcodeYoucanusethe

loadscript

procedure,whereyougiveitthenameofthefilethatcontainsNCLcommands.IsthereanywayIcanturnoffthepreceding"(n)"outputwhenIprintabunchofvaluesIfyouareusing

print

toprintsomevalues,andyouseeoutputlikethis:Variable:xType:floatTotalSize:80bytes20valuesNumberofDimensions:1Dimensionsandsizes:[20]Coordinates:(0)0(1)(2)(3)(4)(5)...thenyoucangetridofthe"(0)","(1)",etc,byusingthe

"-n"commandlineoption

whenyouinvoke"ncl".Youroutputwillthenlooklike:Variable:xType:floatTotalSize:80bytes20valuesNumberofDimensions:1Dimensionsandsizes:[20]Coordinates:0...MyNCLscriptisquittingsuddenly,andI'mnotsurewhereand/orwhy.IfyouarerunninganNCLscriptandgettinga"buserror"or"segmentationfault"(whichtechnicallyshouldn'thappen,butdoesonoccasion),thentrycommentingoutyour"begin"and"end"statementforthemaincode,andrunningyourscriptwiththe

"-x"commandlineoption:ncl-xThiswillcauseeverylineofyourscripttobeechoedtothescreen,andyouwillbeabletoseewhereitisquittingsuddenly.HowdoItellifIhaveanOPeNDAP-enabledNCLAquickwayistodoan"ldd"or"otool-L"onthe"ncl"executabletoseeifitreferenceslibrarieslike""and"".ThiswillindicateyourversionofNCLwasbuiltwith

OPeNDAP

capabilitiesenabled:ldd`whichncl`Youshouldseeoutputlike:=>/usr/local/lib/(0x0000002a)=>/usr/local/lib/(0x0000002a956ee000)=>/usr/local/lib/(0x0000002a958b9000)Here'sshorttesttoseeifyourOPeNDAP-enabledNCLisworking.NotethatyoumustbeonasystemthatallowsOPeNDAPaccess:url=""filename=""exists=isfilepresent(url+filename)if(.thenprint("OPeNDAPisfilepresenttestunsuccessful.")print("Eitheryoudon'thavetheappropriatepermissionstoaccessOPeNDAPservers,orNCLdoesnothaveOPeNDAPcapabilitiesonthissystem")status_exit(1)elseprint("OPeNDAPisfilepresenttestsuccessful.")f=addfile(url+filename,"r")vars=getfilevarnames(f)vars_out=(/"l","j","i","cross","aloan","shot","order","bears"/)sqsort(vars)sqsort(vars_out)print(vars);Thesetwolistsshouldprint(vars_out);bethesame.endifNCLcorelanguageHowdoIcommentalineinNCLIsthereawaytohaveablockofcommentsThecommentcharacterinNCLisasemicolon(';').YoucanuseitonalinebyitselforafteranNCLcommand:;Hereisacommentbeforeacommandthatassignsavariable.x=5.x=5.;ThiscommentcanbeattheendofalineUnfortunately,thereisnowaytodesignateablockofcomments,otherthanputtingsemicolonsinfrontofallthelines:;;Thisisablockofcomments,;eachofwhichmustbe;precededbyitsownsemicolon;IsthereacontinuationcharacterinNCLYes,youcanusethe'\'character:x=(/"This","is","a","long","array","of","strings","that",\"we","can","continue","on","a","new","line","with","a",\"\","character."/);Canuse\forarithmeticexpressionsoutput(i,1:n-2)=(p4)*(var(i-1,1:n-2)+var(i,2:n-1)+\var(i+1,1:n-2)+var(i,0:n-3))+\(q4)*(var(i-1,0:n-3)+var(i-1,2:n-1)+\var(i+1,2:n-1)+var(i+1,0:n-3))HowdoIeasilyconvertanumbertoastringUsethe'+'stringconcatenator:x

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论