<div dir="ltr">Hi Dave,<div>See the attachment containing capethermo at the bottom of a previous ncl-talk thread here:</div><div><a href="http://www.ncl.ucar.edu/Support/talk_archives/2007/0535.html">http://www.ncl.ucar.edu/Support/talk_archives/2007/0535.html</a><br></div><div>If you have further questions please post them to the ncl-talk email list.</div><div>Adam</div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 19, 2018 at 11:29 AM David Adams <<a href="mailto:dave.k.adams@gmail.com">dave.k.adams@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Tanya et al.<br></div><div class="gmail_default" style="font-size:small">related to Soma´s question. Where can I find the actual code that ncl uses to calculate CAPE, LCL, etc? <br></div><div class="gmail_default" style="font-size:small">I use the ncl skewT plot all of the time, but Cape depends critically on which parcel is lifted and whether it´s a reversible or pseudoadiabatic process etc.... So it would be good to know how it´s being calcuated.<br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">thanks,</div><div class="gmail_default" style="font-size:small">Dave<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Jul 19, 2018 at 12:11 PM Tanya Peevey <<a href="mailto:trpeevey@gmail.com" target="_blank">trpeevey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Soma,<div><br></div><div>There is a function in NCL to plot a skew-T diagram and it is skewT_PlotData.<br>
</div><div><br></div><div>Tanya</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 12:00 PM <<a href="mailto:ncl-talk-request@ucar.edu" target="_blank">ncl-talk-request@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send ncl-talk mailing list submissions to<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:ncl-talk-request@ucar.edu" target="_blank">ncl-talk-request@ucar.edu</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:ncl-talk-owner@ucar.edu" target="_blank">ncl-talk-owner@ucar.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of ncl-talk digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re: Save in netcdf (Dennis Shea)<br>
2. Re: Save in netcdf (Soma Roy)<br>
3. Re: Save in netcdf (Be?ta Szab?-Tak?cs)<br>
4. Re: Save in netcdf (Soma Roy)<br>
5. Vertical wind shear calculation within 400 km radius of TC<br>
(Md. Jalal Uddin)<br>
6. Re: Vertical wind shear calculation within 400 km radius of<br>
TC (Rick Brownrigg)<br>
7. Skew-T diagram (Soma Roy)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Wed, 18 Jul 2018 00:44:24 -0600<br>
From: Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
To: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>><br>
Cc: "<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Save in netcdf<br>
Message-ID:<br>
<CAOF1d_4DBES=<a href="mailto:Ddz_VgcO%2B9yd3ykWYzUJ6MftxpKuyeZ4eQTr1Q@mail.gmail.com" target="_blank">Ddz_VgcO+9yd3ykWYzUJ6MftxpKuyeZ4eQTr1Q@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
;---Read needed variables from file<br>
<br>
itStrt = 9 ;<br>
itLast = 12<br>
lonStrt = 20<br>
lonLast = 100<br>
<br>
u = short2flt(in->u(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
SPH = short2flt(in1->q(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
printVarSummary(u)<br>
<br>
;===> NO: lat=in->latitude(::-1) Do not explicitly read from<br>
file<br>
:===> NO: lon=in->longitude(20:100) NCL does the book keeping<br>
;===> NO: time=in->time(09:12) as part of data structure/object<br>
input<br>
<br>
u&level = u&level*100 ; over write with new values<br>
u&level@units = "Pa"<br>
printVarSummary(u) ; LOOK at this<br>
<br>
;--- Zonal moisture transport<br>
---------------------------------------------------------------------<br>
ZMT=u*SPH ; not<br>
appropriate to use monthly means for<br>
<br>
; for a non-linear quantity<br>
ZMT@long_name = "zonal moisture transport"<br>
ZMT@units="(m/s)(kg/kg)"<br>
copy_VarCoords(u, ZMT)<br>
printVarSummary(ZMT)<br>
<br>
---<br>
Use Method 1 to write netCDF ... easier<br>
<br>
filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
<br>
* system* <<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml</a>>("/bin/rm<br>
-f <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>") ; remove any pre-existing file<br>
<br>
fout = addfile (filo, "c") ; open output file<br>
<br>
;===================================================================<br>
; create global attributes of the file<br>
<br>
fAtt = True ; assign file attributes<br>
fAtt@title = "NCL Simple Approach to netCDF Creation"<br>
fAtt@source_file = "uvwtz_Dec2016.nc"<br>
fAtt@Conventions = "None"<br>
fAtt@creation_date = systemfunc ("date")<br>
fileattdef( fout, fAtt ) ; copy file attributes<br>
<br>
;===================================================================<br>
; make time an UNLIMITED dimension; recommended for most applications<br>
;===================================================================<br>
*filedimdef*<br>
<<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml</a>>(ncdf,"time",-1,True)<br>
<br>
fout->ZMT = ZMT ; 4D<br>
<br>
<br>
On Tue, Jul 17, 2018 at 11:05 AM, Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>> wrote:<br>
<br>
> It again shows the following error message;<br>
><br>
> fatal:Variable (lev) is undefined<br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 44 in<br>
> file TEST1.ncl<br>
><br>
> 'latitude', 'longitude', 'level' and 'time' are named as variable's<br>
> dimensions in input file which is very clear from printVarSummary of the<br>
> data. I modified the code as per your hints. Modified code is attached<br>
> below. Kindly inform me where I am doing wrong again.<br>
><br>
><br>
> Thanks,<br>
> Soma<br>
><br>
> On Tue, Jul 17, 2018 at 10:09 PM, Karin Meier-Fleischer <<br>
> <a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>> wrote:<br>
><br>
>> Hi Soma,<br>
>><br>
>> please, reply always to ncl-talk that everybody is able to follow.<br>
>><br>
>> The problem is, that you changed the name of the level dimension to lev.<br>
>> ZMT has the dimension name level. Change lev to level and it should work or<br>
>><br>
>> ZMT!1 = "lev"<br>
>> ZMT&lev = lev<br>
>><br>
>> -Karin<br>
>><br>
>> Am 17.07.18 um 14:06 schrieb Soma Roy:<br>
>><br>
>> In the directory there is no file named as <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>.<br>
>> It is created at the run time.<br>
>><br>
>> Now I am getting the following error massage;<br>
>><br>
>> FileAddVar, in file: NclFile.c, line: 412<br>
>> fatal:FileAddVar: Dimension (level) is not currently defined, can't add<br>
>> variable<br>
>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 77 in<br>
>> file TEST1.ncl<br>
>><br>
>> Kindly inform me what I am doing wrong in this.<br>
>><br>
>> Thanking you,<br>
>> Soma<br>
>><br>
>><br>
>> On Tue, Jul 17, 2018, 16:31 Karin Meier-Fleischer <<br>
>> <a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>> wrote:<br>
>><br>
>>> Hi Soma,<br>
>>><br>
>>> if the file <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a> already exists NCL can't create a new one with<br>
>>> the same name. You have to remove the file, first.<br>
>>><br>
>>> filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
>>> * system("rm -rf "+filo)*<br>
>>> fout = addfile (filo, "c") ; open output file<br>
>>><br>
>>> -Karin<br>
>>><br>
>>> Am 17.07.18 um 12:22 schrieb Soma Roy:<br>
>>><br>
>>> I am trying to save the variable ZMT in NetCDF file following the<br>
>>> instructions at the below-mentioned link;<br>
>>><br>
>>> <a href="http://www.ncl.ucar.edu/Applications/method_2.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applications/method_2.shtml</a><br>
>>><br>
>>> Summary of the dataset is as follows;<br>
>>><br>
>>> Variable: lat<br>
>>> Type: float<br>
>>> Total Size: 244 bytes<br>
>>> 61 values<br>
>>> Number of Dimensions: 1<br>
>>> Dimensions and sizes: [latitude | 61]<br>
>>> Coordinates:<br>
>>> latitude: [ 5..20]<br>
>>> Number Of Attributes: 2<br>
>>> units : degrees_north<br>
>>> long_name : latitude<br>
>>><br>
>>> Variable: lon<br>
>>> Type: float<br>
>>> Total Size: 324 bytes<br>
>>> 81 values<br>
>>> Number of Dimensions: 1<br>
>>> Dimensions and sizes: [longitude | 81]<br>
>>> Coordinates:<br>
>>> longitude: [70..90]<br>
>>> Number Of Attributes: 2<br>
>>> units : degrees_east<br>
>>> long_name : longitude<br>
>>><br>
>>> Variable: time<br>
>>> Type: integer<br>
>>> Total Size: 16 bytes<br>
>>> 4 values<br>
>>> Number of Dimensions: 1<br>
>>> Dimensions and sizes: [time | 4]<br>
>>> Coordinates:<br>
>>> time: [1025088..1025160]<br>
>>> Number Of Attributes: 3<br>
>>> units : hours since 1900-01-01 00:00:0.0<br>
>>> long_name : time<br>
>>> calendar : gregorian<br>
>>><br>
>>><br>
>>> Variable: pnew<br>
>>> Type: integer<br>
>>> Total Size: 112 bytes<br>
>>> 28 values<br>
>>> Number of Dimensions: 1<br>
>>> Dimensions and sizes: [level | 28]<br>
>>> Coordinates:<br>
>>> level: [70..1000]<br>
>>> Number Of Attributes: 2<br>
>>> units : Pa<br>
>>> long_name : pressure_level<br>
>>> (0) 7000<br>
>>> (1) 10000<br>
>>> (2) 12500<br>
>>> (3) 15000<br>
>>> ..........<br>
>>> (26) 97500<br>
>>> (27) 100000<br>
>>><br>
>>> Variable: ZMT<br>
>>> Type: float<br>
>>> Total Size: 2213568 bytes<br>
>>> 553392 values<br>
>>> Number of Dimensions: 4<br>
>>> Dimensions and sizes: [time | 4] x [level | 28] x [latitude | 61] x<br>
>>> [longitude | 81]<br>
>>> Coordinates:<br>
>>> time: [1025088..1025160]<br>
>>> level: [70..1000]<br>
>>> latitude: [ 5..20]<br>
>>> longitude: [70..90]<br>
>>> Number Of Attributes: 3<br>
>>> units : (m/s)(kg/kg)<br>
>>> long_name : zonal moisture transport<br>
>>> _FillValue : -32767<br>
>>><br>
>>> At run-time, I am getting the following error message;<br>
>>><br>
>>> fatal:Could not create (<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>)<br>
>>> warning:FileSetFileOption: invalid file or format<br>
>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 65 in<br>
>>> file TEST1.ncl<br>
>>><br>
>>> My script is attached below.<br>
>>><br>
>>> Please kindly inform me what is wrong with this code and how to fix it.<br>
>>><br>
>>> Thanking you,<br>
>>> Soma<br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> ncl-talk mailing <a href="mailto:listncl-talk@ucar.edu" target="_blank">listncl-talk@ucar.edu</a><br>
>>> List instructions, subscriber options, unsubscribe:<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>>><br>
>>><br>
>>> _______________________________________________<br>
>>> ncl-talk mailing list<br>
>>> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
>>> List instructions, subscriber options, unsubscribe:<br>
>>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>>><br>
>><br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/32cfd5f9/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/32cfd5f9/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Wed, 18 Jul 2018 13:23:56 +0530<br>
From: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>><br>
To: Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
Cc: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Save in netcdf<br>
Message-ID:<br>
<<a href="mailto:CAAJRSQd4RiU7Ro9m%2Bar56R7eKcdtKWTVWqRNdp_eJdAcyBt2Yg@mail.gmail.com" target="_blank">CAAJRSQd4RiU7Ro9m+ar56R7eKcdtKWTVWqRNdp_eJdAcyBt2Yg@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
I am getting the following error message after running the attached code.<br>
<br>
fatal:Variable (ncdf) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 50 in file<br>
Test2.ncl<br>
<br>
Modified code as per easier method is attached below.<br>
<br>
Let me know what is wrong in this code.<br>
<br>
Thanks,<br>
Soma<br>
<br>
On Wed, Jul 18, 2018, 12:14 Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br>
<br>
> ;---Read needed variables from file<br>
><br>
> itStrt = 9 ;<br>
> itLast = 12<br>
> lonStrt = 20<br>
> lonLast = 100<br>
><br>
> u = short2flt(in->u(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
> SPH = short2flt(in1->q(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
> printVarSummary(u)<br>
><br>
> ;===> NO: lat=in->latitude(::-1) Do not explicitly read from<br>
> file<br>
> :===> NO: lon=in->longitude(20:100) NCL does the book keeping<br>
> ;===> NO: time=in->time(09:12) as part of data<br>
> structure/object input<br>
><br>
> u&level = u&level*100 ; over write with new values<br>
> u&level@units = "Pa"<br>
> printVarSummary(u) ; LOOK at this<br>
><br>
> ;--- Zonal moisture transport<br>
> ---------------------------------------------------------------------<br>
> ZMT=u*SPH ; not<br>
> appropriate to use monthly means for<br>
><br>
> ; for a non-linear quantity<br>
> ZMT@long_name = "zonal moisture transport"<br>
> ZMT@units="(m/s)(kg/kg)"<br>
> copy_VarCoords(u, ZMT)<br>
> printVarSummary(ZMT)<br>
><br>
> ---<br>
> Use Method 1 to write netCDF ... easier<br>
><br>
> filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
><br>
> * system* <<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml</a>>("/bin/rm -f <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>") ; remove any pre-existing file<br>
><br>
> fout = addfile (filo, "c") ; open output file<br>
><br>
> ;===================================================================<br>
> ; create global attributes of the file<br>
><br>
> fAtt = True ; assign file attributes<br>
> fAtt@title = "NCL Simple Approach to netCDF Creation"<br>
> fAtt@source_file = "uvwtz_Dec2016.nc"<br>
> fAtt@Conventions = "None"<br>
> fAtt@creation_date = systemfunc ("date")<br>
> fileattdef( fout, fAtt ) ; copy file attributes<br>
><br>
> ;===================================================================<br>
> ; make time an UNLIMITED dimension; recommended for most applications<br>
> ;===================================================================<br>
> *filedimdef* <<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml</a>>(ncdf,"time",-1,True)<br>
><br>
> fout->ZMT = ZMT ; 4D<br>
><br>
><br>
> On Tue, Jul 17, 2018 at 11:05 AM, Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>> wrote:<br>
><br>
>> It again shows the following error message;<br>
>><br>
>> fatal:Variable (lev) is undefined<br>
>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 44 in<br>
>> file TEST1.ncl<br>
>><br>
>> 'latitude', 'longitude', 'level' and 'time' are named as variable's<br>
>> dimensions in input file which is very clear from printVarSummary of the<br>
>> data. I modified the code as per your hints. Modified code is attached<br>
>> below. Kindly inform me where I am doing wrong again.<br>
>><br>
>><br>
>> Thanks,<br>
>> Soma<br>
>><br>
>> On Tue, Jul 17, 2018 at 10:09 PM, Karin Meier-Fleischer <<br>
>> <a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>> wrote:<br>
>><br>
>>> Hi Soma,<br>
>>><br>
>>> please, reply always to ncl-talk that everybody is able to follow.<br>
>>><br>
>>> The problem is, that you changed the name of the level dimension to lev.<br>
>>> ZMT has the dimension name level. Change lev to level and it should work or<br>
>>><br>
>>> ZMT!1 = "lev"<br>
>>> ZMT&lev = lev<br>
>>><br>
>>> -Karin<br>
>>><br>
>>> Am 17.07.18 um 14:06 schrieb Soma Roy:<br>
>>><br>
>>> In the directory there is no file named as <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>.<br>
>>> It is created at the run time.<br>
>>><br>
>>> Now I am getting the following error massage;<br>
>>><br>
>>> FileAddVar, in file: NclFile.c, line: 412<br>
>>> fatal:FileAddVar: Dimension (level) is not currently defined, can't add<br>
>>> variable<br>
>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 77 in<br>
>>> file TEST1.ncl<br>
>>><br>
>>> Kindly inform me what I am doing wrong in this.<br>
>>><br>
>>> Thanking you,<br>
>>> Soma<br>
>>><br>
>>><br>
>>> On Tue, Jul 17, 2018, 16:31 Karin Meier-Fleischer <<br>
>>> <a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>> wrote:<br>
>>><br>
>>>> Hi Soma,<br>
>>>><br>
>>>> if the file <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a> already exists NCL can't create a new one with<br>
>>>> the same name. You have to remove the file, first.<br>
>>>><br>
>>>> filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
>>>> * system("rm -rf "+filo)*<br>
>>>> fout = addfile (filo, "c") ; open output file<br>
>>>><br>
>>>> -Karin<br>
>>>><br>
>>>> Am 17.07.18 um 12:22 schrieb Soma Roy:<br>
>>>><br>
>>>> I am trying to save the variable ZMT in NetCDF file following the<br>
>>>> instructions at the below-mentioned link;<br>
>>>><br>
>>>> <a href="http://www.ncl.ucar.edu/Applications/method_2.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applications/method_2.shtml</a><br>
>>>><br>
>>>> Summary of the dataset is as follows;<br>
>>>><br>
>>>> Variable: lat<br>
>>>> Type: float<br>
>>>> Total Size: 244 bytes<br>
>>>> 61 values<br>
>>>> Number of Dimensions: 1<br>
>>>> Dimensions and sizes: [latitude | 61]<br>
>>>> Coordinates:<br>
>>>> latitude: [ 5..20]<br>
>>>> Number Of Attributes: 2<br>
>>>> units : degrees_north<br>
>>>> long_name : latitude<br>
>>>><br>
>>>> Variable: lon<br>
>>>> Type: float<br>
>>>> Total Size: 324 bytes<br>
>>>> 81 values<br>
>>>> Number of Dimensions: 1<br>
>>>> Dimensions and sizes: [longitude | 81]<br>
>>>> Coordinates:<br>
>>>> longitude: [70..90]<br>
>>>> Number Of Attributes: 2<br>
>>>> units : degrees_east<br>
>>>> long_name : longitude<br>
>>>><br>
>>>> Variable: time<br>
>>>> Type: integer<br>
>>>> Total Size: 16 bytes<br>
>>>> 4 values<br>
>>>> Number of Dimensions: 1<br>
>>>> Dimensions and sizes: [time | 4]<br>
>>>> Coordinates:<br>
>>>> time: [1025088..1025160]<br>
>>>> Number Of Attributes: 3<br>
>>>> units : hours since 1900-01-01 00:00:0.0<br>
>>>> long_name : time<br>
>>>> calendar : gregorian<br>
>>>><br>
>>>><br>
>>>> Variable: pnew<br>
>>>> Type: integer<br>
>>>> Total Size: 112 bytes<br>
>>>> 28 values<br>
>>>> Number of Dimensions: 1<br>
>>>> Dimensions and sizes: [level | 28]<br>
>>>> Coordinates:<br>
>>>> level: [70..1000]<br>
>>>> Number Of Attributes: 2<br>
>>>> units : Pa<br>
>>>> long_name : pressure_level<br>
>>>> (0) 7000<br>
>>>> (1) 10000<br>
>>>> (2) 12500<br>
>>>> (3) 15000<br>
>>>> ..........<br>
>>>> (26) 97500<br>
>>>> (27) 100000<br>
>>>><br>
>>>> Variable: ZMT<br>
>>>> Type: float<br>
>>>> Total Size: 2213568 bytes<br>
>>>> 553392 values<br>
>>>> Number of Dimensions: 4<br>
>>>> Dimensions and sizes: [time | 4] x [level | 28] x [latitude | 61] x<br>
>>>> [longitude | 81]<br>
>>>> Coordinates:<br>
>>>> time: [1025088..1025160]<br>
>>>> level: [70..1000]<br>
>>>> latitude: [ 5..20]<br>
>>>> longitude: [70..90]<br>
>>>> Number Of Attributes: 3<br>
>>>> units : (m/s)(kg/kg)<br>
>>>> long_name : zonal moisture transport<br>
>>>> _FillValue : -32767<br>
>>>><br>
>>>> At run-time, I am getting the following error message;<br>
>>>><br>
>>>> fatal:Could not create (<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>)<br>
>>>> warning:FileSetFileOption: invalid file or format<br>
>>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 65 in<br>
>>>> file TEST1.ncl<br>
>>>><br>
>>>> My script is attached below.<br>
>>>><br>
>>>> Please kindly inform me what is wrong with this code and how to fix it.<br>
>>>><br>
>>>> Thanking you,<br>
>>>> Soma<br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> ncl-talk mailing <a href="mailto:listncl-talk@ucar.edu" target="_blank">listncl-talk@ucar.edu</a><br>
>>>> List instructions, subscriber options, unsubscribe:<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> ncl-talk mailing list<br>
>>>> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
>>>> List instructions, subscriber options, unsubscribe:<br>
>>>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>>>><br>
>>><br>
>><br>
>> _______________________________________________<br>
>> ncl-talk mailing list<br>
>> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
>> List instructions, subscriber options, unsubscribe:<br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>><br>
>><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/4bc152ee/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/4bc152ee/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: Test2.ncl<br>
Type: application/octet-stream<br>
Size: 2282 bytes<br>
Desc: not available<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/4bc152ee/attachment-0001.obj" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/4bc152ee/attachment-0001.obj</a>><br>
<br>
------------------------------<br>
<br>
Message: 3<br>
Date: Wed, 18 Jul 2018 09:16:14 +0000<br>
From: Be?ta Szab?-Tak?cs <<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>><br>
To: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>>, Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
Cc: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Save in netcdf<br>
Message-ID:<br>
<<a href="mailto:HE1PR08MB2665F224A8E77049AE5A37A3F0530@HE1PR08MB2665.eurprd08.prod.outlook.com" target="_blank">HE1PR08MB2665F224A8E77049AE5A37A3F0530@HE1PR08MB2665.eurprd08.prod.outlook.com</a>><br>
<br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Dear Soma,<br>
I think the matter is in the line:<br>
<br>
filedimdef(ncdf,"time",-1,True)<br>
<br>
You should change to<br>
<br>
filedimdef(fout,"time",-1,True)<br>
<br>
I hope I could help you!<br>
Best regards,<br>
Beata<br>
<br>
From: ncl-talk [mailto:<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>] On Behalf Of Soma Roy<br>
Sent: Wednesday, July 18, 2018 9:54 AM<br>
To: Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
Cc: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Save in netcdf<br>
<br>
I am getting the following error message after running the attached code.<br>
<br>
fatal:Variable (ncdf) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 50 in file Test2.ncl<br>
<br>
Modified code as per easier method is attached below.<br>
<br>
Let me know what is wrong in this code.<br>
<br>
Thanks,<br>
Soma<br>
<br>
On Wed, Jul 18, 2018, 12:14 Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a><mailto:<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>>> wrote:<br>
;---Read needed variables from file<br>
itStrt = 9 ;<br>
itLast = 12<br>
lonStrt = 20<br>
lonLast = 100<br>
<br>
u = short2flt(in->u(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
SPH = short2flt(in1->q(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
printVarSummary(u)<br>
<br>
;===> NO: lat=in->latitude(::-1) Do not explicitly read from file<br>
:===> NO: lon=in->longitude(20:100) NCL does the book keeping<br>
;===> NO: time=in->time(09:12) as part of data structure/object input<br>
<br>
u&level = u&level*100 ; over write with new values<br>
u&level@units = "Pa"<br>
printVarSummary(u) ; LOOK at this<br>
<br>
;--- Zonal moisture transport ---------------------------------------------------------------------<br>
ZMT=u*SPH ; not appropriate to use monthly means for<br>
; for a non-linear quantity<br>
ZMT@long_name = "zonal moisture transport"<br>
ZMT@units="(m/s)(kg/kg)"<br>
copy_VarCoords(u, ZMT)<br>
printVarSummary(ZMT)<br>
<br>
---<br>
Use Method 1 to write netCDF ... easier<br>
<br>
filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc" rel="noreferrer" target="_blank">http://example.nc</a>>" ; Output file<br>
<br>
system<<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml</a>>("/bin/rm -f <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc" rel="noreferrer" target="_blank">http://example.nc</a>>") ; remove any pre-existing file<br>
fout = addfile (filo, "c") ; open output file<br>
<br>
;===================================================================<br>
; create global attributes of the file<br>
<br>
fAtt = True ; assign file attributes<br>
fAtt@title = "NCL Simple Approach to netCDF Creation"<br>
fAtt@source_file = "uvwtz_Dec2016.nc"<br>
fAtt@Conventions = "None"<br>
fAtt@creation_date = systemfunc ("date")<br>
fileattdef( fout, fAtt ) ; copy file attributes<br>
<br>
;===================================================================<br>
<br>
; make time an UNLIMITED dimension; recommended for most applications<br>
<br>
;===================================================================<br>
<br>
filedimdef<<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml</a>>(ncdf,"time",-1,True)<br>
<br>
fout->ZMT = ZMT ; 4D<br>
<br>
On Tue, Jul 17, 2018 at 11:05 AM, Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a><mailto:<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>>> wrote:<br>
It again shows the following error message;<br>
<br>
fatal:Variable (lev) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 44 in file TEST1.ncl<br>
<br>
'latitude', 'longitude', 'level' and 'time' are named as variable's dimensions in input file which is very clear from printVarSummary of the data. I modified the code as per your hints. Modified code is attached below. Kindly inform me where I am doing wrong again.<br>
<br>
Thanks,<br>
Soma<br>
<br>
On Tue, Jul 17, 2018 at 10:09 PM, Karin Meier-Fleischer <<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a><mailto:<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>>> wrote:<br>
Hi Soma,<br>
<br>
please, reply always to ncl-talk that everybody is able to follow.<br>
<br>
The problem is, that you changed the name of the level dimension to lev. ZMT has the dimension name level. Change lev to level and it should work or<br>
<br>
ZMT!1 = "lev"<br>
ZMT&lev = lev<br>
<br>
-Karin<br>
Am 17.07.18 um 14:06 schrieb Soma Roy:<br>
In the directory there is no file named as <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc" rel="noreferrer" target="_blank">http://example.nc</a>>.<br>
It is created at the run time.<br>
<br>
Now I am getting the following error massage;<br>
<br>
FileAddVar, in file: NclFile.c, line: 412<br>
fatal:FileAddVar: Dimension (level) is not currently defined, can't add variable<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 77 in file TEST1.ncl<br>
<br>
Kindly inform me what I am doing wrong in this.<br>
<br>
Thanking you,<br>
Soma<br>
<br>
<br>
On Tue, Jul 17, 2018, 16:31 Karin Meier-Fleischer <<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a><mailto:<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>>> wrote:<br>
Hi Soma,<br>
<br>
if the file <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc" rel="noreferrer" target="_blank">http://example.nc</a>> already exists NCL can't create a new one with the same name. You have to remove the file, first.<br>
<br>
filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc" rel="noreferrer" target="_blank">http://example.nc</a>>" ; Output file<br>
system("rm -rf "+filo)<br>
fout = addfile (filo, "c") ; open output file<br>
<br>
-Karin<br>
Am 17.07.18 um 12:22 schrieb Soma Roy:<br>
I am trying to save the variable ZMT in NetCDF file following the instructions at the below-mentioned link;<br>
<br>
<a href="http://www.ncl.ucar.edu/Applications/method_2.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applications/method_2.shtml</a><br>
<br>
Summary of the dataset is as follows;<br>
<br>
Variable: lat<br>
Type: float<br>
Total Size: 244 bytes<br>
61 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [latitude | 61]<br>
Coordinates:<br>
latitude: [ 5..20]<br>
Number Of Attributes: 2<br>
units : degrees_north<br>
long_name : latitude<br>
<br>
Variable: lon<br>
Type: float<br>
Total Size: 324 bytes<br>
81 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [longitude | 81]<br>
Coordinates:<br>
longitude: [70..90]<br>
Number Of Attributes: 2<br>
units : degrees_east<br>
long_name : longitude<br>
<br>
Variable: time<br>
Type: integer<br>
Total Size: 16 bytes<br>
4 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [time | 4]<br>
Coordinates:<br>
time: [1025088..1025160]<br>
Number Of Attributes: 3<br>
units : hours since 1900-01-01 00:00:0.0<br>
long_name : time<br>
calendar : gregorian<br>
<br>
<br>
Variable: pnew<br>
Type: integer<br>
Total Size: 112 bytes<br>
28 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [level | 28]<br>
Coordinates:<br>
level: [70..1000]<br>
Number Of Attributes: 2<br>
units : Pa<br>
long_name : pressure_level<br>
(0) 7000<br>
(1) 10000<br>
(2) 12500<br>
(3) 15000<br>
..........<br>
(26) 97500<br>
(27) 100000<br>
<br>
Variable: ZMT<br>
Type: float<br>
Total Size: 2213568 bytes<br>
553392 values<br>
Number of Dimensions: 4<br>
Dimensions and sizes: [time | 4] x [level | 28] x [latitude | 61] x [longitude | 81]<br>
Coordinates:<br>
time: [1025088..1025160]<br>
level: [70..1000]<br>
latitude: [ 5..20]<br>
longitude: [70..90]<br>
Number Of Attributes: 3<br>
units : (m/s)(kg/kg)<br>
long_name : zonal moisture transport<br>
_FillValue : -32767<br>
<br>
At run-time, I am getting the following error message;<br>
<br>
fatal:Could not create (<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a><<a href="http://example.nc/" rel="noreferrer" target="_blank">http://example.nc/</a>>)<br>
warning:FileSetFileOption: invalid file or format<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 65 in file TEST1.ncl<br>
<br>
My script is attached below.<br>
<br>
Please kindly inform me what is wrong with this code and how to fix it.<br>
<br>
Thanking you,<br>
Soma<br>
<br>
<br>
_______________________________________________<br>
<br>
ncl-talk mailing list<br>
<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<br>
List instructions, subscriber options, unsubscribe:<br>
<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><mailto:<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/93da231e/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/93da231e/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 4<br>
Date: Wed, 18 Jul 2018 15:09:59 +0530<br>
From: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>><br>
To: Be?ta Szab?-Tak?cs <<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>><br>
Cc: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Save in netcdf<br>
Message-ID:<br>
<<a href="mailto:CAAJRSQcMwxKMJxe-jQOXXSuf8D38hSDMOnSefvywc2cEWjHu0Q@mail.gmail.com" target="_blank">CAAJRSQcMwxKMJxe-jQOXXSuf8D38hSDMOnSefvywc2cEWjHu0Q@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
It worked. Thanks a lot Dennis and Beata.<br>
<br>
Best,<br>
Soma<br>
<br>
On Wed, Jul 18, 2018, 14:46 Be?ta Szab?-Tak?cs <<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>><br>
wrote:<br>
<br>
> Dear Soma,<br>
><br>
> I think the matter is in the line:<br>
><br>
><br>
><br>
> filedimdef(ncdf,"time",-1,True)<br>
><br>
><br>
><br>
> You should change to<br>
><br>
><br>
><br>
> filedimdef(fout,"time",-1,True)<br>
><br>
><br>
><br>
> I hope I could help you!<br>
><br>
> Best regards,<br>
><br>
> Beata<br>
><br>
><br>
><br>
> *From:* ncl-talk [mailto:<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>] *On Behalf Of *Soma<br>
> Roy<br>
> *Sent:* Wednesday, July 18, 2018 9:54 AM<br>
> *To:* Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
> *Cc:* ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
> *Subject:* Re: [ncl-talk] Save in netcdf<br>
><br>
><br>
><br>
> I am getting the following error message after running the attached code.<br>
><br>
><br>
><br>
> fatal:Variable (ncdf) is undefined<br>
><br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 50 in<br>
> file Test2.ncl<br>
><br>
><br>
><br>
> Modified code as per easier method is attached below.<br>
><br>
><br>
><br>
> Let me know what is wrong in this code.<br>
><br>
><br>
><br>
> Thanks,<br>
><br>
> Soma<br>
><br>
><br>
><br>
> On Wed, Jul 18, 2018, 12:14 Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>> wrote:<br>
><br>
> ;---Read needed variables from file<br>
><br>
> itStrt = 9 ;<br>
><br>
> itLast = 12<br>
><br>
> lonStrt = 20<br>
><br>
> lonLast = 100<br>
><br>
><br>
> u = short2flt(in->u(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
><br>
> SPH = short2flt(in1->q(itStrt:itLast,:,::-1,lonStrt:lonLast))<br>
> printVarSummary(u)<br>
><br>
> ;===> NO: lat=in->latitude(::-1) Do not explicitly read from<br>
> file<br>
> :===> NO: lon=in->longitude(20:100) NCL does the book keeping<br>
> ;===> NO: time=in->time(09:12) as part of data<br>
> structure/object input<br>
><br>
><br>
> u&level = u&level*100 ; over write with new values<br>
><br>
> u&level@units = "Pa"<br>
><br>
> printVarSummary(u) ; LOOK at this<br>
><br>
><br>
> ;--- Zonal moisture transport<br>
> ---------------------------------------------------------------------<br>
> ZMT=u*SPH ; not<br>
> appropriate to use monthly means for<br>
><br>
><br>
> ; for a non-linear quantity<br>
><br>
> ZMT@long_name = "zonal moisture transport"<br>
> ZMT@units="(m/s)(kg/kg)"<br>
> copy_VarCoords(u, ZMT)<br>
> printVarSummary(ZMT)<br>
><br>
> ---<br>
><br>
> Use Method 1 to write netCDF ... easier<br>
><br>
> filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
><br>
> * system* <<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml</a>>("/bin/rm -f <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>") ; remove any pre-existing file<br>
><br>
> fout = addfile (filo, "c") ; open output file<br>
><br>
> ;===================================================================<br>
> ; create global attributes of the file<br>
><br>
> fAtt = True ; assign file attributes<br>
> fAtt@title = "NCL Simple Approach to netCDF Creation"<br>
> fAtt@source_file = "uvwtz_Dec2016.nc"<br>
> fAtt@Conventions = "None"<br>
> fAtt@creation_date = systemfunc ("date")<br>
> fileattdef( fout, fAtt ) ; copy file attributes<br>
><br>
> ;===================================================================<br>
><br>
> ; make time an UNLIMITED dimension; recommended for most applications<br>
><br>
> ;===================================================================<br>
><br>
> *filedimdef* <<a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml</a>>(ncdf,"time",-1,True)<br>
><br>
> fout->ZMT = ZMT ; 4D<br>
><br>
><br>
><br>
> On Tue, Jul 17, 2018 at 11:05 AM, Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>> wrote:<br>
><br>
> It again shows the following error message;<br>
><br>
><br>
><br>
> fatal:Variable (lev) is undefined<br>
><br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 44 in<br>
> file TEST1.ncl<br>
><br>
><br>
><br>
> 'latitude', 'longitude', 'level' and 'time' are named as variable's<br>
> dimensions in input file which is very clear from printVarSummary of the<br>
> data. I modified the code as per your hints. Modified code is attached<br>
> below. Kindly inform me where I am doing wrong again.<br>
><br>
><br>
><br>
> Thanks,<br>
><br>
> Soma<br>
><br>
><br>
><br>
> On Tue, Jul 17, 2018 at 10:09 PM, Karin Meier-Fleischer <<br>
> <a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>> wrote:<br>
><br>
> Hi Soma,<br>
><br>
> please, reply always to ncl-talk that everybody is able to follow.<br>
><br>
> The problem is, that you changed the name of the level dimension to lev.<br>
> ZMT has the dimension name level. Change lev to level and it should work or<br>
><br>
> ZMT!1 = "lev"<br>
> ZMT&lev = lev<br>
><br>
> -Karin<br>
><br>
> Am 17.07.18 um 14:06 schrieb Soma Roy:<br>
><br>
> In the directory there is no file named as <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>.<br>
><br>
> It is created at the run time.<br>
><br>
><br>
><br>
> Now I am getting the following error massage;<br>
><br>
><br>
><br>
> FileAddVar, in file: NclFile.c, line: 412<br>
><br>
> fatal:FileAddVar: Dimension (level) is not currently defined, can't add<br>
> variable<br>
><br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 77 in<br>
> file TEST1.ncl<br>
><br>
><br>
><br>
> Kindly inform me what I am doing wrong in this.<br>
><br>
><br>
><br>
> Thanking you,<br>
><br>
> Soma<br>
><br>
><br>
><br>
><br>
><br>
> On Tue, Jul 17, 2018, 16:31 Karin Meier-Fleischer <<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>><br>
> wrote:<br>
><br>
> Hi Soma,<br>
><br>
> if the file <a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a> already exists NCL can't create a new one with the<br>
> same name. You have to remove the file, first.<br>
><br>
> filo = "<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>" ; Output file<br>
> * system("rm -rf "+filo)*<br>
> fout = addfile (filo, "c") ; open output file<br>
><br>
> -Karin<br>
><br>
> Am 17.07.18 um 12:22 schrieb Soma Roy:<br>
><br>
> I am trying to save the variable ZMT in NetCDF file following the<br>
> instructions at the below-mentioned link;<br>
><br>
><br>
><br>
> <a href="http://www.ncl.ucar.edu/Applications/method_2.shtml" rel="noreferrer" target="_blank">http://www.ncl.ucar.edu/Applications/method_2.shtml</a><br>
><br>
><br>
><br>
> Summary of the dataset is as follows;<br>
><br>
><br>
><br>
> Variable: lat<br>
><br>
> Type: float<br>
><br>
> Total Size: 244 bytes<br>
><br>
> 61 values<br>
><br>
> Number of Dimensions: 1<br>
><br>
> Dimensions and sizes: [latitude | 61]<br>
><br>
> Coordinates:<br>
><br>
> latitude: [ 5..20]<br>
><br>
> Number Of Attributes: 2<br>
><br>
> units : degrees_north<br>
><br>
> long_name : latitude<br>
><br>
><br>
><br>
> Variable: lon<br>
><br>
> Type: float<br>
><br>
> Total Size: 324 bytes<br>
><br>
> 81 values<br>
><br>
> Number of Dimensions: 1<br>
><br>
> Dimensions and sizes: [longitude | 81]<br>
><br>
> Coordinates:<br>
><br>
> longitude: [70..90]<br>
><br>
> Number Of Attributes: 2<br>
><br>
> units : degrees_east<br>
><br>
> long_name : longitude<br>
><br>
><br>
><br>
> Variable: time<br>
><br>
> Type: integer<br>
><br>
> Total Size: 16 bytes<br>
><br>
> 4 values<br>
><br>
> Number of Dimensions: 1<br>
><br>
> Dimensions and sizes: [time | 4]<br>
><br>
> Coordinates:<br>
><br>
> time: [1025088..1025160]<br>
><br>
> Number Of Attributes: 3<br>
><br>
> units : hours since 1900-01-01 00:00:0.0<br>
><br>
> long_name : time<br>
><br>
> calendar : gregorian<br>
><br>
><br>
><br>
><br>
><br>
> Variable: pnew<br>
><br>
> Type: integer<br>
><br>
> Total Size: 112 bytes<br>
><br>
> 28 values<br>
><br>
> Number of Dimensions: 1<br>
><br>
> Dimensions and sizes: [level | 28]<br>
><br>
> Coordinates:<br>
><br>
> level: [70..1000]<br>
><br>
> Number Of Attributes: 2<br>
><br>
> units : Pa<br>
><br>
> long_name : pressure_level<br>
><br>
> (0) 7000<br>
><br>
> (1) 10000<br>
><br>
> (2) 12500<br>
><br>
> (3) 15000<br>
><br>
> ..........<br>
><br>
> (26) 97500<br>
><br>
> (27) 100000<br>
><br>
><br>
><br>
> Variable: ZMT<br>
><br>
> Type: float<br>
><br>
> Total Size: 2213568 bytes<br>
><br>
> 553392 values<br>
><br>
> Number of Dimensions: 4<br>
><br>
> Dimensions and sizes: [time | 4] x [level | 28] x [latitude | 61] x<br>
> [longitude | 81]<br>
><br>
> Coordinates:<br>
><br>
> time: [1025088..1025160]<br>
><br>
> level: [70..1000]<br>
><br>
> latitude: [ 5..20]<br>
><br>
> longitude: [70..90]<br>
><br>
> Number Of Attributes: 3<br>
><br>
> units : (m/s)(kg/kg)<br>
><br>
> long_name : zonal moisture transport<br>
><br>
> _FillValue : -32767<br>
><br>
><br>
><br>
> At run-time, I am getting the following error message;<br>
><br>
><br>
><br>
> fatal:Could not create (<a href="http://example.nc" rel="noreferrer" target="_blank">example.nc</a>)<br>
><br>
> warning:FileSetFileOption: invalid file or format<br>
><br>
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 65 in<br>
> file TEST1.ncl<br>
><br>
><br>
><br>
> My script is attached below.<br>
><br>
><br>
><br>
> Please kindly inform me what is wrong with this code and how to fix it.<br>
><br>
><br>
><br>
> Thanking you,<br>
><br>
> Soma<br>
><br>
><br>
><br>
> _______________________________________________<br>
><br>
> ncl-talk mailing list<br>
><br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
><br>
> List instructions, subscriber options, unsubscribe:<br>
><br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
><br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/62f5dceb/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/62f5dceb/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 5<br>
Date: Wed, 18 Jul 2018 07:14:34 +0800<br>
From: "Md. Jalal Uddin" <<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a>><br>
To: Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: [ncl-talk] Vertical wind shear calculation within 400 km<br>
radius of TC<br>
Message-ID:<br>
<<a href="mailto:CAN5hBbsik39xNZ_vnSAWZPLpVe4g_7suzVnSWHEcRk0Lm56h2w@mail.gmail.com" target="_blank">CAN5hBbsik39xNZ_vnSAWZPLpVe4g_7suzVnSWHEcRk0Lm56h2w@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi all,<br>
<br>
I wanted to calculate mean vertical wind shear for each pressure level<br>
(950-100mb). I used u and v wind component from the NCEP Climate Forecast<br>
System Reanalysis (CFSR) 6-hourly Products.<br>
<br>
I am getting the following errors:<br>
fatal:Number of subscripts do not match number of dimensions of<br>
variable,(2) Subscripts used, (3) Subscripts expected<br>
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 41 in file<br>
test_vws_eachlevel.ncl<br>
<br>
Number of subscripts do not match number of dimensions of variable,(2)<br>
Subscripts used, (3) Subscripts expected<br>
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 47 in file<br>
test_vws_eachlevel.ncl<br>
<br>
Please help.<br>
<br>
Cheers,<br>
Jalal<br>
-- <br>
*Md. Jalal Uddin*<br>
MSc in Applied Meteorology (English Language)<br>
Nanjing University of Information, Science and Technology, China<br>
Jasmine Jiangsu Government Scholar<br>
Cell: +8613260859092<br>
Office: WMO RMTC building in middle campus<br>
<br>
*AND *<br>
B.Sc. in Disaster Management (Hons.)<br>
Patuakhali Science and Technology University, Bangladesh.<br>
Cell: +8801792052662, +8801838613203<br>
Email: <a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a><br>
Web: <a href="http://www.dmjalal90.weebly.com" rel="noreferrer" target="_blank">www.dmjalal90.weebly.com</a><br>
Facebook: jalal.hossen.39<br>
LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" rel="noreferrer" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a><br>
Twitter: dmjalal90<br>
Skype: dmjalal90<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/5ca1ddec/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/5ca1ddec/attachment-0001.html</a>><br>
-------------- next part --------------<br>
A non-text attachment was scrubbed...<br>
Name: test_vws_eachlevel.ncl<br>
Type: application/octet-stream<br>
Size: 3004 bytes<br>
Desc: not available<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/5ca1ddec/attachment-0001.obj" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/5ca1ddec/attachment-0001.obj</a>><br>
<br>
------------------------------<br>
<br>
Message: 6<br>
Date: Wed, 18 Jul 2018 09:11:01 -0600<br>
From: Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
To: "Md. Jalal Uddin" <<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a>><br>
Cc: Ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: Re: [ncl-talk] Vertical wind shear calculation within 400 km<br>
radius of TC<br>
Message-ID:<br>
<CAGKRhbE0_mW=<a href="mailto:jD4Y4oT5fyKGEfd2uO3B0JZqCJqi6DDE%2BRUbCA@mail.gmail.com" target="_blank">jD4Y4oT5fyKGEfd2uO3B0JZqCJqi6DDE+RUbCA@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi,<br>
<br>
Unfortunately, the script you sent does not align with the line numbers of<br>
the error messages -- line 47 is a blank line. In any case, the error<br>
message is pretty self-explanatory -- you are making reference to a 3D<br>
variable as though it were a 2D variable. You might place a few strategic<br>
"printVarSummary()" statements for the variables involved to make sure your<br>
variables are what you think they are.<br>
<br>
Hope that helps...<br>
Rick<br>
<br>
On Tue, Jul 17, 2018 at 5:14 PM, Md. Jalal Uddin <<a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a>><br>
wrote:<br>
<br>
> Hi all,<br>
><br>
> I wanted to calculate mean vertical wind shear for each pressure level<br>
> (950-100mb). I used u and v wind component from the NCEP Climate Forecast<br>
> System Reanalysis (CFSR) 6-hourly Products.<br>
><br>
> I am getting the following errors:<br>
> fatal:Number of subscripts do not match number of dimensions of<br>
> variable,(2) Subscripts used, (3) Subscripts expected<br>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 41 in<br>
> file test_vws_eachlevel.ncl<br>
><br>
> Number of subscripts do not match number of dimensions of variable,(2)<br>
> Subscripts used, (3) Subscripts expected<br>
> fatal:["Execute.c":8575]:Execute: Error occurred at or near line 47 in<br>
> file test_vws_eachlevel.ncl<br>
><br>
> Please help.<br>
><br>
> Cheers,<br>
> Jalal<br>
> --<br>
> *Md. Jalal Uddin*<br>
> MSc in Applied Meteorology (English Language)<br>
> Nanjing University of Information, Science and Technology, China<br>
> Jasmine Jiangsu Government Scholar<br>
> Cell: +8613260859092<br>
> Office: WMO RMTC building in middle campus<br>
><br>
> *AND *<br>
> B.Sc. in Disaster Management (Hons.)<br>
> Patuakhali Science and Technology University, Bangladesh.<br>
> Cell: +8801792052662, +8801838613203<br>
> Email: <a href="mailto:dmjalal90@gmail.com" target="_blank">dmjalal90@gmail.com</a><br>
> Web: <a href="http://www.dmjalal90.weebly.com" rel="noreferrer" target="_blank">www.dmjalal90.weebly.com</a><br>
> Facebook: jalal.hossen.39<br>
> LinkedIn: <a href="https://bd.linkedin.com/in/md-jalal-uddin-80a026b0" rel="noreferrer" target="_blank">https://bd.linkedin.com/in/md-jalal-uddin-80a026b0</a><br>
> Twitter: dmjalal90<br>
> Skype: dmjalal90<br>
><br>
> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/9832e9a7/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/9832e9a7/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 7<br>
Date: Wed, 18 Jul 2018 20:54:35 +0530<br>
From: Soma Roy <<a href="mailto:somaroy892@gmail.com" target="_blank">somaroy892@gmail.com</a>><br>
To: ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
Subject: [ncl-talk] Skew-T diagram<br>
Message-ID:<br>
<CAAJRSQdZQV2Y5vCOxv4vsZgMaxC=<a href="mailto:7d_p9Et979qePL_dFB7rww@mail.gmail.com" target="_blank">7d_p9Et979qePL_dFB7rww@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello,<br>
<br>
Is there any function/script available to calculate LCL height and draw the<br>
region of LCL, CAPE ,CINE and LFC on skew-T diagram along with wind speed<br>
and direction.<br>
<br>
Kindly inform me.<br>
<br>
Thanks,<br>
Soma<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/3710c8d4/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180718/3710c8d4/attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br>
<br>
------------------------------<br>
<br>
End of ncl-talk Digest, Vol 176, Issue 22<br>
*****************************************<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="m_1802668054803965212m_-4499145432757839984gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">Tanya R. Peevey, PhD</div><div dir="ltr">Research Scientist II, Global Observing Systems Analysis (GOSA) Group</div><div dir="ltr">NOAA ESRL Global Systems Division</div><div dir="ltr">325 Broadway, Boulder, CO 80305</div></div><div dir="ltr">(303) 497-5847</div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>