[ncl-talk] Error in selecting box using coordinate subscripting
samirpokhrel
samir at tropmet.res.in
Mon Jul 19 22:37:39 MDT 2021
Dear Adam, Ushnanshu and others,
Thanks a lot, It was a real help. I am thankful to the NCL community, its so helpful and quick. It has really encouraged me to use NCL more often.
Sincere Regards
Samir
From: "Adam Phillips" <asphilli at ucar.edu>
To: "Ushnanshu Dutta" <ushnanshudutta at gmail.com>
Cc: "samirpokhrel" <samir at tropmet.res.in>, "ncl-talk" <ncl-talk at ucar.edu>
Sent: Tuesday, July 20, 2021 2:00:39 AM
Subject: Re: [ncl-talk] Error in selecting box using coordinate subscripting
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 < [ mailto:ushnanshudutta at gmail.com | 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 < [ mailto:ushnanshudutta at gmail.com | ushnanshudutta at gmail.com ] > wrote:
BQ_BEGIN
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 | 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 < [ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ] > wrote:
BQ_BEGIN
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" < [ mailto:asphilli at ucar.edu | asphilli at ucar.edu ] >
To: "samirpokhrel" < [ mailto:samir at tropmet.res.in | samir at tropmet.res.in ] >
Cc: "ncl-talk" < [ mailto:ncl-talk at ucar.edu | 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 < [ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ] > wrote:
BQ_BEGIN
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 | 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 < [ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ] > wrote:
BQ_BEGIN
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
[ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ]
List instructions, subscriber options, unsubscribe:
[ https://mailman.ucar.edu/mailman/listinfo/ncl-talk | https://mailman.ucar.edu/mailman/listinfo/ncl-talk ]
_______________________________________________
ncl-talk mailing list
[ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ]
List instructions, subscriber options, unsubscribe:
[ https://mailman.ucar.edu/mailman/listinfo/ncl-talk | https://mailman.ucar.edu/mailman/listinfo/ncl-talk ]
BQ_END
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
[ http://www.cgd.ucar.edu/staff/asphilli/ | www.cgd.ucar.edu/staff/asphilli/ ] 303-497-1726
[ http://www.cgd.ucar.edu/staff/asphilli ]
_______________________________________________
ncl-talk mailing list
[ mailto:ncl-talk at mailman.ucar.edu | ncl-talk at mailman.ucar.edu ]
List instructions, subscriber options, unsubscribe:
[ https://mailman.ucar.edu/mailman/listinfo/ncl-talk | https://mailman.ucar.edu/mailman/listinfo/ncl-talk ]
BQ_END
--
Ushnanshu Dutta
Research Fellow
Indian Institute of Tropical Meteorology
Pune,411008
Mob: 9405022799
BQ_END
--
Ushnanshu Dutta
Research Fellow
Indian Institute of Tropical Meteorology
Pune,411008
Mob: 9405022799
BQ_END
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
[ http://www.cgd.ucar.edu/staff/asphilli/ | 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/20210720/ec8d69b9/attachment.html>
More information about the ncl-talk
mailing list