Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit c51a4af

Browse files
Merge pull request #101 from NCAR/devel
Updates
2 parents 3c847a7 + 932482d commit c51a4af

File tree

4 files changed

+132
-19
lines changed

4 files changed

+132
-19
lines changed

CODE_OF_CONDUCT.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Contributor Code of Conduct
2+
_The Contributor Code of Conduct is for participants in our software projects and community._
3+
4+
## Our Pledge
5+
We, as contributors, creators, stewards, and maintainers (participants), of PyConform pledge to make participation in our software, system or hardware project and community a safe, productive, welcoming and inclusive experience for everyone.
6+
All participants are required to abide by this Code of Conduct.
7+
This includes respectful treatment of everyone regardless of age, body size, disability, ethnicity, gender identity or expression, level of experience, nationality, political affiliation, veteran status, pregnancy, genetic information, physical appearance, race, religion, or sexual orientation, as well as any other characteristic protected under applicable US federal or state law.
8+
9+
## Our Standards
10+
Examples of behaviors that contribute to a positive environment include:
11+
12+
* All participants are treated with respect and consideration, valuing a diversity of views and opinions
13+
* Be considerate, respectful, and collaborative
14+
* Communicate openly with respect for others, critiquing ideas rather than individuals and gracefully accepting criticism
15+
* Acknowledging the contributions of others
16+
* Avoid personal attacks directed toward other participants
17+
* Be mindful of your surroundings and of your fellow participants
18+
* Alert UCAR staff and suppliers/vendors if you notice a dangerous situation or someone in distress
19+
* Respect the rules and policies of the project and venue
20+
21+
Examples of unacceptable behavior include, but are not limited to:
22+
23+
* Harassment, intimidation, or discrimination in any form
24+
* Physical, verbal, or written abuse by anyone to anyone, including repeated use of pronouns other than those requested
25+
* Unwelcome sexual attention or advances
26+
* Personal attacks directed at other guests, members, participants, etc.
27+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
28+
* Alarming, intimidating, threatening, or hostile comments or conduct
29+
* Inappropriate use of nudity and/or sexual images
30+
* Threatening or stalking anyone, including a participant
31+
* Other conduct which could reasonably be considered inappropriate in a professional setting
32+
33+
## Scope
34+
This Code of Conduct applies to all spaces managed by the Project whether they be physical, online or face-to-face.
35+
This includes project code, code repository, associated web pages, documentation, mailing lists, project websites and wiki pages, issue tracker, meetings, telecons, events, project social media accounts, and any other forums created by the project team which the community uses for communication.
36+
In addition, violations of this Code of Conduct outside these spaces may affect a person's ability to participate within them.
37+
Representation of a project may be further defined and clarified by project maintainers.
38+
39+
## Community Responsibilities
40+
Everyone in the community is empowered to respond to people who are showing unacceptable behavior.
41+
They can talk to them privately or publicly.
42+
Anyone requested to stop unacceptable behavior is expected to comply immediately.
43+
If the behavior continues concerns may be brought to the project administrators or to any other party listed in the [Reporting](#reporting) section below.
44+
45+
## Project Administrator Responsibilities
46+
Project administrators are responsible for clarifying the standards of acceptable behavior and are encouraged to model appropriate behavior and provide support when people in the community point out inappropriate behavior.
47+
Project administrator(s) are normally the ones that would be tasked to carry out the actions in the [Consequences](#consequences) section below.
48+
49+
Project administrators are also expected to keep this Code of Conduct updated with the main one housed at UCAR, as listed below in the [Attribution](#attribution) section.
50+
51+
## Reporting
52+
Instances of unacceptable behavior can be brought to the attention of the project administrator(s) who may take any action as outlined in the [Consequences](#consequences) section below.
53+
However, making a report to a project administrator is not considered an 'official report' to UCAR.
54+
55+
Instances of unacceptable behavior may also be reported directly to UCAR pursuant to [UCAR's Harassment Reporting and Complaint Procedure](https://www2.fin.ucar.edu/procedures/hr/harassment-reporting-and-complaint-procedure), or anonymously through [UCAR's EthicsPoint Hotline](https://www2.fin.ucar.edu/ethics/anonymous-reporting).
56+
57+
Complaints received by UCAR will be handled pursuant to the procedures outlined in UCAR's Harassment Reporting and Complaint Procedure.
58+
Complaints to UCAR will be held as confidential as practicable under the circumstances, and retaliation against a person who initiates a complaint or an inquiry about inappropriate behavior will not be tolerated.
59+
60+
Any Contributor can use these reporting methods even if they are not directly affiliated with UCAR.
61+
The Frequently Asked Questions (FAQ) page for reporting is [here](https://www2.fin.ucar.edu/procedures/hr/reporting-faqs).
62+
63+
## Consequences
64+
Upon receipt of a complaint, the project administrator(s) may take any action deemed necessary and appropriate under the circumstances.
65+
Such action can include things such as: removing, editing, or rejecting comments, commits, code, wiki edits, email, issues, and other contributions that are not aligned to this Code of Conduct, or banning temporarily or permanently any contributor for other behaviors that are deemed inappropriate, threatening, offensive, or harmful.
66+
Project administrators also have the right to report violations to UCAR HR and/or UCAR's Office of Diversity, Equity and Inclusion (ODEI), as well as a participant's home institution and/or law enforcement.
67+
In the event an incident is reported to UCAR, UCAR will follow its Harassment Reporting and Complaint Procedure.
68+
69+
## Process for Changes
70+
All UCAR managed projects are required to adopt this Contributor Code of Conduct.
71+
Adoption is assumed even if not expressly stated in the repository.
72+
Projects should fill in sections where prompted with project-specific information, including, project name and adoption date.
73+
74+
Projects that adopt this Code of Conduct need to stay up to date with UCAR's Contributor Code of Conduct, linked with a DOI in the [Attribution](#attribution) section below.
75+
Projects can make limited substantive changes to the Code of Conduct, however, the changes must be limited in scope and may not contradict the UCAR Contributor Code of Conduct.
76+
77+
## Attribution
78+
This Code of Conduct was originally adapted from the [Contributor Covenant](http://contributor-covenant.org/version/1/4), version 1.4.
79+
We then aligned it with the UCAR Participant Code of Conduct, which also borrows from the American Geophysical Union (AGU) Code of Conduct.
80+
The UCAR Participant Code of Conduct applies to both UCAR employees as well as participants in activities run by UCAR.
81+
The original version of this for all software projects that have strong management from UCAR or UCAR staff is available on the UCAR website at https://doi.org/10.5065/6w2c-a132.
82+
The date that it was adopted by this project was Apr/7th/2020
83+
When responding to complaints, UCAR HR and ODEI will do so based on the latest published version.
84+
Therefore, any project-specific changes should follow the [Process for Changes](#process-for-changes) section above.

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.3895009.svg
2+
:target: https://doi.org/10.5281/zenodo.3895009
3+
14
PyConform
25
=========
36

scripts/iconform

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ def fill_missing_glob_attributes(attr, table, v, grids):
141141
for a,d in attr.iteritems():
142142
if d is not None:
143143
if "__FILL__" in d:
144-
if "activity_id" in a:
144+
if "activity_id" in a and "activity_id" in table:
145145
attr["activity_id"] = table["activity_id"]
146146
elif "creation_date" in a:
147147
attr["creation_date"]=""
148-
elif "data_specs_version" in a:
148+
elif "data_specs_version" in a and "data_specs_version" in table:
149149
attr["data_specs_version"] = table["data_specs_version"]
150-
elif "experiment" in a:
150+
elif "experiment" in a and "experiment" in table:
151151
attr["experiment"] = table["experiment"]
152152
elif "external_variables" in a:
153153
if "cell_measures" in v.keys():
@@ -252,23 +252,28 @@ def fill_missing_glob_attributes(attr, table, v, grids):
252252
attr["forcing_index"] = int(pre)
253253

254254
if "further_info_url" in attr.keys():
255+
url_ok = True
255256
if "__FILL__" in attr["further_info_url"]:
256257
if 'mip_era' in attr.keys():
257258
mip_era = attr['mip_era']
258259
else:
259260
mip_era = ''
261+
url_ok = False
260262
if 'institution_id' in attr.keys():
261263
institution_id = attr['institution_id']
262264
else:
263265
institution_id = ''
266+
url_ok = False
264267
if 'source_id' in attr.keys():
265268
source_id = attr['source_id']
266269
else:
267270
source_id = ''
271+
url_ok = False
268272
if 'experiment_id' in attr.keys():
269273
experiment_id = attr['experiment_id']
270274
else:
271275
experiment_id = ''
276+
url_ok = False
272277
if 'sub_experiment_id' in attr.keys():
273278
sub_experiment_id = attr['sub_experiment_id']
274279
else:
@@ -277,8 +282,10 @@ def fill_missing_glob_attributes(attr, table, v, grids):
277282
ripf = attr["variant_label"]
278283
else:
279284
ripf = ''
280-
info_url = "{0}.{1}.{2}.{3}.{4}.{5}".format(mip_era, institution_id, source_id, experiment_id, sub_experiment_id, ripf)
281-
attr['further_info_url'] = "https://furtherinfo.es-doc.org/" + info_url
285+
url_ok = False
286+
if url_ok:
287+
info_url = "{0}.{1}.{2}.{3}.{4}.{5}".format(mip_era, institution_id, source_id, experiment_id, sub_experiment_id, ripf)
288+
attr['further_info_url'] = "https://furtherinfo.es-doc.org/" + info_url
282289
if "grid" in attr.keys():
283290
if len(attr["realm"])>0:
284291
attr["grid"] = grids[attr["realm"].split()[0]]
@@ -319,7 +326,8 @@ def defineVar(v, varName, attr, table_info, definition, ig, experiment, out_dir)
319326
str(attributes['forcing_index'])))
320327
else:
321328
ripf = ''
322-
329+
if len(ripf) < 1:
330+
ripf = "None"
323331
if 'mip_era' in attributes.keys():
324332
mip_era = attributes['mip_era']
325333
else:
@@ -328,6 +336,8 @@ def defineVar(v, varName, attr, table_info, definition, ig, experiment, out_dir)
328336
activity_id = attributes['activity_id']
329337
else:
330338
activity_id = ''
339+
if '__FILL__' in activity_id:
340+
activity_id = 'None'
331341
if 'institution_id' in attributes.keys():
332342
institution_id = attributes['institution_id']
333343
else:
@@ -344,6 +354,8 @@ def defineVar(v, varName, attr, table_info, definition, ig, experiment, out_dir)
344354
sub_experiment_id = attributes['sub_experiment_id']
345355
else:
346356
sub_experiment_id = ''
357+
if '--ALL--' in experiment:
358+
experiment = 'None'
347359

348360
f_format = attributes["netcdf_type"]
349361
valid_formats = ['NETCDF4','NETCDF4_CLASSIC','NETCDF3_CLASSIC','NETCDF3_64BIT_OFFSET','NETCDF3_64BIT_DATA']
@@ -382,6 +394,12 @@ def defineVar(v, varName, attr, table_info, definition, ig, experiment, out_dir)
382394
vid, mipTable, source_id, experiment, ripf, grid, dst))
383395
var = {}
384396

397+
# Remove any __FILL__ values in attributes
398+
for a in attributes.keys():
399+
if isinstance(attributes[a],str):
400+
if '__FILL__' in attributes[a]:
401+
attributes[a] = ''
402+
385403
# put together the dictionary entry for this variable
386404
var["attributes"] = v2
387405
var["definition"] = definition
@@ -705,8 +723,8 @@ def main(argv=None):
705723
tables = ['--ALL--']
706724

707725
dq = dreq.loadDreq()
708-
if '--ALL--' in exps:
709-
exps = dq.inx.experiment.label.keys()
726+
#S if '--ALL--' in exps:
727+
#S exps = dq.inx.experiment.label.keys()
710728

711729
# Go through a user supplied list if specified
712730
variables = []

source/pyconform/miptableparser.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,16 +371,23 @@ def parse_table(self,exp,mips,tables,v_list,table_var_fields,table_axes_fields,t
371371
# Get a list of mips for the experiment
372372
# print sorted(dq.inx.experiment.label.keys()),len(dq.inx.experiment.label.keys())
373373
e_mip = []
374-
e_id = dq.inx.experiment.label[exp]
374+
if '--ALL--' in exp:
375+
e_id = dq.inx.experiment.label['historical']
376+
else:
377+
e_id = dq.inx.experiment.label[exp]
375378
if len(e_id)==0:
376-
print '\033[91m','Invalid experiment name. Please choose from the folowing options:','\033[0m'
379+
# print '\033[91m','Invalid experiment name. Please choose from the folowing options:','\033[0m'
380+
# print sorted(dq.inx.experiment.label.keys()),len(dq.inx.experiment.label.keys())
381+
# return {}
382+
print '\033[91m','This experiment name is not registered within the data request.','\033[0m'
383+
print '\033[91m','Using a generic exp name instead. If you think this name should be registered, verify the name is correct from the list below.','\033[0m'
377384
print sorted(dq.inx.experiment.label.keys()),len(dq.inx.experiment.label.keys())
378-
return {}
385+
e_id = dq.inx.experiment.label['historical']
379386
activity_id = dq.inx.uid[e_id[0]].mip
380387

381388
e_vars =[]
389+
activity_id = dq.inx.uid[e_id[0]].mip
382390
e_vars.append(dq.inx.iref_by_sect[e_id[0]].a)
383-
#if len(e_vars['requestItem']) == 0:
384391
e_vars.append(dq.inx.iref_by_sect[dq.inx.uid[e_id[0]].egid].a)
385392
e_vars.append(dq.inx.iref_by_sect[activity_id].a)
386393
total_request = {}
@@ -389,18 +396,20 @@ def parse_table(self,exp,mips,tables,v_list,table_var_fields,table_axes_fields,t
389396

390397
table_info = {}
391398
dr = dq.inx.uid[ri]
392-
if dr.mip in mips or '--ALL--' in mips:
399+
400+
if dr.mip in mips or '--ALL--' in mips or '--ALL--' in exp:
393401

394402
table_dict = {}
395403
variables = {}
396404
axes = {}
397405
table_info = {}
398406
data = {}
399-
400-
table_info['experiment'] = dq.inx.uid[e_id[0]].title
401-
table_info['experiment_id'] = exp
407+
402408
table_info['data_specs_version'] = dreq.version
403-
table_info['activity_id'] = activity_id
409+
if '--ALL--' not in exp:
410+
table_info['experiment'] = dq.inx.uid[e_id[0]].title
411+
table_info['experiment_id'] = exp
412+
table_info['activity_id'] = activity_id
404413

405414

406415
rl = dq.inx.requestLink.uid[dr.rlid]
@@ -409,7 +418,7 @@ def parse_table(self,exp,mips,tables,v_list,table_var_fields,table_axes_fields,t
409418
axes_list = []
410419
var_list = []
411420
if len(v_list) == 0:
412-
var_list = vars['requestVar']
421+
var_list = vars['requestVar']
413422
else:
414423
# Make a list of all cmip vars and their id's
415424
all_vars = {}
@@ -633,6 +642,5 @@ def parse_table(self,exp,mips,tables,v_list,table_var_fields,table_axes_fields,t
633642
#for k in sorted(total_request.keys()):
634643
# v = total_request[k]
635644
# print k, len(v['variables'])
636-
637645
return total_request
638646

0 commit comments

Comments
 (0)