[ncl-talk] contour map not showing colors
Rick Brownrigg
brownrig at ucar.edu
Tue Aug 13 10:02:52 MDT 2024
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/9bce8365/attachment.htm>
More information about the ncl-talk
mailing list