[ncl-talk] Fwd: contour plot misalignment

Dennis Shea shea at ucar.edu
Thu Jan 26 15:12:51 MST 2017


This thread is very confusing [to me]. I have not looked at the script or
data. It seems some 'custom processing' task is being described.

You use the word "conform" rather loosely from my perspective.

"conform a vector X of length, say 10, with another vector B of length 20"

X(10), B(20)

NCL's  'conform' and 'conform_dims' **require** that some dimension size
'match'. Sizes 10 and 20 do not conform.

Do you mean 'merge'?

X = ispan(1,10,1)
B = ispan(1,20,1)
XB = array_append_record(X, B, 0)      ; XB(30)
XB_unique = get_unique_values(XB)
print(XB_unique)

Variable: XB_unique
Type: integer
Total Size: 80 bytes
            20 values
Number of Dimensions: 1
Dimensions and sizes:   [20]
Coordinates:

(0)     1
(1)     2
(2)     3
        [snip]
(17)    18
(18)    19
(19)    20


------------






On Thu, Jan 26, 2017 at 1:41 PM, Marston Johnston <marston.johnston at gu.se>
wrote:

> Hi Mary,
>
> I understood what you meant. Apologies for the ambiguity.
> My script is a long one and it is not yet a running smoothly and bug-free.
> I’ve sent an attachment along with a subset of the data:
>
> https://www.dropbox.com/sh/gac3w26dzdtpd8y/AACrzZSVc3Fj5Dinh137E9Ywa?dl=0
>
> I’m rethinking how to best bin and average the data. There is still
> problem, which I sent in as a issue today and that is how to I conform a
> vector X of length, say 10, with another vector B of length 20, for example
> ( see line 154).
>
> As you can see from the script I use the model's lat lon to for the grid
> on which the MHS data is binned. In this case I’m using a square grid where
> the lat and lon spacing are equal. The lats and lons are from the model are
> not changed, which is why I suspect the binning.
>
> Of course this is not the plot script as there is another averaging script
> in between. This is why I was hesitant to send any data as I’m trying to
> eliminate much of the secondary averaging and ensure this initial binning
> of the data is done correctly.
>
> I would appreciate any tips you can give on making the attached script
> more efficient.
>
> One idea I have is to use the bin_sum function and just do a running mean
> instead of saving the daily means.
>
> /M
>
> Marston S. Johnston, PhD
> Department of Earth Sciences
> University of Gothenburg, Sweden
> Email: marston.johnston at gu.se
> SkypeID: marston.johnston
> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
> Only the fruitful thing is true!
>
>
> On 26 Jan 2017, 18:20 +0100, Mary Haley , wrote:
>
> Marston,
>
> To be clear, I don't think you should set tfDoNHiDCOverlay at all!  I was
> asking if you were doing this, because that's what could make your plot
> wrong.
>
> I don't think you should need to regrid the data to plot it, either.  You
> really should be able to plot the observational values as they are.
>
> It's hard for us to debug a problem if we can't see your script. If you
> can send this, then I might have a better idea of what's going on. It also
> helps if you can provide the data.
>
> --Mary
>
>
> On Thu, Jan 26, 2017 at 9:48 AM, GMAIL <shejo284 at gmail.com> wrote:
>
>> Hi Mary,
>>
>> I’m still working on this. I’ve not set the tfDoNDCOverlay and what I
>> realised is that my model doesn’t have a square grid, i.e., the
>> spacing in the lat and lon directions are slightly different.
>> I’m regridding instead to a square grid and then binning the MHS data to
>> the square grid. If this fails I’ll plot the lat and lon values as you
>> suggested and contact you again with more information for some help.
>> Appreciate the tip :-)
>>
>> /M
>>
>> On 26 Jan 2017, 06:18 +0100, Mary Haley <haley at ucar.edu>, wrote:
>>
>> Marston,
>>
>> There could be a few things going on here.
>>
>> One is simply that your lat/lon values are not quite correct.
>>
>> Are you setting tfDoNDCOverlay to True by any chance? If you are trying
>> to use a native projection and you don't have the native projection
>> parameters set exactly right, then the plot can be slightly misaligned.
>>
>> One thing I would suggest is plotting the observational lat/lon values as
>> markers on your second plot to see if they are also misaligned with the
>> coastlines. You should be able to use gsn_add_polymarker to plot the
>> markers.
>>
>> Finally, as usual, if you can provide the data for the observational
>> plot, and a script, then I can take a look.
>>
>> --Mary
>>
>>
>> On Wed, Jan 25, 2017 at 3:17 AM, Marston Johnston <marston.johnston at gu.se
>> > wrote:
>>
>>> Hi,
>>>
>>> I’ve binned (bin_sum) some MHS data to a model grid using rational lats
>>> and lons values (see linked fig
>>> <https://www.dropbox.com/s/fi6s577iio47u4w/mhs_t511_si_contour.pdf?dl=0>
>>> ).
>>> The upper panel in the figure is the model data but the bottom figure is
>>> from the observations. As you can see the
>>> coastlines are slightly off and I cannot figure out why. Does anyone
>>> have any idea why this is happening to the bin_sum figure?
>>> I’ve used the same set of lats and lons consistently throughout the
>>> process.
>>>
>>> Any hint/help is appreciated.
>>>
>>> /M
>>>
>>> Marston S. Johnston, PhD
>>> Department of Earth Sciences
>>> University of Gothenburg, Sweden
>>> Email: marston.johnston at gu.se
>>> SkypeID: marston.johnston
>>> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
>>> Only the fruitful thing is true!
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
>
> On 26 Jan 2017, 06:18 +0100, Mary Haley <haley at ucar.edu>, wrote:
>
> Marston,
>
> There could be a few things going on here.
>
> One is simply that your lat/lon values are not quite correct.
>
> Are you setting tfDoNDCOverlay to True by any chance? If you are trying to
> use a native projection and you don't have the native projection parameters
> set exactly right, then the plot can be slightly misaligned.
>
> One thing I would suggest is plotting the observational lat/lon values as
> markers on your second plot to see if they are also misaligned with the
> coastlines. You should be able to use gsn_add_polymarker to plot the
> markers.
>
> Finally, as usual, if you can provide the data for the observational plot,
> and a script, then I can take a look.
>
> --Mary
>
>
> On Wed, Jan 25, 2017 at 3:17 AM, Marston Johnston <marston.johnston at gu.se>
> wrote:
>
>> Hi,
>>
>> I’ve binned (bin_sum) some MHS data to a model grid using rational lats
>> and lons values (see linked fig
>> <https://www.dropbox.com/s/fi6s577iio47u4w/mhs_t511_si_contour.pdf?dl=0>
>> ).
>> The upper panel in the figure is the model data but the bottom figure is
>> from the observations. As you can see the
>> coastlines are slightly off and I cannot figure out why. Does anyone have
>> any idea why this is happening to the bin_sum figure?
>> I’ve used the same set of lats and lons consistently throughout the
>> process.
>>
>> Any hint/help is appreciated.
>>
>> /M
>>
>> Marston S. Johnston, PhD
>> Department of Earth Sciences
>> University of Gothenburg, Sweden
>> Email: marston.johnston at gu.se
>> SkypeID: marston.johnston
>> Phone: +46-31-7864901 <+46%2031%20786%2049%2001>
>> Only the fruitful thing is true!
>>
>>
>>
>> _______________________________________________
>> 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/20170126/7f0c4555/attachment.html 


More information about the ncl-talk mailing list