SKIMulator Arctic survey - python code issue - “import skimulator.rw_data as rw” [on hold]











up vote
-1
down vote

favorite












I am working with python code for the SKIMulator software, used in polar ice research - mapping the Arctic. Can anyone help with this error message:



 File "mod_plot.py", line 10, in <module>
import skimulator.rw_data as rw


I am new to python and cannot find anything resembling import skimulator.rw_data as rw on the internet.



The rest of the error message is here:



bjd@brendan:~/software/SKIMulator/skimulator.git/test$ python mod_plot.py 
Traceback (most recent call last):
File "mod_plot.py", line 10, in <module>
import skimulator.rw_data as rw
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
File "/home/bjd/anaconda3/lib/python3.6/site-packages/skimulator-1.0-py3.6.egg/skimulator/__init__.py", line 62, in <module>
File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1221, in resource_filename
self, resource_name
File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1734, in get_resource_filename
return self._extract_resource(manager, zip_path)
File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1755, in _extract_resource
timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
KeyError: 'skimulator/share/VERSION.txt'


The mod_plot.py code is here:



import numpy
import netCDF4
import os
import sys
import glob
import matplotlib
matplotlib.use('Agg')
from matplotlib import pyplot
import cartopy
import skimulator.rw_data as rw
import params as p

# Initialize color
listcolor = ['c', 'y', 'b', 'g', 'k', 'r', 'c', 'y']

projection = cartopy.crs.PlateCarree()
transform = cartopy.crs.PlateCarree()


def plot_all(listfile, modelbox, output):
# Initialize plot
projection = cartopy.crs.PlateCarree()
transform = cartopy.crs.PlateCarree()
fig = pyplot.figure(figsize=(12,12))
if modelbox is None:
projection = cartopy.crs.Orthographic(0, 0)
ax = pyplot.axes(projection=projection)
if modelbox is not None:
ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
crs=transform)
norder = 6
else:
ax.set_global()
norder = 1
#ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
#ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
linestyle='--', alpha=0.5)
gl.xlabels_top = False
gl.ylabels_left = False
# Loop on files
for ifile in listfile:
data = netCDF4.Dataset(ifile, 'r')
lon = data['lon'][:]
lat = data['lat'][:]
lon = numpy.mod(lon + 180.0, 360.0) - 180.0
lon_nadir = data['lon_nadir'][:]
lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
lat_nadir = data['lat_nadir'][:]
data.close()
pyplot.plot(lon[:, 0], lat[:, 0], '.', color=listcolor[0], markersize=1,
transform=transform)
pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
transform=transform)
# Save figure
pyplot.savefig(output)
return fig


def plot_variable(listfile, nvar, modelbox, output):
# Initialize plot
projection = cartopy.crs.PlateCarree()
transform = cartopy.crs.PlateCarree()
fig = pyplot.figure(figsize=(12,12))
if modelbox is None:
projection = cartopy.crs.Orthographic(0, 0)
ax = pyplot.axes(projection=projection)
if modelbox is not None:
ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
crs=transform)
norder = 6
else:
ax.set_global()
norder = 1
#ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
linestyle='--', alpha=0.5)
gl.xlabels_top = False
gl.ylabels_left = False
# Loop on files
for ifile in listfile:
data = netCDF4.Dataset(ifile, 'r')
lon = data['lon'][:]
lat = data['lat'][:]
lon = numpy.mod(lon + 180.0, 360.0) - 180.0
lon_nadir = data['lon_nadir'][:]
lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
lat_nadir = data['lat_nadir'][:]
var = data[nvar][:]
radial_angle = data['radial_angle'][:]
data.close()
for i in range(numpy.shape(lon)[1]):
if var[:, i].mask.all():
continue
try:
pyplot.scatter(lon[:, i], lat[:, i], c=var[:, i], cmap='jet',
vmin=-1, vmax=1, s=1,
#color=listcolor[0], markersize=1,
transform=transform)
except:
continue
pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
transform=transform)
try:
pyplot.colorbar()
except:
pass
# Save figure
# pyplot.savefig(output)
return fig


