I wrote down "arcpy.md" in my notes from the Esri User Conference, with little context, except to look into using that to fiddle with metadata. I can't find any arcpy documention on this "md" sub-package in ArcGIS Pro's documentation, but Google takes me to "arcpy.md". I can import both of them in Python, but without any documentation, I'm not sure what the arcpy.md functionality is. Or is this just a shortcut to arcpy.metadata?
Solved! Go to Solution.
multidimentional tools
C:\...your install path...\Resources\ArcPy\arcpy\md.py
# ---- vs
C:\...your install path...\Resources\ArcPy\arcpy\metadata.py
Just don't import them both and expect to use *md* as the shortcut
Metadata—ArcGIS Pro | Documentation
An abbreviation like the commonly used >>> import numpy as np
from arcpy import metadata as md
Yes, I've seen that convention, which further adds to the confusion. But there is a sub-package named arcpy.md (not just an alias), and my understanding is that it's pretty new.
(arcgispro-py3) C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3>python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy.md
>>> arcpy.md
<module 'arcpy.md' from 'C:\\Program Files\\ArcGIS\\Pro\\Resources\\ArcPy\\arcpy\\md.py'>
multidimentional tools
C:\...your install path...\Resources\ArcPy\arcpy\md.py
# ---- vs
C:\...your install path...\Resources\ArcPy\arcpy\metadata.py
Just don't import them both and expect to use *md* as the shortcut
Just in case anyone else stumbles across this thread, here is the overview of the Multidimension toolbox. The tools have Python examples showing use of the toolbox's alias arcpy.md.
I still think *met* and *mud* would have been better choices to avoid potential clashes with the doctors (md)
The Python examples provided in the metadata module's documentation are just examples, provided independently of any other module. The alias a person uses in their own script should be suitable for their work given whatever toolboxes and modules they are using. If someone is writing scripts for processing and managing multidimensional data, I would imagine any part of that script dealing with the data's metadata might be a small contribution and unworthy of even assigning an alias to the module. Certainly, the people I know who write Python scripts for managing metadata are not processing and managing multidimensional data at the same time. In the metadata world, the mp (metadata parser) utility provided by the USGS that has been in use for ~25 years is so ubiquitous it would have been an obvious choice as an alias, but that obviously has a conflict with the word mapping and arcpy.mp. I think if it was easier to find out what a toolbox's arcpy alias is, this question wouldn't even exist. That is something to work towards.
Hi Aletta. Is the USGS tool you mentioned included in ArcPy functionality, or is that a separate package?
The mp utility is an independent, command line utility for validating and processing metadata that is formatted according to the FGDC CSDGM metadata standard. You can learn about it and download the latest version here: A compiler for formal metadata. You can easily incorporate it into your Python scripts if your goal is to create CSDGM-compliant metadata, and an example is shown here: Migrating metadata scripts from ArcMap to ArcGIS Pro—ArcGIS Pro | Documentation.
But, I just realized that example is missing a key piece. The XML that is used as input to the mp utility must first be produced by exporting your item's metadata to a CSDGM-format XML file first. There is an example shown on that same page here Migrating metadata scripts from ArcMap to ArcGIS Pro—ArcGIS Pro | Documentation, with full documentation for the exportMetadata function provided in the documentation for the Metadata module. Set the metadata_export_option parameter to FGDC_CSDGM.