[ncl-talk] How to set the time to get the composite map?

Atul Saini atulsainimail at gmail.com
Mon Nov 12 18:55:14 MST 2018


Respected Ma'am,
                           You and your guidance are amazing. I thank you
for your pin pointed and to the point guidance. Now onward, I will take
care of posting the query to ncl-talk at ucar.edu . Really blessed to have
your guidance and support. Thank you ma'am.

Regards,




On Tue, Nov 13, 2018 at 12:21 AM Mary Haley <haley at ucar.edu> wrote:

> Atul,
>
> Your 14 MB file was too large for ncl-talk, but it still came to me
> because I'm one of the administrators.
>
> The averaging would still work close to the same way, but I'm not exactly
> clear on what kind of average you want.
>
> You have 40 years of data, so averaging for every 5 years is going to give
> you 8 x 251 x 263:
>
>   temp_5year_avg = dim_avg_n(reshape(temp,(/ntim5,5,nlat,nlon/)),1)   ; 8
> x 251 x 263
>
> I'm not exactly sure what you mean by a composite plot.  I think a
> "raster fill" plot is similar to what you want, but again, I don't know how
> you want to "composite" across the 8 sets of lat/lon data, so this is
> something you will need to figure out.
>
> I suggest looking through some of our examples at:
>
> http://www.ncl.ucar.edu/Applications/
>
> In particular, here are some samples of raster plots:
>
> http://www.ncl.ucar.edu/Applications/raster.shtml
>
> There are many other places where raster plots are used:
>
> http://www.ncl.ucar.edu/Applications/classification.shtml
> http://www.ncl.ucar.edu/Applications/gfed.shtml
> http://www.ncl.ucar.edu/Applications/HiResPrc.shtml
>
> For even more examples, go to our tips page:
>
> http://www.ncl.ucar.edu/Applications/concepts_list.shtml
>
> and use your browser search to look for "Drawing raster contours".
>
> To help you get started, I've created a script that creates a "panel" plot
> of each of your 8 averaged lat/lon grids. In order to get better outlines
> of the map, since you have a small regional area, I used a shapefile of
> India downloaded from:
>
> https://gadm.org/download_country_v3.html
>
> Please look at this code and try understand it before posting another
> question. For documentation on dim_avg_n, or any of the NCL functions, go
> to:
>
> http://www.ncl.ucar.edu/Document/Functions/list_alpha.shtml
>
> Here's the direct link to dim_avg_n and reshape:
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_avg_n.shtml
> http://www.ncl.ucar.edu/Document/Functions/Built-in/reshape.shtml
>
> If you do have a follow-up question, post it back to ncl-talk and not to
> me individually.
>
> Good luck,
>
> --Mary
>
>
>
>
> On Mon, Nov 12, 2018 at 9:32 AM, Atul Saini <atulsainimail at gmail.com>
> wrote:
>
>> Thanks for guidance ma'am. Actually ma'am my query was related to the
>> composite map and not xy plot. I am sorry to say ma'am that  mistakenly
>> attached the wrong file (i.e. file containing fieldmean) with the earlier
>> mail. Now, I am attaching the correct one (i.e. each grid point has some
>> value) with this mail. Ma'am, the procedure to be followed to draw the
>> filled in contour map/choropleth map (i.e. composite  map of 5 years). Will
>> the process will remain same as suggested by you or does it require some
>> changes?
>> Regards,
>>
>>
>>
>>
>> On Mon, Nov 12, 2018 at 9:08 PM Mary Haley <haley at ucar.edu> wrote:
>>
>>> Dear Atul Saini,
>>>
>>> If you are new to NCL, I suggest looking at the NCL User Guide which has
>>> an excellent step-by-step guide for NCL, with a focus on creating graphics:
>>>
>>> http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/
>>>
>>> One way to do this is to first reshape the temperature array to an NTIM
>>> x 5 x NLAT x NLON array, where NTIM is the total number of years divided by
>>> five. Once you do this, you can use dim_avg_n to average across the
>>> rightmost three dimensions of the new array, effectively giving you the
>>> average for every 5 years:
>>>
>>>   filename = "chamba_tmean_fldmean.nc"
>>>   a = addfile(filename,"r")
>>>
>>>   temp  = a->t
>>>   dims  = dimsizes(temp)
>>>   ntim  = dims(0)
>>>   nlat  = dims(1)
>>>   nlon  = dims(1)
>>>   ntim5 = ntim/5
>>> ;
>>>
>>> ; Reshape temperature array so we can easily average groupings of
>>> ; five years at a time.
>>>
>>> ;
>>>
>>>   temp_5year_avg =
>>> dim_avg_n(reshape(temp,(/ntim5,5,nlat,nlon/)),(/1,2,3/))
>>>
>>> The temp_5year_avg array will be a one-dimensional array of ntim5 (8)
>>> elements that you can easily plot. See attached script and image.
>>>
>>> Note that your "t" variable on the file has no units, and it appears to
>>> have a funny character as part of the long_name. You probably should try to
>>> fix these when creating the plot.
>>>
>>> --Mary
>>>
>>>
>>> On Sat, Nov 10, 2018 at 2:10 AM, Atul Saini <atulsainimail at gmail.com>
>>> wrote:
>>>
>>>> Sir/Ma'am,
>>>>                    I have the mean temperature file containing the data
>>>> for MAMJJA season. This file contains the seasonal average (MAMJJA) data of
>>>> each year from 1975 to 2014. I can easily plot the XY plot using it but the
>>>> problem is how to make the average of 1975 to 1979, 1980 to 1985 and so on.
>>>> I want to make the pentad map as explained in the previous sentence.
>>>>
>>>> Please help in making the average of five years to plot the map, which
>>>> will represent the composite of five years.
>>>>
>>>> The data file is attached herewith this mail.
>>>>
>>>> Regards,
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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/20181113/bff1e4c8/attachment.html>


More information about the ncl-talk mailing list