def plot_vectors(listfile, nvar, modelbox, output, scale=20):
# Initialize plot
projection = cartopy.crs.PlateCarree()
transform = cartopy.crs.PlateCarree()
fig = pyplot.figure(figsize=(12,12))
if modelbox is None:
projection = cartopy.crs.Orthographic(0, 0)
ax = pyplot.axes(projection=projection)
if modelbox is not None:
ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
crs=transform)
norder = 6
else:
ax.set_global()
norder = 1
#ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
linestyle='--', alpha=0.5)
gl.xlabels_top = False
gl.ylabels_left = False
# Loop on files
for ifile in listfile:
data = netCDF4.Dataset(ifile, 'r')
lon = data['lon'][:]
lat = data['lat'][:]
lon = numpy.mod(lon + 180.0, 360.0) - 180.0
lon_nadir = data['lon_nadir'][:]
lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
lat_nadir = data['lat_nadir'][:]
var = data[nvar][:]
radial_angle = data['radial_angle'][:]
u_true = data['ucur'][:]
v_true = data['vcur'][:]
uvar = var * numpy.cos(radial_angle)
vvar = var * numpy.sin(radial_angle)
data.close()
for i in range(numpy.shape(lon)[1]):
pyplot.quiver(lon[:, i], lat[:, i], u_true[:, i], v_true[:, i],
transform=transform, color='green', scale=scale)
pyplot.quiver(lon[:, i], lat[:, i], uvar[:, i], vvar[:, i],
transform=transform, color='red', scale=scale)
pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
transform=transform)
# Save figure
pyplot.savefig(output)
return fig









share|improve this question







New contributor




Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal 2 days ago


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

