{"action":"created","issue":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/541","labels_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/541/labels{/name}","comments_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/541/comments","events_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/541/events","html_url":"https://github.com/UV-CDAT/uvcdat/issues/541","id":39712768,"number":541,"title":"hatches/patterns don't work in vcs 2.0.beta","user":{"login":"jypeter","id":2785573,"avatar_url":"https://avatars.githubusercontent.com/u/2785573?v=3","gravatar_id":"","url":"https://api.github.com/users/jypeter","html_url":"https://github.com/jypeter","followers_url":"https://api.github.com/users/jypeter/followers","following_url":"https://api.github.com/users/jypeter/following{/other_user}","gists_url":"https://api.github.com/users/jypeter/gists{/gist_id}","starred_url":"https://api.github.com/users/jypeter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jypeter/subscriptions","organizations_url":"https://api.github.com/users/jypeter/orgs","repos_url":"https://api.github.com/users/jypeter/repos","events_url":"https://api.github.com/users/jypeter/events{/privacy}","received_events_url":"https://api.github.com/users/jypeter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/labels/High%20Priority","name":"High Priority","color":"e11d21"},{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/labels/VCS","name":"VCS","color":"0b02e1"}],"state":"open","locked":false,"assignee":{"login":"sankhesh","id":936354,"avatar_url":"https://avatars.githubusercontent.com/u/936354?v=3","gravatar_id":"","url":"https://api.github.com/users/sankhesh","html_url":"https://github.com/sankhesh","followers_url":"https://api.github.com/users/sankhesh/followers","following_url":"https://api.github.com/users/sankhesh/following{/other_user}","gists_url":"https://api.github.com/users/sankhesh/gists{/gist_id}","starred_url":"https://api.github.com/users/sankhesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sankhesh/subscriptions","organizations_url":"https://api.github.com/users/sankhesh/orgs","repos_url":"https://api.github.com/users/sankhesh/repos","events_url":"https://api.github.com/users/sankhesh/events{/privacy}","received_events_url":"https://api.github.com/users/sankhesh/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/milestones/12","html_url":"https://github.com/UV-CDAT/uvcdat/milestones/2.3","labels_url":"https://api.github.com/repos/UV-CDAT/uvcdat/milestones/12/labels","id":962007,"number":12,"title":"2.3","description":"","creator":{"login":"doutriaux1","id":2781425,"avatar_url":"https://avatars.githubusercontent.com/u/2781425?v=3","gravatar_id":"","url":"https://api.github.com/users/doutriaux1","html_url":"https://github.com/doutriaux1","followers_url":"https://api.github.com/users/doutriaux1/followers","following_url":"https://api.github.com/users/doutriaux1/following{/other_user}","gists_url":"https://api.github.com/users/doutriaux1/gists{/gist_id}","starred_url":"https://api.github.com/users/doutriaux1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/doutriaux1/subscriptions","organizations_url":"https://api.github.com/users/doutriaux1/orgs","repos_url":"https://api.github.com/users/doutriaux1/repos","events_url":"https://api.github.com/users/doutriaux1/events{/privacy}","received_events_url":"https://api.github.com/users/doutriaux1/received_events","type":"User","site_admin":false},"open_issues":115,"closed_issues":51,"state":"open","created_at":"2015-02-02T18:34:50Z","updated_at":"2015-08-04T16:33:46Z","due_on":null,"closed_at":null},"comments":43,"created_at":"2014-08-07T10:36:06Z","updated_at":"2015-08-04T17:16:10Z","closed_at":null,"body":"The test script pasted at the end is supposed to plot a map with hatches, and a canvas with some test patterns\r\n\r\n * It works correctly with 1.5.1 (though I'm getting strange warning messages that I did not get in earlier versions)\r\n![test_fillarea](https://cloud.githubusercontent.com/assets/2785573/3840372/99cb17b8-1e1c-11e4-8db1-fb8070f31cc6.png)\r\n![test_fillarea_list](https://cloud.githubusercontent.com/assets/2785573/3840375/a6aa3540-1e1c-11e4-8a78-b24d3b3cbf8d.png)\r\n\r\n * In 2.0.beta, after typing *x.interact()* (I did not know about this one, but a Warning told me to use it), I get some *Nope no array[0]* messages and the display is not exactly what I expected. I have attached a screen copy below, since the generated png files are empty\r\n\r\n![hatch_pb_2 0 beta](https://cloud.githubusercontent.com/assets/2785573/3840458/e425a688-1e1d-11e4-942f-054d7ba6cf22.png)\r\n\r\n**The test script I used**\r\n\r\n```\r\n#!/usr/bin/env python\r\n\r\n# J-Y Peterschmitt - LSCE - 09/2011 - pmip2web@lsce.ipsl.fr\r\n\r\n# Test the use of hatches and patterns in the isofill\r\n# and fill area graphics methods\r\n\r\n# Import some standard modules\r\nimport sys, os\r\nfrom os import path\r\n\r\n# Import what we need from CDAT\r\nimport cdms2\r\nimport vcs\r\n\r\n# Some data we can plot from the 'sample_data' directory\r\n# supplied with CDAT\r\ndata_dir = path.join(sys.prefix, 'sample_data')\r\ndata_file = 'tas_ccsr-95a_1979.01-1979.12.nc'\r\nvar_name = 'tas'\r\n\r\n# Zone that we want to plot\r\n#\r\n# NOTE: the (latmin, latmax, lonmin, lonmax) information HAS TO be the\r\n# same in the variable, the 'isof' isofill method and the 2 'cont_*'\r\n# continents plotting methods! Otherwise, the data will not match the\r\n# continents that are plotted over it...\r\n(latmin, latmax, lonmin, lonmax) = (-90, 90, -180, 180)\r\n\r\n# Use black on white continents (nicer with black and white plots) i.e\r\n# we plot a 'large' white continent outline over the data, and then a\r\n# smaller 'black' continent outline\r\nbw_cont = False\r\n#bw_cont = True\r\n\r\n# Read one time step (the first one) from the data file\r\n# and explicitely specify the lat/lon range we need. cdms2\r\n# will retrieve the data in the order we want, regardless of the way\r\n# it is stored in the data file\r\nf = cdms2.open(path.join(data_dir, data_file))\r\nv = f(var_name, time=slice(0, 1), latitude=(latmin, latmax),\r\n      longitude=(lonmin, lonmax, 'co'), squeeze=1)\r\nf.close()\r\n\r\n# Initialize the graphics canvas\r\nx = vcs.init()\r\n\r\n# Create the isofill method\r\nisof = x.createisofill('test_hatch')\r\nisof.datawc(latmin, latmax, lonmin, lonmax)\r\nisof.levels = [220, 240, 260, 280, 300, 320]\r\nisof.fillareastyle = 'hatch'\r\nisof.fillareacolors = [241, 241, 241, 241, 241] # All black\r\n#isof.fillareacolors = [243, 248, 254, 255, 241] # Colors\r\nisof.fillareaindices = [20, 9, 2, 7, 3]\r\n\r\n# Define some graphics methods for plotting black on white continents\r\nif bw_cont:\r\n    cont_black = x.createcontinents('black')\r\n    cont_black.datawc(latmin, latmax, lonmin, lonmax)\r\n    cont_black.linecolor = 241\r\n    cont_black.linewidth = 2\r\n    cont_white = x.createcontinents('white')\r\n    cont_white.datawc(latmin, latmax, lonmin, lonmax)\r\n    cont_white.linecolor = 240\r\n    cont_white.linewidth = 6\r\n\r\n    cont_type = 0 # Do not plot the default continents\r\nelse:\r\n    cont_type = 1\r\n\r\n# Plot the test data\r\n#\r\n# We have to make sure the data and the continents are plotted at the\r\n# same place ('data' area) on the canvas, by using the same template!\r\n# It's even better if we can use for the continents a template that\r\n# will only plot the data area (the priority of the other elements of\r\n# the canvas is set to zero)\r\ntpl = x.createtemplate('tpl', 'default')\r\nx.plot(tpl, isof, v, continents=cont_type)\r\nif bw_cont:\r\n    tpl_data = x.createtemplate('tpl_data', 'default_dud') # plots only data area\r\n    x.plot(tpl_data, cont_white)\r\n    x.plot(tpl_data, cont_black)\r\n\r\n# Create a test plot for listing all the hatches and patterns\r\nstyle_list = []\r\nindex_list = []\r\ncol_cycle = [243, 248, 254, 241, 255]\r\nnb_cols = len(col_cycle)\r\ncolor_list = []\r\nx_list = []\r\ny_list = []\r\ntxt_x_list = []\r\ntxt_y_list = []\r\ntxt_str_list = []\r\n\r\nshear_x = .05\r\nfor j, style in enumerate(['hatch', 'pattern']):\r\n    slide_y = j * .4\r\n    for i in range(20):\r\n        slide_x = i * 0.04\r\n        x1, y1 = (.05 + slide_x, .25 + slide_y)\r\n        x2, y2 = (.08 + slide_x, .45 + slide_y)\r\n\r\n        # Add (sheared) rectangles to the list of positions\r\n        # NOTE: no need to close the fill area. Giving 4 vertices\r\n        #       for getting a filled rectangle is enough\r\n        x_list.append([x1, x2, x2 + shear_x, x1 + shear_x])\r\n        y_list.append([y1, y1, y2, y2])\r\n\r\n        style_list.append(style)\r\n        # Hatches/Patterns indices have to be in 1-20 range\r\n        index_list.append(i+1)\r\n        col_idx = col_cycle[i % nb_cols]\r\n        color_list.append(col_idx)\r\n\r\n        # Annotations\r\n        txt_x_list.append(x1 + 0.015)\r\n        txt_y_list.append(y1 - 0.015)\r\n        txt_str_list.append('%s = %i  -  Color = %i' %\r\n                             (style, i+1, col_idx))\r\n\r\n# Create the fill area and the text annotations\r\nfill_test = x.createfillarea('fill_test')\r\nfill_test.style = style_list\r\nfill_test.index = index_list\r\nfill_test.color = color_list\r\nfill_test.x = x_list\r\nfill_test.y = y_list\r\n\r\nfill_info = x.createtext('fill_info')\r\nfill_info.angle = 45\r\nfill_info.height = 12\r\nfill_info.color = 241 # Black\r\nfill_info.string = txt_str_list\r\nfill_info.x = txt_x_list\r\nfill_info.y = txt_y_list\r\n\r\n# Create a title\r\nplot_title = x.createtext('plot_title')\r\nplot_title.height = 40\r\nplot_title.string = ['Testing hatches and patterns in VCS/CDAT']\r\nplot_title.x = [.01]\r\nplot_title.y = [.9]\r\n\r\n# Initialize and use a second graphics canvas\r\ny = vcs.init()\r\ny.plot(plot_title)\r\ny.plot(fill_test)\r\ny.plot(fill_info)\r\n\r\n# Save the plots\r\nx.pdf('test_fillarea')\r\nx.png('test_fillarea')\r\ny.pdf('test_fillarea_list')\r\ny.png('test_fillarea_list')\r\n\r\n# Note: depending on the version of CDAT, text may not resize\r\n#       correctly when creating a bigger png\r\n#x.png('test_fillarea_big', width=3*11, height=3*8)\r\n#y.png('test_fillarea_list_big', width=3*11, height=3*8)\r\n\r\n# The end\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/comments/127680155","html_url":"https://github.com/UV-CDAT/uvcdat/issues/541#issuecomment-127680155","issue_url":"https://api.github.com/repos/UV-CDAT/uvcdat/issues/541","id":127680155,"user":{"login":"sankhesh","id":936354,"avatar_url":"https://avatars.githubusercontent.com/u/936354?v=3","gravatar_id":"","url":"https://api.github.com/users/sankhesh","html_url":"https://github.com/sankhesh","followers_url":"https://api.github.com/users/sankhesh/followers","following_url":"https://api.github.com/users/sankhesh/following{/other_user}","gists_url":"https://api.github.com/users/sankhesh/gists{/gist_id}","starred_url":"https://api.github.com/users/sankhesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sankhesh/subscriptions","organizations_url":"https://api.github.com/users/sankhesh/orgs","repos_url":"https://api.github.com/users/sankhesh/repos","events_url":"https://api.github.com/users/sankhesh/events{/privacy}","received_events_url":"https://api.github.com/users/sankhesh/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T17:16:10Z","updated_at":"2015-08-04T17:16:10Z","body":"Sounds good. I'll post some images here once I have something. "}}