[ncl-talk] Error in selecting box using coordinate subscripting
Adam Phillips
asphilli at ucar.edu
Mon Jul 19 14:30:39 MDT 2021
I cannot comment on the CDO alternative, but I do believe Samir's issue is
resolvable without regridding especially as the grid is rectilinear.
Samir: This should work: temp_et = temp({30:60},{-240:-170})
If you are not happy that the longitudes are all negative, you can do the
following:
temp_et = temp({30:60},{-240:-170})
lon = (/ temp_et&lon /)
lon = lon+360
lon!0 = "lon"
lon&lon = lon
temp_et&lon = lon
printVarSummary(temp_et)
That should show that the longitudes are positive, running from 120:190E.
(As a rectilinear grid's coordinate latitude/longitude values should only
monotonically increase, you cannot have values run from 120:180E, then flip
around and go from -180:-170E.)
Hope that helps!
Adam
On Mon, Jul 19, 2021 at 2:13 AM Ushnanshu Dutta <ushnanshudutta at gmail.com>
wrote:
> In continuation to my earlier email I forgot to mention the target grid
> file. I have created the target grid file like this
>
> cat > targetgrid << EOF
> gridtype = lonlat
> xsize = 360
> ysize = 180
> xfirst = −179.5
> xinc = 1
> yfirst = -89.5
> yinc = 1
> EOF
>
>
> here you also have options to change the resolution.
>
> On Mon, Jul 19, 2021 at 1:14 PM Ushnanshu Dutta <ushnanshudutta at gmail.com>
> wrote:
>
>> Dear Sir,
>> Are you working with SST data from CMIP5 and CMIP6? Except for a few
>> models , the SST data are provided on curvilinear grids.
>>
>> The following page can be your help
>> https://www.ncl.ucar.edu/Applications/ESMF.shtml
>>
>> I think through cdo "remapbil" regridding from curvilinear to rectilinear
>> (lon x lat) also possible. I have done that and compared with the original
>> one and found they are consistent. Can somebody comment on this?
>>
>> On Mon, Jul 19, 2021 at 12:48 PM samirpokhrel via ncl-talk <
>> ncl-talk at mailman.ucar.edu> wrote:
>>
>>> Thanks Adam and Rashed,
>>>
>>> Its confusing, As LonPivot is just re-arranging the the order of
>>> Longitude start and end point, but the basic range is similar to that of
>>> the models original grid (i.e -279 to 80).
>>> Is it not possible to arrange the longitudes in the way its easy i.e
>>> positive means east and negative means west longitudes.
>>> Is re-gridding data the only solution?
>>>
>>> regards
>>> Samir
>>> ------------------------------
>>> *From: *"Adam Phillips" <asphilli at ucar.edu>
>>> *To: *"samirpokhrel" <samir at tropmet.res.in>
>>> *Cc: *"ncl-talk" <ncl-talk at ucar.edu>
>>> *Sent: *Friday, July 16, 2021 11:21:32 PM
>>> *Subject: *Re: [ncl-talk] Error in selecting box using coordinate
>>> subscripting
>>>
>>> Rashed is right, lonPivot is definitely one way to get around this
>>> issue. Another possibility is to just specify the area like this:
>>> temp_et = temp({30:60},{-240:-170})
>>> Hope that helps!
>>> Adam
>>>
>>> On Fri, Jul 16, 2021 at 11:46 AM Rashed Mahmood via ncl-talk <
>>> ncl-talk at mailman.ucar.edu> wrote:
>>>
>>>> lonFlip assumes that the central longitude is either Greenwich meridian
>>>> (0) or 180 which is not the case in your data. Maybe "lonPivot" could do
>>>> the job?
>>>> https://www.ncl.ucar.edu/Document/Functions/Contributed/lonPivot.shtml
>>>>
>>>> Or regriding the data could be another option.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Jul 16, 2021 at 8:55 AM samirpokhrel via ncl-talk <
>>>> ncl-talk at mailman.ucar.edu> wrote:
>>>>
>>>>> Dear NCL Users,
>>>>>
>>>>>
>>>>> I am having problem while selecting a specific region within model
>>>>> output global data. Model data Longitudes varies from -279.75 to 79.75. The
>>>>> printVarSummary of the model data is as follows
>>>>>
>>>>> -------
>>>>>
>>>>> Variable: temp
>>>>>
>>>>> Type: double
>>>>>
>>>>> Number of Dimensions: 2
>>>>>
>>>>> Dimensions and sizes: [YT_OCEAN | 410] x [XT_OCEAN | 720]
>>>>>
>>>>> Coordinates:
>>>>>
>>>>> YT_OCEAN: [-80.75..89.75]
>>>>>
>>>>> XT_OCEAN: [-279.75..79.75]
>>>>>
>>>>> ---------
>>>>>
>>>>> When I am trying to Select the region 120 E to 170W and 30N to 60N by
>>>>> using coordinate subscripting viz.
>>>>>
>>>>>
>>>>> temp_et = temp({30:60},{120:-170})
>>>>>
>>>>>
>>>>> It is giving error like
>>>>>
>>>>>
>>>>> fatal:NclOneDValGetRangeIndex: start coordinate index out of range,
>>>>> can't continue
>>>>>
>>>>> fatal:Could not obtain coordinate indexes, unable to perform subscript
>>>>>
>>>>>
>>>>> Thereafter I have performed the lonFlip function
>>>>>
>>>>>
>>>>> temp_new = lonFlip(temp)
>>>>>
>>>>> temp_et = temp_new({30:60},{120:-170})
>>>>>
>>>>>
>>>>> and the error is solved and the printVarSummary now looks like
>>>>>
>>>>>
>>>>> ---------------------------
>>>>>
>>>>> Variable: temp_et
>>>>>
>>>>> Type: double
>>>>>
>>>>> Number of Dimensions: 2
>>>>>
>>>>> Dimensions and sizes: [YT_OCEAN | 40] x [XT_OCEAN | 440]
>>>>>
>>>>> Coordinates:
>>>>>
>>>>> YT_OCEAN: [30.2501..59.75]
>>>>>
>>>>> XT_OCEAN: [119.75..-99.75]
>>>>>
>>>>> ----------------------------
>>>>>
>>>>>
>>>>> This is incorrect as my data is 0.5 degree resolution and X dimension
>>>>> should be 140 size rather than 440 size
>>>>>
>>>>>
>>>>> Please let me know where I am going wrong
>>>>>
>>>>>
>>>>> Thanking you in advance
>>>>>
>>>>>
>>>>> Regards
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at mailman.ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at mailman.ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>
>>>
>>> --
>>> Adam Phillips
>>> Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
>>> www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
>>>
>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> ncl-talk at mailman.ucar.edu
>>> List instructions, subscriber options, unsubscribe:
>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>>
>> --
>>
>> *Ushnanshu Dutta*
>>
>> *Research Fellow*
>>
>> *Indian Institute of Tropical Meteorology*
>>
>> *Pune,411008*
>> *Mob: 9405022799*
>>
>
>
> --
>
> *Ushnanshu Dutta*
>
> *Research Fellow*
>
> *Indian Institute of Tropical Meteorology*
>
> *Pune,411008*
> *Mob: 9405022799*
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210719/803b5aa3/attachment.html>
More information about the ncl-talk
mailing list