If this question can be reworded to fit the rules in the help center, please edit the question.

















    up vote
    -1
    down vote

    favorite












    I am working with python code for the SKIMulator software, used in polar ice research - mapping the Arctic. Can anyone help with this error message:



     File "mod_plot.py", line 10, in <module>
    import skimulator.rw_data as rw


    I am new to python and cannot find anything resembling import skimulator.rw_data as rw on the internet.



    The rest of the error message is here:



    bjd@brendan:~/software/SKIMulator/skimulator.git/test$ python mod_plot.py 
    Traceback (most recent call last):
    File "mod_plot.py", line 10, in <module>
    import skimulator.rw_data as rw
    File "<frozen importlib._bootstrap>", line 971, in _find_and_load
    File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
    File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
    File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
    File "/home/bjd/anaconda3/lib/python3.6/site-packages/skimulator-1.0-py3.6.egg/skimulator/__init__.py", line 62, in <module>
    File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1221, in resource_filename
    self, resource_name
    File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1734, in get_resource_filename
    return self._extract_resource(manager, zip_path)
    File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1755, in _extract_resource
    timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
    KeyError: 'skimulator/share/VERSION.txt'


    The mod_plot.py code is here:



    import numpy
    import netCDF4
    import os
    import sys
    import glob
    import matplotlib
    matplotlib.use('Agg')
    from matplotlib import pyplot
    import cartopy
    import skimulator.rw_data as rw
    import params as p

    # Initialize color
    listcolor = ['c', 'y', 'b', 'g', 'k', 'r', 'c', 'y']

    projection = cartopy.crs.PlateCarree()
    transform = cartopy.crs.PlateCarree()


    def plot_all(listfile, modelbox, output):
    # Initialize plot
    projection = cartopy.crs.PlateCarree()
    transform = cartopy.crs.PlateCarree()
    fig = pyplot.figure(figsize=(12,12))
    if modelbox is None:
    projection = cartopy.crs.Orthographic(0, 0)
    ax = pyplot.axes(projection=projection)
    if modelbox is not None:
    ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
    crs=transform)
    norder = 6
    else:
    ax.set_global()
    norder = 1
    #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
    #ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
    gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
    linestyle='--', alpha=0.5)
    gl.xlabels_top = False
    gl.ylabels_left = False
    # Loop on files
    for ifile in listfile:
    data = netCDF4.Dataset(ifile, 'r')
    lon = data['lon'][:]
    lat = data['lat'][:]
    lon = numpy.mod(lon + 180.0, 360.0) - 180.0
    lon_nadir = data['lon_nadir'][:]
    lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
    lat_nadir = data['lat_nadir'][:]
    data.close()
    pyplot.plot(lon[:, 0], lat[:, 0], '.', color=listcolor[0], markersize=1,
    transform=transform)
    pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
    transform=transform)
    # Save figure
    pyplot.savefig(output)
    return fig


    def plot_variable(listfile, nvar, modelbox, output):
    # Initialize plot
    projection = cartopy.crs.PlateCarree()
    transform = cartopy.crs.PlateCarree()
    fig = pyplot.figure(figsize=(12,12))
    if modelbox is None:
    projection = cartopy.crs.Orthographic(0, 0)
    ax = pyplot.axes(projection=projection)
    if modelbox is not None:
    ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
    crs=transform)
    norder = 6
    else:
    ax.set_global()
    norder = 1
    #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
    ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
    gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
    linestyle='--', alpha=0.5)
    gl.xlabels_top = False
    gl.ylabels_left = False
    # Loop on files
    for ifile in listfile:
    data = netCDF4.Dataset(ifile, 'r')
    lon = data['lon'][:]
    lat = data['lat'][:]
    lon = numpy.mod(lon + 180.0, 360.0) - 180.0
    lon_nadir = data['lon_nadir'][:]
    lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
    lat_nadir = data['lat_nadir'][:]
    var = data[nvar][:]
    radial_angle = data['radial_angle'][:]
    data.close()
    for i in range(numpy.shape(lon)[1]):
    if var[:, i].mask.all():
    continue
    try:
    pyplot.scatter(lon[:, i], lat[:, i], c=var[:, i], cmap='jet',
    vmin=-1, vmax=1, s=1,
    #color=listcolor[0], markersize=1,
    transform=transform)
    except:
    continue
    pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
    transform=transform)
    try:
    pyplot.colorbar()
    except:
    pass
    # Save figure
    # pyplot.savefig(output)
    return fig


    def plot_vectors(listfile, nvar, modelbox, output, scale=20):
    # Initialize plot
    projection = cartopy.crs.PlateCarree()
    transform = cartopy.crs.PlateCarree()
    fig = pyplot.figure(figsize=(12,12))
    if modelbox is None:
    projection = cartopy.crs.Orthographic(0, 0)
    ax = pyplot.axes(projection=projection)
    if modelbox is not None:
    ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
    crs=transform)
    norder = 6
    else:
    ax.set_global()
    norder = 1
    #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
    ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
    gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
    linestyle='--', alpha=0.5)
    gl.xlabels_top = False
    gl.ylabels_left = False
    # Loop on files
    for ifile in listfile:
    data = netCDF4.Dataset(ifile, 'r')
    lon = data['lon'][:]
    lat = data['lat'][:]
    lon = numpy.mod(lon + 180.0, 360.0) - 180.0
    lon_nadir = data['lon_nadir'][:]
    lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
    lat_nadir = data['lat_nadir'][:]
    var = data[nvar][:]
    radial_angle = data['radial_angle'][:]
    u_true = data['ucur'][:]
    v_true = data['vcur'][:]
    uvar = var * numpy.cos(radial_angle)
    vvar = var * numpy.sin(radial_angle)
    data.close()
    for i in range(numpy.shape(lon)[1]):
    pyplot.quiver(lon[:, i], lat[:, i], u_true[:, i], v_true[:, i],
    transform=transform, color='green', scale=scale)
    pyplot.quiver(lon[:, i], lat[:, i], uvar[:, i], vvar[:, i],
    transform=transform, color='red', scale=scale)
    pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
    transform=transform)
    # Save figure
    pyplot.savefig(output)
    return fig









    share|improve this question







    New contributor




    Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.











    put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal 2 days ago


    This question appears to be off-topic. The users who voted to close gave this specific reason:


    • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

    If this question can be reworded to fit the rules in the help center, please edit the question.















      up vote
      -1
      down vote

      favorite









      up vote
      -1
      down vote

      favorite











      I am working with python code for the SKIMulator software, used in polar ice research - mapping the Arctic. Can anyone help with this error message:



       File "mod_plot.py", line 10, in <module>
      import skimulator.rw_data as rw


      I am new to python and cannot find anything resembling import skimulator.rw_data as rw on the internet.



      The rest of the error message is here:



      bjd@brendan:~/software/SKIMulator/skimulator.git/test$ python mod_plot.py 
      Traceback (most recent call last):
      File "mod_plot.py", line 10, in <module>
      import skimulator.rw_data as rw
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/skimulator-1.0-py3.6.egg/skimulator/__init__.py", line 62, in <module>
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1221, in resource_filename
      self, resource_name
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1734, in get_resource_filename
      return self._extract_resource(manager, zip_path)
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1755, in _extract_resource
      timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
      KeyError: 'skimulator/share/VERSION.txt'


      The mod_plot.py code is here:



      import numpy
      import netCDF4
      import os
      import sys
      import glob
      import matplotlib
      matplotlib.use('Agg')
      from matplotlib import pyplot
      import cartopy
      import skimulator.rw_data as rw
      import params as p

      # Initialize color
      listcolor = ['c', 'y', 'b', 'g', 'k', 'r', 'c', 'y']

      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()


      def plot_all(listfile, modelbox, output):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      #ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      data.close()
      pyplot.plot(lon[:, 0], lat[:, 0], '.', color=listcolor[0], markersize=1,
      transform=transform)
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      # Save figure
      pyplot.savefig(output)
      return fig


      def plot_variable(listfile, nvar, modelbox, output):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      var = data[nvar][:]
      radial_angle = data['radial_angle'][:]
      data.close()
      for i in range(numpy.shape(lon)[1]):
      if var[:, i].mask.all():
      continue
      try:
      pyplot.scatter(lon[:, i], lat[:, i], c=var[:, i], cmap='jet',
      vmin=-1, vmax=1, s=1,
      #color=listcolor[0], markersize=1,
      transform=transform)
      except:
      continue
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      try:
      pyplot.colorbar()
      except:
      pass
      # Save figure
      # pyplot.savefig(output)
      return fig


      def plot_vectors(listfile, nvar, modelbox, output, scale=20):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      var = data[nvar][:]
      radial_angle = data['radial_angle'][:]
      u_true = data['ucur'][:]
      v_true = data['vcur'][:]
      uvar = var * numpy.cos(radial_angle)
      vvar = var * numpy.sin(radial_angle)
      data.close()
      for i in range(numpy.shape(lon)[1]):
      pyplot.quiver(lon[:, i], lat[:, i], u_true[:, i], v_true[:, i],
      transform=transform, color='green', scale=scale)
      pyplot.quiver(lon[:, i], lat[:, i], uvar[:, i], vvar[:, i],
      transform=transform, color='red', scale=scale)
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      # Save figure
      pyplot.savefig(output)
      return fig









      share|improve this question







      New contributor




      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I am working with python code for the SKIMulator software, used in polar ice research - mapping the Arctic. Can anyone help with this error message:



       File "mod_plot.py", line 10, in <module>
      import skimulator.rw_data as rw


      I am new to python and cannot find anything resembling import skimulator.rw_data as rw on the internet.



      The rest of the error message is here:



      bjd@brendan:~/software/SKIMulator/skimulator.git/test$ python mod_plot.py 
      Traceback (most recent call last):
      File "mod_plot.py", line 10, in <module>
      import skimulator.rw_data as rw
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 656, in _load_unlocked
      File "<frozen importlib._bootstrap>", line 626, in _load_backward_compatible
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/skimulator-1.0-py3.6.egg/skimulator/__init__.py", line 62, in <module>
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1221, in resource_filename
      self, resource_name
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1734, in get_resource_filename
      return self._extract_resource(manager, zip_path)
      File "/home/bjd/anaconda3/lib/python3.6/site-packages/pkg_resources/__init__.py", line 1755, in _extract_resource
      timestamp, size = self._get_date_and_size(self.zipinfo[zip_path])
      KeyError: 'skimulator/share/VERSION.txt'


      The mod_plot.py code is here:



      import numpy
      import netCDF4
      import os
      import sys
      import glob
      import matplotlib
      matplotlib.use('Agg')
      from matplotlib import pyplot
      import cartopy
      import skimulator.rw_data as rw
      import params as p

      # Initialize color
      listcolor = ['c', 'y', 'b', 'g', 'k', 'r', 'c', 'y']

      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()


      def plot_all(listfile, modelbox, output):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      #ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      data.close()
      pyplot.plot(lon[:, 0], lat[:, 0], '.', color=listcolor[0], markersize=1,
      transform=transform)
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      # Save figure
      pyplot.savefig(output)
      return fig


      def plot_variable(listfile, nvar, modelbox, output):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      var = data[nvar][:]
      radial_angle = data['radial_angle'][:]
      data.close()
      for i in range(numpy.shape(lon)[1]):
      if var[:, i].mask.all():
      continue
      try:
      pyplot.scatter(lon[:, i], lat[:, i], c=var[:, i], cmap='jet',
      vmin=-1, vmax=1, s=1,
      #color=listcolor[0], markersize=1,
      transform=transform)
      except:
      continue
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      try:
      pyplot.colorbar()
      except:
      pass
      # Save figure
      # pyplot.savefig(output)
      return fig


      def plot_vectors(listfile, nvar, modelbox, output, scale=20):
      # Initialize plot
      projection = cartopy.crs.PlateCarree()
      transform = cartopy.crs.PlateCarree()
      fig = pyplot.figure(figsize=(12,12))
      if modelbox is None:
      projection = cartopy.crs.Orthographic(0, 0)
      ax = pyplot.axes(projection=projection)
      if modelbox is not None:
      ax.set_extent([modelbox[0], modelbox[1], modelbox[2], modelbox[3]],
      crs=transform)
      norder = 6
      else:
      ax.set_global()
      norder = 1
      #ax.add_feature(cartopy.feature.OCEAN, zorder=norder)
      ax.add_feature(cartopy.feature.LAND, zorder=norder, edgecolor='black')
      gl = ax.gridlines(crs=transform, draw_labels=True, color='gray',
      linestyle='--', alpha=0.5)
      gl.xlabels_top = False
      gl.ylabels_left = False
      # Loop on files
      for ifile in listfile:
      data = netCDF4.Dataset(ifile, 'r')
      lon = data['lon'][:]
      lat = data['lat'][:]
      lon = numpy.mod(lon + 180.0, 360.0) - 180.0
      lon_nadir = data['lon_nadir'][:]
      lon_nadir = numpy.mod(lon_nadir + 180.0, 360) - 180.0
      lat_nadir = data['lat_nadir'][:]
      var = data[nvar][:]
      radial_angle = data['radial_angle'][:]
      u_true = data['ucur'][:]
      v_true = data['vcur'][:]
      uvar = var * numpy.cos(radial_angle)
      vvar = var * numpy.sin(radial_angle)
      data.close()
      for i in range(numpy.shape(lon)[1]):
      pyplot.quiver(lon[:, i], lat[:, i], u_true[:, i], v_true[:, i],
      transform=transform, color='green', scale=scale)
      pyplot.quiver(lon[:, i], lat[:, i], uvar[:, i], vvar[:, i],
      transform=transform, color='red', scale=scale)
      pyplot.plot(lon_nadir, lat_nadir, '.', color=listcolor[4], markersize=1,
      transform=transform)
      # Save figure
      pyplot.savefig(output)
      return fig






      python-3.x error-handling






      share|improve this question







      New contributor




      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 2 days ago









      Brendan Darrer

      11




      11




      New contributor




      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Brendan Darrer is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal 2 days ago


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

      If this question can be reworded to fit the rules in the help center, please edit the question.




      put on hold as off-topic by t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal 2 days ago


      This question appears to be off-topic. The users who voted to close gave this specific reason:


      • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – t3chb0t, Sᴀᴍ Onᴇᴌᴀ, 200_success, Jamal

      If this question can be reworded to fit the rules in the help center, please edit the question.



























          active

          oldest

          votes






















          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes

          Popular posts from this blog

          Morgemoulin

          Scott Moir

          Souastre