[ncl-talk] error in dimension
Ehsan Taghizadeh
ehsantaghizadeh at yahoo.com
Fri Dec 8 08:49:46 MST 2017
Dear Dennis You are right; I should include output from 'ncdump -h'. Although I'd attached some files themselves, but including output from 'ncdump -h' was necessary. About the name of files, "L.MS" is correct, as it could be seen in attachments of my first email.
Finally your comment about prc := prc(ncl_join|:, lat|:, lon|:)was really helpful and removed error. It helped me a lot. Thanks for your guidance.
SincerelyEhsan
On Friday, December 8, 2017, 5:19:51 AM GMT+3:30, Dennis Shea <shea at ucar.edu> wrote:
If you are having 'file problems', always include (attach) the output from 'ncdump -h' or, equivalently, 'ncl_filedump'
----
I think you have a 'typo':
"3B-DAY-L.MS.MRG. 3IMERG.201704*.nc"
'L.MS' should be 'LMS"
This should be:
"3B-DAY-LMS.MRG. 3IMERG.201704*.nc"
====
If there is no time dimension (ie: record dimension)
Then, I think you should read the documentation for
https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
(In particulare, the Examples)
and
https://www.ncl.ucar.edu/Document/Functions/Built-in/ListSetType.shtml
====
I suggest *not* reordering when importing the data. This is very inefficient.,
diri = "path/" ; input directory files = systemfunc("cd "+diri+"; ls 3B-DAY-LMS.MRG. 3IMERG.201704*.nc") ; file paths
f = addfiles(diri+files,"r")
ListSetType (f, "join")
prc = f[:]->precipitationCal
printVarSummary(prc)
Likely, you will have something like:
[ncl_join | ?] x [lon | 3480] x [lat | 61]
Now reorder, use the := 'overwrite' syntax
prc := prc(ncl_join|:, lat|:, lon|:)
printVarSummary(prc)
If there is no 'time' within the file, then you will have to parse the 'files' variable to extract the yyyymm... information
str_get_cols or str_get_field
Good luck
On Thu, Dec 7, 2017 at 5:56 PM, Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com> wrote:
Dear KarinI think so, all files have the same dimensions and names.I examined one by one files and all shows same output for following lines prc2 = f->precipitationCal(lat | :, lon | :)
printVarSummary(prc2)
Output is:
Type: float
Total Size: 28304 bytes
7076 values
Number of Dimensions: 2
Dimensions and sizes: [lat | 61] x [lon | 116]
Coordinates:
lat: [34.25..40.25]
lon: [40.05..51.55]
However if it helps I could attach these files.
SincerelyEhsan
On Thursday, December 7, 2017, 2:22:35 PM GMT, Karin Meier-Fleischer <meier-fleischer at dkrz.de> wrote:
Hi Ehsan,
the syntax for multiple files is correct
prc = f[:]->precipitationCal(lat|:, lon|:)
Are you sure that all files have the same dimensions and names?
-Karin
Am 07.12.17 um 14:53 schrieb Ehsan Taghizadeh:
Dear Karin Thank you so much for your nice reply. However for prc = f[:]->precipitationCal
printVarSummary(prc)
I got: Copyright (C) 1995-2017 - All Rights Reserved University Corporation for Atmospheric Research NCAR Command Language Version 6.4.0 The use of this software is governed by a License Agreement. See http://www.ncl.ucar.edu/ for more details. warning:Aggregated dimension coordinate values are non-monotonic; check aggregated file ordering
Variable: prc Type: float Total Size: 849120 bytes 212280 values Number of Dimensions: 2 Dimensions and sizes: [lon | 3480] x [lat | 61] Coordinates: lon: [40.05..51.55] lat: [34.25..40.25] Number Of Attributes: 6 units : mm long_name : Daily accumulated precipitation (combined microwave-IR) estimate coordinates : lat lon _FillValue : -9999.9 origname : precipitationCal fullnamepath : /precipitationCal
In fact for one file, I don't have any problem and following lines work correctly:
f = addfile(filess,"r") prc = f->precipitationCal(lat | :, lon | :)
however for multiple files I counter problem. I attached 3 files which I want to open. As Karin mentioned the problem is related to "Dimenstions and sizes". So how could I point to a variable and simultaneous reorder (lat, lon) dimension in case of multiple files? I mean what is the form of f = addfile(filess,"r") prc = f->precipitationCal(lat | :, lon | :) for multiple files?
Again I'll be thankful for any help.
Sincerely Ehsan
On Thursday, December 7, 2017, 4:51:40 PM GMT+3:30, Karin Meier-Fleischer <meier-fleischer at dkrz.de> wrote:
Hi Ehsan,
please, have a look at your data first. Do
prc = f[:]->precipitationCal
printVarSummary(prc)
to see what dimension names precipitationCal has.
-Karin
Am 07.12.17 um 12:18 schrieb Ehsan Taghizadeh:
Hi, I want to open multiple netcdf files. Also I had to change dimesion of variable (precipitationCal(lat | :, lon | :)), but I got an error (fatal:(lat) is not a dimension name in variable (lon), could not determine dimension number). What should I do? Following lines are simple code.
diri = "path/" ; input directory files = systemfunc("ls "+diri+"3B-DAY-L.MS.MRG. 3IMERG.201704*.nc") ; file paths f = addfiles(files,"r") prc = f[:]->precipitationCal(lat | :, lon | :) ; read precipitation from all files
Sincerely Ehsan
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
______________________________ _________________
ncl-talk mailing list
ncl-talk at ucar.edu
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/ mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171208/43aafd1d/attachment.html>
More information about the ncl-talk
mailing list