[ncl-talk] getind_latlon2d_query

Kunal Bali kunal.bali9 at gmail.com
Wed Dec 6 21:58:14 MST 2017


Sir, Thanks for your suggestions and effort for this query.
I also figured out to solve this query using CDO. So I have created 2d
coordinates from that and then calculated the coff. of divergence (CoD).
The script was successfully run and I am able to plot the CoD data. But the
pattern of resultant CoD did not come as the attached figure1. Figure1 is
related to AOD and Figure2 is PM. So, I was expecting the shape of figure2
just like figure 1. But it didn't come.

any thoughts on that?











Kunal Bali






On Wed, Dec 6, 2017 at 12:08 PM, Guido Cioni <guidocioni at gmail.com> wrote:

> You can try to use these functions to create 2d coordinate arrays from 1d
> arrays. They were provided by Karin Meier Flascher.
>
> ;------------------------------------------------------------
> ;-- Function:      create_lon2d(y,x)
> ;-- Description:   create 2d lon array from 1D rotlon, rotlat
> ;------------------------------------------------------------
> undef("create_lon2d")
> function create_lon2d(rotlat[*]:numeric, rotlon[*]:numeric)
> local x, i
> begin
>   x = new((/dimsizes(rotlat),dimsizes(rotlon)/),typeof(rotlat))
> ;  print("Function create_lon2d: dimsizes of x: "+dimsizes(x))
>   do i=0,dimsizes(rotlat)-1
>     x(i,:) = rotlon
>   end do
>   return(x)
> end
>
> ;------------------------------------------------------------
> ;-- Function:      create_lat2d(y,x)
> ;-- Description:   create 2d lat array from 1D rotlon,rotlat
> ;------------------------------------------------------------
> undef("create_lat2d")
> function create_lat2d(rotlat[*]:numeric, rotlon[*]:numeric)
> local y, i
> begin
>   y = new((/dimsizes(rotlat),dimsizes(rotlon)/),typeof(rotlat))
> ;  print("Function create_lat2d: dimsizes of y: "+dimsizes(y))
>   do i=0,dimsizes(rotlon)-1
>     y(:,i) = rotlat
>   end do
>   return(y)
> end
>
> Kunal Please try to figure it out things on your own by searching in the
> mailing list or in the NCL website. You have some really basic question
> which shouldn't be posted here.
> I'm not going to reply next time if you don't show any intention of
> solving the problem on your own.
>
> Good luck
>
> Il 6 dic 2017 7:32 AM, "Guido Cioni" <guidocioni at gmail.com> ha scritto:
>
>> Kunal,
>>  lat and lon have to be 2 dimensional. Just renaming them to lat2d and
>> lon2d doesn't make them 2 dimensional....
>>
>> Il 6 dic 2017 6:36 AM, "Kunal Bali" <kunal.bali9 at gmail.com> ha scritto:
>>
>>> Okay, thanks for the suggestion.
>>>
>>>
>>> If I modify the script using
>>>
>>> *lat2d = a->lat*
>>> *lon2d = a->lon*
>>>
>>>
>>> *and then *
>>>
>>> *nm   = getind_latlon2d (lat2d, lon2d, latv, lonv)*
>>>
>>> *I mean I tried this but still got the same error. *
>>>
>>> Variable: totc
>>> Type: float
>>> Total Size: 9478656 bytes
>>>             2369664 values
>>> Number of Dimensions: 3
>>> Dimensions and sizes:    [2] x [1088] x [1089]
>>> Coordinates:
>>> Number Of Attributes: 1
>>>   _FillValue :    -28672
>>>
>>> Variable: lat2d
>>> Type: double
>>> Total Size: 8704 bytes
>>>             1088 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes:    [lat | 1088]
>>> Coordinates:
>>>             lat: [21.00781..37.992185]
>>> Number Of Attributes: 3
>>>   long_name :    "latitude"
>>>   units :    "degrees_north"
>>>   axis :    Y
>>> fatal:Number of dimensions in parameter (0) of (getind_latlon2d) is (1),
>>> (2) dimensions were expected
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> regards
>>> Kunal Bali
>>>
>>>
>>>
>>>
>>>
>>> On Tue, Dec 5, 2017 at 10:41 PM, Guido Cioni <guidocioni at gmail.com>
>>> wrote:
>>>
>>>> Did you even try to understand the error?
>>>>
>>>> fatal:Number of dimensions in parameter (0) of (getind_latlon2d) is
>>>> (1), (2) dimensions were expected
>>>>
>>>>
>>>>   nm   = getind_latlon2d (lat(:), lon(:), latv, lonv)
>>>>
>>>> lat and lon are 1-dimensional while the function needs 2-dimensional
>>>> latitude and longitudes (getind_latlon*2d*)
>>>>
>>>>
>>>> On 5. Dec 2017, at 10:59, Kunal Bali <kunal.bali9 at gmail.com> wrote:
>>>>
>>>> Dear NCL user,
>>>>
>>>>
>>>> I am trying to plot the coff. of divergence of the attached file (as a
>>>> sample file with 2-time steps). the original file has 365 time steps. The
>>>> script related to this query is also attached.
>>>>
>>>> The error is given below
>>>>
>>>>
>>>> Variable: totc
>>>> Type: float
>>>> Total Size: 9478656 bytes
>>>>             2369664 values
>>>> Number of Dimensions: 3
>>>> Dimensions and sizes:    [2] x [1088] x [1089]
>>>> Coordinates:
>>>> Number Of Attributes: 1
>>>>   _FillValue :    -28672
>>>> fatal:Number of dimensions in parameter (0) of (getind_latlon2d) is
>>>> (1), (2) dimensions were expected
>>>> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 106
>>>> in file iitd_PM2.5_plot_new.ncl
>>>>
>>>>
>>>>
>>>> regards
>>>> Kunal Bali
>>>>
>>>>
>>>>
>>>>
>>>> <data.tar.bz2><iitd_PM2.5_plot_new.ncl>_____________________
>>>> __________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>>
>>>> Guido Cioni
>>>> http://guidocioni.altervista.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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/20171207/97c9e896/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure1.png
Type: image/png
Size: 315157 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171207/97c9e896/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: figure2.png
Type: image/png
Size: 228839 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20171207/97c9e896/attachment-0003.png>


More information about the ncl-talk mailing list