Re: Error message concerning latitude and longitude

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon Dec 16 2013 - 13:20:00 MST

Hi Stephan,

If you uncomment the lines:
;res@mpMinLatF = min(lat2d) ; map range to zoom in on
;res@mpMaxLatF = max(lat2d)
;res@mpMinLonF = min(lon2d)
;res@mpMaxLonF = max(lon2d)

And then change them to read:
res@mpMinLatF = -25
res@mpMaxLatF = -10
res@mpMinLonF = -75
res@mpMaxLonF = -55
and then change

res@mpLimitMode = "corners"
to
res@mpLimitMode = "latlon"

you should get the the region of the map you want. Once you have the 2d coordinates you can draw the map in any projection with any map limits, and if the plot area is visible given your setting of the resources, it will display correctly.

For 2) you can use
ji = getind_latlon2d(lat2d,lon2d,-17,-66)
print(ji)
print ("closest grid point in data: " + lat2d(ji(0,0),ji(0,1)) + " " + lon2d(ji(0,0),ji(0,1)))

This will give you:

Variable: ji
Type: integer
Total Size: 8 bytes
            2 values
Number of Dimensions: 2
Dimensions and sizes: [1] x [2]
Coordinates:
Number Of Attributes: 1
  long_name : indices closest to specified LAT/LON coordinate pairs
(0,0) 52
(0,1) 29
(0) closest grid point in data: -16.9156 -66.1956

Hope this helps.
 -dave

On Dec 15, 2013, at 3:37 PM, "Stephan Herrmann" <stephan.w.herrmann@t-online.de> wrote:

> Hello David,
>
> I have removed the lines printMinMax(lon2d,0) and printMinMax(lat2d,0) and now it works. I have two further questions:
>
> 1. I want to reduce the displayed map section (new map section: 10S - 25S and 55W - 75W). How can I do this?
> 2. I want to plot the temperature for Cochabamba (17S and 66W) in a xy plot. How can I get the longitude and latitude?
>
>
> Best regards
>
> Stephan
>
>
>
> -----Original-Nachricht-----
> Betreff: Re: [ncl-talk] Error message concerning latitude and longitude
> Datum: Sat, 14 Dec 2013 19:36:28 +0100
> Von: David Brown <dbrown@ucar.edu>
> An: Stephan Herrmann <stephan.w.herrmann@t-online.de>
>
> Hi Stephan,
> Does the script actually quit? The min/max line is intended output from the printMinMax routine that I put in the script while debugging it. You could certainly remove it.
> I don't understand where the "lines 1-1/1 (END)" comes from, but I do see that it was in your original message as well. Is it possible that you are using a modified version of some of the loaded script files (gsn_code.ncl, etc.)?
> Otherwise, it is a strange message that is not in the usual format of NCL error messages. I suppose it's possible that some developer's personal debug message has been checked into the code accidentally -- that has happened occasionally.
> -dave
>
> On Dec 14, 2013, at 9:04 AM, "Stephan Herrmann" <stephan.w.herrmann@t-online.de> wrote:
>
>> Hello David,
>>
>> thank you very much for your help. The PNG file of the graphics looks great. I also think the plot looks correct. When I run your NCL script test.ncl I get the following error message:
>>
>> (0) min=-83.0979 max=-51.1712
>> lines 1-1/1 (END)
>>
>> How can I fix this problem?
>>
>>
>> Best regards
>>
>> Stephan
>>
>>
>>
>> -----Original-Nachricht-----
>> Betreff: Re: [ncl-talk] Error message concerning latitude and longitude
>> Datum: Sat, 14 Dec 2013 02:00:12 +0100
>> Von: David Brown <dbrown@ucar.edu>
>> An: Stephan Herrmann <stephan.w.herrmann@t-online.de>
>>
>>
>> Hi Stephan,
>> I would like to add to the earlier suggestions from our team. The coordinates in the file are 1d rotated coordinates generated by CDO (I think). They are relative to the rotated coordinate system. For plotting purposes NCL needs to know the coordinates in the standard unrotated system, but currently there is no public interface for converting the coordinates. Also there are different conventions for specifying the rotated coordinates. I am attaching a little C source code that performs the operation based on the conventions employed by CDO. It generates an ascii output file containing the lat and lon of each grid point in the unrotated system. I am also attaching the ascii output, an NCL script that uses it to create the 2D coordinate arrays that locate your data, as well as a PNG file of the graphics. I think the plot looks correct, but let us know if it is not. Hopefully we can build this functionality into NCL in the near future.
>> -dave
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 16 13:20:12 2013

This archive was generated by hypermail 2.1.8 : Wed Dec 18 2013 - 14:29:51 MST