[ncl-install] [ncl-talk] adding multiple files

Dawit Abebe dawit.kan at gmail.com
Sun Apr 2 18:15:28 MDT 2017


Dear Shea,

Thank you so much. I managed to concatenate my files into one big file using NCO. 

Dawit


> On Apr 1, 2017, at 9:04 PM, Dennis Shea <shea at ucar.edu> wrote:
> 
> [1] 
> Please subscribe to ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
> No further 'applications' related questions will be answered on this list.
> 
> [2] 
> I have placed a version of the CRU data that spans all years at:
> 
>   ftp ftp.cgd.ucar.edu <http://ftp.cgd.ucar.edu/>
>   anonymous
>   your_email
>   cd pub/shea
>   ls
>   prompt
>   get cru_ts3.23.1901.2014.pet.dat.nc.gz
>   quit
> 
> [3]
> NCL will not unzip the data. You must do that!
> 
> %> gzip -d cru_ts3.23.1901.2014.pet.dat.nc.gz
> 
> [4]
> BEFORE DOING ANYTHING: ***LOOK AT THE DATA FILE! ***
> 
> %> ncdump -h cru_ts3.23.1901.2014.pet.dat.nc <http://cru_ts3.23.1901.2014.pet.dat.nc/> | less
> 
> or
> 
> %> ncl_filedump cru_ts3.23.1901.2014.pet.dat.nc <http://cru_ts3.23.1901.2014.pet.dat.nc/> | less
> 
> Look at dimension sizes; look at variable names; look at units; look at variable types; look at global attributes.
> 
> After doing that .... look some more!!!!
> 
> [5] 
> Extract **and*** examine extracted the variable.  Use NCL syntax for coordinate variables:  {...}
> 
>    latS = ...          ; latitudes span -89.87 to 89.75
>    latN = ...
>    lonL = ...         ; longitudes span -179.75 to 179.75
>    lonR = ...
> 
>    f = addfile("cru_ts3.23.1901.2014.pet.dat.nc <http://cru_ts3.23.1901.2014.pet.dat.nc/>" ,"r")
>    x = f->pet(:,{latS:latN},{lonL:lonR})                    
>    printVarSummary(x)
>    printMinMax(x)
>    print("----")
> 
> ; http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml <http://www.ncl.ucar.edu/Document/Functions/Contributed/stat_dispersion.shtml> 
>   opt = True
>   opt at PrintStat = True
>   stats = stat_dispersion(x, opt )
>   
> [6] 
> Please read NCL documentation:   http://www.ncl.ucar.edu/Document/ <http://www.ncl.ucar.edu/Document/>
> 
> In particular: the following tutorial may be of some help to you.
>      http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/ <http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/>
> 
> 
> On Sat, Apr 1, 2017 at 10:24 AM, Dawit Abebe <dawit.kan at gmail.com <mailto:dawit.kan at gmail.com>> wrote:
> Hi Rick,
> 
> Thanks for trying to help but it is frustrating! 
> 
> The data is from CRU version 3.23 precipitation downloaded by subsetting for the region I am interested with from the Ceda Oge Web Services/Web Processing Service (http://wps-web1.ceda.ac.uk/ <http://wps-web1.ceda.ac.uk/>) <http://wps-web1.ceda.ac.uk/jobviewer?status_url=http://wps-web1.ceda.ac.uk/status/00fec680f736dbd74b73af2425e3966e>. As a second option I download the entire dataset (Global) from http://data.ceda.ac.uk/badc/cru/data/cru_ts/cru_ts_3.23/data/pre/ <http://data.ceda.ac.uk/badc/cru/data/cru_ts/cru_ts_3.23/data/pre/>  and add to NCL and subset the section I am interested using coordinate subsetting command. My problem with this is the file is in zip format (cru_ts3.23.1901.2014.pre.dat.nc.gz) and I am wondering if it can be called to NCL as it is or need to be unzipped. If it should be unzipped, how to do it?
> 
> Do you have any advice how I should do this?
> 
> I would appreciate your help so much.
> 
> Dawit
>  
> 
> On Apr 1, 2017, at 7:03 PM, Rick Brownrigg <brownrig at ucar.edu <mailto:brownrig at ucar.edu>> wrote:
>> 
>> Hi Dawit,
>> 
>> First, I apologize -- I overlooked that you state in your original message that you are getting the error for *all* the files, not just the 199501 file?
>> 
>> In any case, I was able to open that file just fine, which would echo what you were saying about opening a file with the singular "addfile()" command.  I was also able to open just that one file with the multi "addfiles()" command as well.  Whats a bit puzzling is that the error message does not contain the leading "./" on the filename as it should.  If the files are in your current working directory, that should not matter. Nonetheless it might be useful to print several things before the addfiles() statement, just to make sure the values are what we think they should be:
>> 
>> print(diri)
>> print(files)
>> print(diri + files)
>> 
>> I'm not sure what else to tell you. BTW: I'm using NCL 6.4.0; what version are you using?
>> 
>> Wish I could be of more help...
>> Rick
>> 
>> On Sat, Apr 1, 2017 at 9:34 AM, Dawit Abebe <dawit.kan at gmail.com <mailto:dawit.kan at gmail.com>> wrote:
>> Dear Rick,
>> 
>> I think uploaded the file
>> 
>> Thanks for your help
>> 
>> Dawit
>> 
>>> On Apr 1, 2017, at 6:09 PM, Rick Brownrigg <brownrig at ucar.edu <mailto:brownrig at ucar.edu>> wrote:
>>> 
>>> Yes, put refers to the filename you want to send; the command:
>>> 
>>>     put pre_199501_mondat.nc <http://pre_199501_mondat.nc/>
>>> 
>>> will upload the file to the ftp server.
>>> 
>>> 
>>> 
>>> On Sat, Apr 1, 2017 at 8:47 AM, Dawit Abebe <dawit.kan at gmail.com <mailto:dawit.kan at gmail.com>> wrote:
>>> Dear Rick,
>>> 
>>> Sorry I am bothering you, what is put…put…refers to, is it the files?
>>> 
>>> Dawit
>>> 
>>> 
>>>> On Apr 1, 2017, at 5:13 PM, Rick Brownrigg <brownrig at ucar.edu <mailto:brownrig at ucar.edu>> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> It sounds like that one file in particular, "pre_199501_mondat.nc <http://pre_199501_mondat.nc/>", is corrupt. I note that it is not the same file as the single file instance that you cited, and I *think* NCL would have ingested all the files from 1901 up to the 199501 before throwing the error. Are you able to open the file with the ncl_filedump command, or any of the NCO/CDO operators?  If you want to send it to our ftp site, I'll take a look at it (instructions below).
>>>> 
>>>> Rick
>>>> 
>>>> 
>>>> You can ftp larger datasets and files to:
>>>> 
>>>> ftp ftp.cgd.ucar.edu <http://ftp.cgd.ucar.edu/>
>>>> anonymous
>>>> <use your email address for the password>
>>>> cd incoming
>>>> put ...
>>>> put ...
>>>> . 
>>>> . 
>>>> . 
>>>> quit
>>>> Note that for security reasons, you cannot list the contents of this directory, and neither can we. We need to know the exact names of the files in order to retrieve them.
>>>> 
>>>> 
>>>> On Sat, Apr 1, 2017 at 7:40 AM, Dawit Abebe <dawit.kan at gmail.com <mailto:dawit.kan at gmail.com>> wrote:
>>>> Dear NCL users,
>>>> 
>>>> I’m having a challenge to add multiple files to NCL. I’m intending to work on monthly files ranging from 1901 - 2014. I tried the command below but failed.  
>>>> 
>>>> Command used
>>>> 
>>>> 	diri = "./"                     
>>>> ncl 29> files = systemfunc("ls *.nc")   
>>>> ncl 30> f     = addfiles(diri+files, "r")
>>>> 
>>>> Return message for all files
>>>> 
>>>> warning:_NclOpenFile: Can not open file <pre_199501_mondat.nc <http://pre_199501_mondat.nc/>>; file format not supported or file is corrupted
>>>> 
>>>> 
>>>> The command and return for single file seems working as showed bellow: 
>>>> 
>>>> ncl 10> diri = "./"
>>>> ncl 11> fili = "pre_201412_mondat.nc <http://pre_201412_mondat.nc/>"  
>>>> ncl 12> f    = addfile(diri+fili, "r")
>>>> ncl 13> prc = f->pre                                                
>>>> ncl 14> printVarSummary(prc)
>>>> 
>>>> Variable: prc
>>>> Type: double
>>>> Total Size: 288 bytes
>>>>             36 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes:	[time | 1] x [lat | 4] x [lon | 9]
>>>> Coordinates: 
>>>>             time: [41987..41987]
>>>>             lat: [3.75..5.25]
>>>>             lon: [36.75..40.75]
>>>> Number Of Attributes: 5
>>>>   correlation_decay_distance :	 450
>>>>   long_name :	precipitation
>>>>   units :	mm/month
>>>>   missing_value :	9.96920996839e+36
>>>>   _FillValue :	9.96920996839e+36
>>>> 
>>>> Where is my problem?
>>>> 
>>>> Thanks
>>>> Dawit
>>>> 
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk <http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> _______________________________________________
> ncl-install mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-install <http://mailman.ucar.edu/mailman/listinfo/ncl-install>
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-install/attachments/20170403/60fbfbd2/attachment-0001.html 


More information about the ncl-install mailing list