<div dir="ltr">Yes, cnRasterCellSizeF, is what I was looking for! <div>This has created the high res, well defined image I was looking for. My data set is 3200x7200, which is 4800 squared, so I set cnRasterCellSizeF to 1.0/4800. The results look pretty good with this setting, but I will continue to experiment with this parameter. This doesn't account for the margins around the map image, so I"m sure there is a bit of tweaking to be done. <div><br></div><div>I set the png resolution to 16384x16384. The reason I chose this resolution is because this is 256 * 2 (to the 6th power), which is the resolution of an image tile layer at zoom level 6 using standards for web map api's like google maps or leaflet. I will use ImageMagick to cut this image into squares of 256x256. The png output file was created relatively quick, about 2 minutes, whereas the AreaFill was taking on the order of 4 hours on my server. The ImageMagick calculations are impressively, but for zoom level 6, it creates 4096 images, which taks me around 20 minutes. </div><div><br></div><div>If anyone else is interested in the process to create the image tile layers, I'd be happy to share with the community. </div><div><br></div><div>Thanks as always for the great help on this email list. </div><div><br></div><div>Micah</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 30, 2014 at 4:48 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Kyle,<br>
<br>
My experience is that drawing a raster fill png plot keeping the cell<br>
size close to the grid cell size is usually (much) faster than drawing<br>
an AreaFill plot. For the example I just used, drawing the MPAS grid,<br>
the raster sample factor does not work well because it is an<br>
unstructured grid, and therefore there is not a clear definition of<br>
the size of a grid cell, which the cnRasterSampleFactorF resource<br>
depends on. With a little work, this could be improved I think.<br>
-dave<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Thu, Oct 30, 2014 at 2:35 PM, Kyle Griffin <<a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a>> wrote:<br>
> Interesting. I would agree on having a couple of examples. In the meantime,<br>
> a couple of thoughts...<br>
><br>
> Between the cnRasterCellSizeF and cnRasterSampleFactorF, you can essentially<br>
> set the cell size to be infinitely small (e.g. 1e-30, within the range of<br>
> float still) and keeping the sample factor at 1.0 should keep the cells no<br>
> smaller than the size of the grid itself, correct? If this was done, is<br>
> there any computational efficiency to be gained versus using an AreaFill?<br>
> Might depend on the data itself, I suppose, but it would seem that the<br>
> infinitely-small limit of RasteFill is essentially CellFill mode, but<br>
> perhaps more computations (such as averaging all data points contributing a<br>
> cell - in this case this is 1, but don't know if the average is removed in<br>
> this limiting case) which would make CellFill more example in this limiting<br>
> case, perhaps? Either way, you could avoid wkWidth/Height-dependent<br>
> calculations with the sample factor limit, if I'm reading the documentation<br>
> correctly.<br>
><br>
> I think the application Micah has in mind would involve transferring the<br>
> image over the web and using a browser-side piece of software to subset the<br>
> image to the desired visible region. Plotting resolution issues were the<br>
> problem when I tried something a while ago, so it would be interesting to<br>
> find the most efficient way of hi-res plotting of an entire global grid and<br>
> getting a subset to a web-based user.<br>
><br>
><br>
> Kyle<br>
><br>
> ----------------------------------------<br>
> Kyle S. Griffin<br>
> Department of Atmospheric and Oceanic Sciences<br>
> University of Wisconsin - Madison<br>
> Room 1421<br>
> 1225 W Dayton St, Madison, WI 53706<br>
> Email: <a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a><br>
><br>
> On Thu, Oct 30, 2014 at 3:19 PM, David Brown <<a href="mailto:dbrown@ucar.edu">dbrown@ucar.edu</a>> wrote:<br>
>><br>
>> Compared with high resolution PostScript files, high resolution PNG<br>
>> images do seem to be much more cost effective in terms of file size<br>
>> and quickness to load and manipulate by typical viewing tools like Mac<br>
>> Preview.<br>
>><br>
>> Ideally you would want a PNG image that is close to the same<br>
>> resolution as your data or higher. In order to get this with an NCL<br>
>> "RasterFill" plot there are two things you need to adjust: the output<br>
>> workstation resolution, controlled by "wkWidth" and "wkHeight", and<br>
>> the resolution that the raster fill method uses when drawing, which is<br>
>> most easily controlled by setting the resource "cnRasterCellSizeF" to<br>
>> a suitable small number. Note that the workstation resources set a<br>
>> resolution for the plot as a whole, including the annotations and any<br>
>> white space that surrounds the plot, while the raster cell size only<br>
>> relates to the area inside the viewport of the actual plot -- just<br>
>> something to keep in mind.<br>
>><br>
>> For example, to visualize a 65,000,000 cell MPAS grid with maximum<br>
>> possible detail, I set<br>
>> wkWidth and wkHeight to 16384 (a power of 2 but not really necessary<br>
>> -- it could have been 16000).<br>
>> Then I set cnRasterCellSizeF to 1.0/16384.0 Nothing magical about<br>
>> these numbers, and they don't account for the whole plot vs viewport<br>
>> issue mathematically, but they do produce a very detailed image. The<br>
>> output PNG file is about 40 MB -- too big to attach to this message<br>
>> unfortunately.<br>
>><br>
>> We should probably have an example or two showing how to create<br>
>> high-res graphics.<br>
>> -dave<br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>><br>
>> On Thu, Oct 30, 2014 at 11:30 AM, Micah Sklut <<a href="mailto:micahs2005@gmail.com">micahs2005@gmail.com</a>><br>
>> wrote:<br>
>> > Okay, thanks for explaining how the raster fill works Kyle. That does<br>
>> > help<br>
>> > me understand this limitation. With respect to processing time between<br>
>> > rasterFill and areaFill. It took about 1-2 minutes for rasterFill,<br>
>> > compared<br>
>> > to a ball park of 4 hours for areaFill. Quite a difference!<br>
>> ><br>
>> > On Thu, Oct 30, 2014 at 1:26 PM, Kyle Griffin <<a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a>><br>
>> > wrote:<br>
>> >><br>
>> >> That's part of the definition of Raster fill - it will always create<br>
>> >> the<br>
>> >> same number of boxes regardless of resolution of the data underneath,<br>
>> >> typically based on an average of the data points within that set of<br>
>> >> grid<br>
>> >> points. Although I'm not knowledgeable about the behind-the-scenes<br>
>> >> computations, I know it's common for NCL to mark the whole average as<br>
>> >> missing if any subset of that average is missing. I'm not sure if<br>
>> >> there's a<br>
>> >> way to override this - a developer might need to chime in here - but<br>
>> >> that<br>
>> >> would be your only hope if you want to keep your image production time<br>
>> >> down,<br>
>> >> as the other fill modes will almost certainly be more intensive. You<br>
>> >> can<br>
>> >> scan examples of Raster Fill code here (see link) and in the contour<br>
>> >> resources page as well.<br>
>> >><br>
>> >> <a href="https://www.ncl.ucar.edu/Applications/raster.shtml" target="_blank">https://www.ncl.ucar.edu/Applications/raster.shtml</a><br>
>> >><br>
>> >> If you did AreaFill or CellFill, I don't think you see much difference<br>
>> >> in<br>
>> >> the time to produce a vector file output versus a raster image output.<br>
>> >> But<br>
>> >> yes, what you are seeing is a limitation of using the RasterFill<br>
>> >> setting.<br>
>> >><br>
>> >><br>
>> >> Kyle<br>
>> >><br>
>> >> ----------------------------------------<br>
>> >> Kyle S. Griffin<br>
>> >> Department of Atmospheric and Oceanic Sciences<br>
>> >> University of Wisconsin - Madison<br>
>> >> Room 1421<br>
>> >> 1225 W Dayton St, Madison, WI 53706<br>
>> >> Email: <a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a><br>
>> >><br>
>> >> On Thu, Oct 30, 2014 at 11:55 AM, Micah Sklut <<a href="mailto:micahs2005@gmail.com">micahs2005@gmail.com</a>><br>
>> >> wrote:<br>
>> >>><br>
>> >>> No, I"m not masking data. Yes, I am using RasterFill, and the<br>
>> >>> resulting<br>
>> >>> image for the Mid Atlantic is great. But, when I expand to global, I<br>
>> >>> lose<br>
>> >>> the high detail, no matter how much I increase the png resolution. So,<br>
>> >>> just<br>
>> >>> wondering why I am losing detail with the global image, and if there<br>
>> >>> is a<br>
>> >>> way around it.<br>
>> >>><br>
>> >>> On Thu, Oct 30, 2014 at 12:52 PM, Kyle Griffin <<a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a>><br>
>> >>> wrote:<br>
>> >>>><br>
>> >>>> Hi Micah,<br>
>> >>>><br>
>> >>>> This seems to me the type of result you would expect when using<br>
>> >>>> RasterFill as a cnFillMode - the default should be cnAreaFill, which<br>
>> >>>> increases plot time significantly, but might that be an issue?<br>
>> >>>> Otherwise, I assume you're doing nothing else to mask the data,<br>
>> >>>> correct?<br>
>> >>>> Sometimes masking data with a land mask can create similar<br>
>> >>>> blockiness,<br>
>> >>>> although I am unaware (via inexperience) as to whether there is a<br>
>> >>>> resolution<br>
>> >>>> dependence based on the plot size or native data resolution.<br>
>> >>>><br>
>> >>>><br>
>> >>>> Kyle<br>
>> >>>><br>
>> >>>> ----------------------------------------<br>
>> >>>> Kyle S. Griffin<br>
>> >>>> Department of Atmospheric and Oceanic Sciences<br>
>> >>>> University of Wisconsin - Madison<br>
>> >>>> Room 1421<br>
>> >>>> 1225 W Dayton St, Madison, WI 53706<br>
>> >>>> Email: <a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a><br>
>> >>>><br>
>> >>>> On Thu, Oct 30, 2014 at 11:37 AM, Micah Sklut <<a href="mailto:micahs2005@gmail.com">micahs2005@gmail.com</a>><br>
>> >>>> wrote:<br>
>> >>>>><br>
>> >>>>> Hi Kyle,<br>
>> >>>>><br>
>> >>>>> Thanks for the reply.<br>
>> >>>>><br>
>> >>>>> The dataset is of 0.05 degree resolution, so that certainly isn't<br>
>> >>>>> the<br>
>> >>>>> problem. I have attached an image of the same data, but limiting the<br>
>> >>>>> min/max<br>
>> >>>>> lat/lon to the US Mid Atlantic. In this image you will see much more<br>
>> >>>>> detail.<br>
>> >>>>> This is the type of detail I was hoping to achieve for the entire<br>
>> >>>>> globe. I<br>
>> >>>>> figured if I increased the resolution of the global png, it would<br>
>> >>>>> create the<br>
>> >>>>> desired effect, but as you can see from the global image I attached,<br>
>> >>>>> this<br>
>> >>>>> wasn't the case.<br>
>> >>>>><br>
>> >>>>> Looking forward to hearing your thoughts.<br>
>> >>>>> Thank you,<br>
>> >>>>><br>
>> >>>>> Micah<br>
>> >>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>> On Thu, Oct 30, 2014 at 12:26 PM, Kyle Griffin <<a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a>><br>
>> >>>>> wrote:<br>
>> >>>>>><br>
>> >>>>>> Micah,<br>
>> >>>>>><br>
>> >>>>>> This looks more like a limitation of your dataset - SST data is not<br>
>> >>>>>> of<br>
>> >>>>>> infinite resolution, and you're plotting far more pixels than would<br>
>> >>>>>> be data<br>
>> >>>>>> points in even a 0.1˚ dataset! It looks like the internal pixels<br>
>> >>>>>> are the<br>
>> >>>>>> same size as your coastlines, so I don't see an issue with NCL<br>
>> >>>>>> there. More<br>
>> >>>>>> specifically, you are not actually plotting coastlines - they only<br>
>> >>>>>> plot if<br>
>> >>>>>> you tell them to plot with a call to gsn_csm_map or another similar<br>
>> >>>>>> plotting<br>
>> >>>>>> tool. If you're looking for high resolution coastlines, look at the<br>
>> >>>>>> RANGS<br>
>> >>>>>> mapping capabilities in NCL. Beyond that, you can always plot<br>
>> >>>>>> shapefiles as<br>
>> >>>>>> well.<br>
>> >>>>>><br>
>> >>>>>> Yes, vector images are going to be extremely large and painful for<br>
>> >>>>>> even a moderate resolution file over the full globe. When you say<br>
>> >>>>>> raster,<br>
>> >>>>>> are you talking about it in the image sense (non-vector file) or in<br>
>> >>>>>> the<br>
>> >>>>>> cnFillMode sense (RasterFill, AreaFill, etc.;<br>
>> >>>>>><br>
>> >>>>>> <a href="https://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillMode" target="_blank">https://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillMode</a>)?<br>
>> >>>>>> Raster fill mode will make the data more blocky and reduce<br>
>> >>>>>> interpolation<br>
>> >>>>>> between points, but the trade-off is a much faster plotting of the<br>
>> >>>>>> image and<br>
>> >>>>>> works well for high-resolution datasets being plotted at relatively<br>
>> >>>>>> low<br>
>> >>>>>> resolution/wide zoom.<br>
>> >>>>>><br>
>> >>>>>><br>
>> >>>>>> Kyle<br>
>> >>>>>><br>
>> >>>>>> ----------------------------------------<br>
>> >>>>>> Kyle S. Griffin<br>
>> >>>>>> Department of Atmospheric and Oceanic Sciences<br>
>> >>>>>> University of Wisconsin - Madison<br>
>> >>>>>> Room 1421<br>
>> >>>>>> 1225 W Dayton St, Madison, WI 53706<br>
>> >>>>>> Email: <a href="mailto:ksgriffin2@wisc.edu">ksgriffin2@wisc.edu</a><br>
>> >>>>>><br>
>> >>>>>> On Thu, Oct 30, 2014 at 9:58 AM, Micah Sklut <<a href="mailto:micahs2005@gmail.com">micahs2005@gmail.com</a>><br>
>> >>>>>> wrote:<br>
>> >>>>>>><br>
>> >>>>>>> Hi,<br>
>> >>>>>>><br>
>> >>>>>>> This is a follow up to my previous posts, in reference to<br>
>> >>>>>>> searching<br>
>> >>>>>>> for high resolution images that could be used as<br>
>> >>>>>>> zooming/navigating<br>
>> >>>>>>> (specific interest is with image tile layers).<br>
>> >>>>>>><br>
>> >>>>>>> I figured if I created a png file with a high resolution, it would<br>
>> >>>>>>> be<br>
>> >>>>>>> able to capture the high detail, like with coastlines and so<br>
>> >>>>>>> forth.<br>
>> >>>>>>> I've attached an image with very high resolution (16384x16384),<br>
>> >>>>>>> but<br>
>> >>>>>>> as you can see, if you zoom the global image into the coastlines<br>
>> >>>>>>> they are<br>
>> >>>>>>> extremely blocky.<br>
>> >>>>>>><br>
>> >>>>>>> Is is possible to capture high resolution features, such as<br>
>> >>>>>>> coastlines in a global raster image with NCL?<br>
>> >>>>>>><br>
>> >>>>>>> FYI, I tried the vector image route, but the file size was<br>
>> >>>>>>> gigantic,<br>
>> >>>>>>> so that didn't seem like a proper route.<br>
>> >>>>>>><br>
>> >>>>>>> Thank you,<br>
>> >>>>>>><br>
>> >>>>>>> --<br>
>> >>>>>>> Micah Sklut<br>
>> >>>>>>><br>
>> >>>>>>> _______________________________________________<br>
>> >>>>>>> ncl-talk mailing list<br>
>> >>>>>>> List instructions, subscriber options, unsubscribe:<br>
>> >>>>>>> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>> >>>>>>><br>
>> >>>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>><br>
>> >>>>> --<br>
>> >>>>> Micah Sklut<br>
>> >>>>><br>
>> >>>><br>
>> >>><br>
>> >>><br>
>> >>><br>
>> >>> --<br>
>> >>> Micah Sklut<br>
>> >>><br>
>> >><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Micah Sklut<br>
>> ><br>
>> ><br>
>> > _______________________________________________<br>
>> > ncl-talk mailing list<br>
>> > List instructions, subscriber options, unsubscribe:<br>
>> > <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
>> ><br>
><br>
><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Micah Sklut<br><br>
</div>