[ncl-talk] contour map not showing colors
Rick Brownrigg
brownrig at ucar.edu
Tue Aug 13 11:51:38 MDT 2024
Hi Tabish,
I ran your script untouched on my Mac, and I got a plot with filled
contours. But oddly enough, it had no labelling or contour lines!? I ran
the script on my linux machine, and it came out perfect. Both plots are
attached.
I don't have a good explanation. I thought there might be a difference in
the default resources specified in the .hluresfile, but that is not the
case. We used to see an issue where plots didn't get fully flushed in
laptops with Intel graphics hardware, but that's not the case here either.
Both my Mac and linux machine have ncl installations via miniconda.
I'm not sure what to advise here. Perhaps someone else may have some
insights?
I wish I had a better answer...
Rick
On Tue, Aug 13, 2024 at 10:02 AM Rick Brownrigg <brownrig at ucar.edu> wrote:
> Hi Tabish,
>
> I'm not seeing the problem -- it is indeed a straightforward script. If
> you can send me that dataset, I'll take a closer look into it.
>
> Rick
>
> On Tue, Aug 13, 2024 at 9:49 AM Tabish Ansari via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Hi
>>
>> I have a cropped dataset over northern China from the CAMS Reanalyses
>> product which contains 3-hourly PM2.5 concentrations for the year 2019.
>>
>> Here's the variable metadata:
>> short pm2p5(time, latitude, longitude) ;
>> pm2p5:scale_factor = 7.76424835780384e-11 ;
>> pm2p5:add_offset = 2.54403361691801e-06 ;
>> pm2p5:_FillValue = -32767s ;
>> pm2p5:missing_value = -32767s ;
>> pm2p5:units = "kg m**-3" ;
>> pm2p5:long_name = "Particulate matter d < 2.5 um" ;
>> pm2p5:standard_name =
>> "mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air" ;
>>
>>
>> I've written a fairly straightforward NCL script just to plot the annual
>> average PM2.5 concentration. It shows the map with contour lines and an
>> appropriately ranged labelbar but with no colors within the map.
>> Here's my script:
>>
>> ==============================================================================
>> begin
>>
>> ;SOURCING FILES
>> DIR = "/worknb/users/tans/Capstone-Maya/"
>> a = addfile(DIR+"CAMSconc_3hourly_NCP2019.nc","r")
>>
>>
>> ;READING DATA
>> pm25NCP = short2flt(a->pm2p5)
>> pm25NCP = pm25NCP * 10^9
>> pm25NCP = pm25NCP(:,::-1,:) ; flipping latitudes to correct the inverted
>> data
>>
>>
>> ;PREPARING TIME-AVERAGED DATA
>> pm25NCPavg = dim_avg_n_Wrap(pm25NCP,0)
>> printVarSummary(pm25NCPavg)
>> printMinMax(pm25NCPavg,True)
>>
>>
>> ;START THE GRAPHICS
>> wks = gsn_open_wks("x11","NCPavgconc")
>> res = True
>> res at gsnMaximize = True ; Maximize plot in frame
>> res at cnFillOn = True ; turn on color
>> ;res at cnFillPalette = "MPL_Reds" ; set color map
>> res at cnLinesOn = True ; turn contour lines on/off
>> res at gsnAddCyclic = False
>> res at mpFillOn = True
>>
>> ;SELECT NCP REGION FROM THE GLOBE
>> res at mpProjection = "Mercator"
>> res at mpLambertParallel1F = 30.
>> res at mpLambertParallel2F = 40.
>> res at mpLambertMeridianF = 115.
>>
>> res at mpLimitMode = "Corners" ; choose region of map
>> res at mpLeftCornerLatF = 20.
>> res at mpLeftCornerLonF = 100.
>> res at mpRightCornerLatF = 50.
>> res at mpRightCornerLonF = 130.
>>
>> plot = gsn_csm_contour_map(wks, pm25NCPavg, res)
>>
>> end
>> ===================================================================
>>
>>
>> The output of the script is as follows:
>> Copyright (C) 1995-2019 - All Rights Reserved
>> University Corporation for Atmospheric Research
>> NCAR Command Language Version 6.6.2
>> The use of this software is governed by a License Agreement.
>> See http://www.ncl.ucar.edu/ for more details.
>>
>> Variable: pm25NCPavg
>> Type: float
>> Total Size: 6724 bytes
>> 1681 values
>> Number of Dimensions: 2
>> Dimensions and sizes: [latitude | 41] x [longitude | 41]
>> Coordinates:
>> latitude: [20..50]
>> longitude: [100..130]
>> Number Of Attributes: 8
>> _FillValue : -32767
>> units : kg m**-3
>> long_name : Particulate matter d < 2.5 um
>> standard_name :
>> mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air
>> _FillValue_original : -32767
>> missing_value_original : -32767
>> missing_value : -32767
>> average_op_ncl : dim_avg_n over dimension(s): time
>> (0)
>> (0) Particulate matter d < 2.5 um (kg m**-3) : min=3.35468
>> max=205.552
>>
>>
>>
>> And I have attached the resulting map as a png file.
>>
>> I'd really appreciate it if someone can point out what is needed for the
>> plot to show the contour colors.
>>
>> Thanks a lot.
>>
>> best regards,
>>
>> Tabish
>>
>>
>> --------------------------------------------------------------------------------------
>> Dr Tabish Ansari
>> Research Associate
>> Air Quality Modelling Group
>> Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam
>> Potsdam, Germany
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240813/5116cf3d/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_mac.png
Type: image/png
Size: 393381 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240813/5116cf3d/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_linux.png
Type: image/png
Size: 184048 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20240813/5116cf3d/attachment-0003.png>
More information about the ncl-talk
mailing list