diff --git a/.all-contributorsrc.json b/.all-contributorsrc.json new file mode 100644 index 000000000..fe0787249 --- /dev/null +++ b/.all-contributorsrc.json @@ -0,0 +1,23 @@ +{ + "projectName": "all-contributors", + "projectOwner": "all-contributors", + "repoType": "github", + "repoHost": "https://github.com", + "files": ["CONTRIBUTORS.md"], + "imageSize": 100, + "commit": false, + "contributorsPerLine": 7, + "contributorsSortAlphabetically": false, + "badgeTemplate": "[![All Contributors](https://img.shields.io/badge/all_contributors-<%= contributors.length %>-orange.svg?style=flat-square)](#contributors)", + "contributorTemplate": "\">\" width=\"<%= options.imageSize %>px;\" alt=\"\"/>
<%= contributor.name %>
", + "types": { + "custom": { + "symbol": "🔭", + "description": "A custom contribution type.", + "link": "[<%= symbol %>](<%= url %> \"<%= description %>\")," + } + }, + "linkToUsage": true, + "skipCi": true, + "contributors": [] +} diff --git a/.github/workflows/docker-build-push-aws.yml b/.github/workflows/docker-build-push-aws.yml new file mode 100644 index 000000000..3f400a384 --- /dev/null +++ b/.github/workflows/docker-build-push-aws.yml @@ -0,0 +1,53 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Build and push image to Amazon ECR. + +on: + pull_request: + branches: + - main + +env: + AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1 + ECR_REPOSITORY: mdtf/mdtf-test # set this to your Amazon ECR repository name + ECS_SERVICE: custom-service # MY_ECS_SERVICE set this to your Amazon ECS service name + ECS_CLUSTER: mdtf-east1 # MY_ECS_CLUSTER set this to your Amazon ECS cluster name + ECS_TASK_DEFINITION: ecs-task-defn.json # set this to the path to your Amazon ECS task definition + # file, e.g. .aws/task-definition.json + CONTAINER_NAME: mdtf-test-a1r # set this to the name of the container in the + # containerDefinitions section of your task definition MY_CONTAINER_NAME + +jobs: + deploy: + name: push-to-public-ecr-cache-test + runs-on: ubuntu-latest + environment: dev + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Build, tag, and push image to Amazon ECR + id: build-image + uses: aradhakrishnanGFDL/docker-build-with-cache-action@master #support-aws-ecr-public + env: + ECR_REGISTRY: public.ecr.aws + IMAGE_TAG: "latest" + ECS_IMAGE: $ECR_REGISTRY/ECR_REPOSITORY:$env.IMAGE_TAG + with: + registry: public.ecr.aws + username: "${{ secrets.AWS_ACCESS_KEY_ID }}" + password: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + image_name: c6h4h4s8/mdtf/mdtf-test + push_image_and_stages: true + image_tag: latest diff --git a/.github/workflows/docker-run-test.yml b/.github/workflows/docker-run-test.yml new file mode 100644 index 000000000..dfddcb24c --- /dev/null +++ b/.github/workflows/docker-run-test.yml @@ -0,0 +1,18 @@ +name: docker-run-minitest1 +on: + pull_request: + branches: [ main ] +jobs: + container-test-job: + runs-on: ubuntu-latest + container: + image: public.ecr.aws/c6h4h4s8/mdtf/mdtf-test:latest + env: + NODE_ENV: development + options: --cpus 1 + steps: + - name: Check PATH + run: (echo $PATH) || (echo "No path") + - name: Activate environment + shell: bash + run: (eval "$(micromamba shell hook -s bash -p ~/conda)"; micromamba activate; micromamba activate _MDTF_base;mdtf_framework.py --version) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..b60094fd0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,69 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Deploy to ECS. Build, push image, + +on: + pull_request: + branches: + - main + +env: + AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1 + ECR_REPOSITORY: mdtf/mdtf-test # set this to your Amazon ECR repository name + ECS_SERVICE: custom-service # MY_ECS_SERVICE set this to your Amazon ECS service name + ECS_CLUSTER: mdtf-east1 # MY_ECS_CLUSTER set this to your Amazon ECS cluster name + ECS_TASK_DEFINITION: ecs-task-defn.json # set this to the path to your Amazon ECS task definition + # file, e.g. .aws/task-definition.json + CONTAINER_NAME: mdtf-test-a1r # set this to the name of the container in the + # containerDefinitions section of your task definition MY_CONTAINER_NAME + +jobs: + deploy: + name: push-to-public-ecr-cache-test + runs-on: ubuntu-latest + environment: dev + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Build, tag, and push image to Amazon ECR + id: build-image + uses: aradhakrishnanGFDL/docker-build-with-cache-action@master #support-aws-ecr-public + env: + ECR_REGISTRY: public.ecr.aws + IMAGE_TAG: "latest" + ECS_IMAGE: $ECR_REGISTRY/ECR_REPOSITORY:$env.IMAGE_TAG + with: + registry: public.ecr.aws + username: "${{ secrets.AWS_ACCESS_KEY_ID }}" + password: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" + image_name: c6h4h4s8/mdtf/mdtf-test + push_image_and_stages: true + image_tag: latest + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@97587c9d45a4930bf0e3da8dd2feb2a463cf4a3a + with: + task-definition: ${{ env.ECS_TASK_DEFINITION }} + container-name: ${{ env.CONTAINER_NAME }} + image: public.ecr.aws/c6h4h4s8/mdtf/mdtf-test:latest + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1.4.10 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ env.ECS_SERVICE }} + cluster: ${{ env.ECS_CLUSTER }} + wait-for-service-stability: true diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..f02300cd7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,107 @@ +## Code of Conduct + +Model Diagnostics Task Force framework team is dedicated to providing a respectful and inclusive community for everyone. We do not tolerate harassment or bullying of any community member in any form. This applies equally to all community members regardless of their title, seniority, background, gender, etc., in all forums managed by the MDTF framework team. This includes the mailing lists, our GitHub project space, slack workspaces, in-person events, and any other forums created by the project team. In addition, violations of this code outside these spaces may affect a person's ability to participate within them. As part of the code of conduct policy, we will provide below ground rules for all forums (e.g meetings) created by the project team, supporting project initiatives. + +## General code of conduct + +Our code of conduct policy for the project community members emphasizes on the following key ground rules: + +1. Respect everyone's opinion and privacy. +2. Every opinion has value. +3. Listen attentively to everyone's point of view. + +Furthermore, our community members are expected to adhere to the following: + +* **1. Be friendly, patient, and welcoming**. + We strive to be a community that welcomes and supports + people of all backgrounds and identities. This includes, but is not limited + to, members of any race, ethnicity, culture, national origin, color, + immigration status, social and economic class, educational level, sex, sexual + orientation, gender identity and expression, age, physical appearance, family + status, technological or professional choices, academic + discipline, religion, mental ability, and physical ability. + +* **2. Be considerate and respectful**. + Your work will be used by other people, and you in turn + will depend on the work of others. Any decision you take will affect users + and colleagues, and you should take those consequences into account when + making decisions. + Remember that we're a growing community with diverse members, and that you may be + communicating with someone with a different primary language or cultural + background. Not all of us will agree all the time, but disagreement is + no excuse for poor behavior or poor manners. + Do not insult or put down other community members. A community where people + feel uncomfortable or threatened is not a productive one. + + +* **3. Consider Impact vs. Intent**. + Disagreements, both social and + technical, happen all the time and Pangeo is no exception. + People perceive their own behaviors very differently than others perceive them. + What motivates one person may cause stress for another. + A few steps worth remembering include the following: + + * Other people do not see things the same way you do, + do not feel the same as you, or interpret the world the way you do. + Consider different people’s perspectives on things like change, + drive, structure, process, big picture, and small details. + * Ask for feedback and listen to them. + * Blaming each other doesn’t get us anywhere, while we can learn from mistakes to find better solutions. + +* **4. Moderate your expectations**. + Please respect that community members choose + how they spend their time in the project. A thoughtful question about your + expectations is preferable to demands for another person's time. + +* **5. A simple apology can go a long way**. + It can often de-escalate a situation, + and telling someone that you are sorry is an act of empathy that doesn’t + automatically imply an admission of guilt. + +* **6. Give due credit and avoid miscredit**. + +Motivate yourself and your community by acknowledging and giving credit to the original source, be it an individual-or-group, data-or-code, an inception of an idea, and so on, in different project forums. Discourage miscredit to foster a welcoming, inclusive environment. +We strive for the highest standards of scientific integrity. This includes sharing ideas and information, keeping accurate and complete records, and giving due credit to the contributions of others. Undisclosed conflicts of interest and scientific misconduct, including fabrication, falsification, and plagiarism, are incompatible with this code. + + +## Forms of harrassment + +We do not tolerate harassment or bullying of any community member in any form. +Forms of harrassment include, but is not limited to: + + * Violent threats or violent language directed against another person + * Discriminatory jokes and language + * Posting sexually explicit or violent material + * Posting (or threatening to post) other people's personally identifying + information ("doxing") + * Personal insults, especially those related to gender, + gender identity and expression, sexual orientation, ability, + physical appearance, body size, race, ethnicity, + religion, socioeconomic status, caste or creed + * Unwelcome sexual attention, stalking; + * Advocating for, or encouraging, any of the above behavior + * Repeated harassment of others. In general, if someone asks you to stop, + then stop + + +## How to Report Harassment and Discrimination + +TBA + +## Review + +This code of conduct document will be reviewed periodically annually by the Model Diagnostics Task Force leads team members. + +## Your contributions + +Our community values every contribution to this open-source repository. Please follow the contributorship guidelines [in the works] to see how you can contribute. +We encourage you to pitch in and join our growing community! + +### References + +This Code of Conduct has been adapted from: + * the [*Jupyter*](https://jupyter.org/governance/conduct/code_of_conduct.html) Project, licensed under a [*Creative Commons + Attribution*](http://creativecommons.org/licenses/by/3.0/) license. + * Pangeo (https://github.com/pangeo-data/.github/blob/main/CODE_OF_CONDUCT.md) + * The chemical professionals code of conduct (https://www.acs.org/content/acs/en/careers/career-services/ethics/the-chemical-professionals-code-of-conduct.html) +We are grateful to these projects for contributing these materials for us to easily reuse. diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 000000000..b6a2be898 --- /dev/null +++ b/CONTRIBUTORS.md @@ -0,0 +1,10 @@ +## Contributors + + + + + + + + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..f0db5afac --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +# Base OS +FROM ubuntu:latest +FROM mambaorg/micromamba:latest as micromamba + +#micromamba set up + +USER root + +RUN micromamba info + + +RUN micromamba shell hook --shell bash +#RUN micromamba create -f /proj/MDTF-diagnostics/src/conda/env_base.yml + +## +# Container Metadata +LABEL maintainer="20195932+wrongkindofdoctor@users.noreply.github.com" +LABEL version="alpha-01" +LABEL description="This is a docker image for the MDTF-diagnostics package" +# Disable Prompt During Packages Installation +#ARG DEBIAN_FRONTEND=noninteractive + +# Copy the MDTF-diagnostics package contents from local machine to image +ENV CODE_ROOT=/proj/MDTF-diagnostics +COPY src ${CODE_ROOT}/src +COPY data ${CODE_ROOT}/data +#COPY diagnostics ${CODE_ROOT}/diagnostics +COPY mdtf_framework.py ${CODE_ROOT} +COPY shared ${CODE_ROOT}/shared +COPY sites ${CODE_ROOT}/sites +COPY tests ${CODE_ROOT}/tests +# Install conda environments +ENV CONDA_ROOT=/opt/conda/ +ENV CONDA_ENV_DIR=/opt/conda/envs + +#USER mambauser +RUN micromamba create -f /proj/MDTF-diagnostics/src/conda/env_base.yml + +ENV PATH="${PATH}:/proj/MDTF-diagnostics/" +#cRUN micromamba activate _MDTF_base +# Verify installation +#RUN /proj/MDTF-diagnostics/mdtf_framework.py --help +# Run mdtf on src/default_tests.jsonc +# CMD ["${CODE_ROOT}/mdtf", "-f","${CODE_ROOT}/src/default_tests.jsonc"] +#ENTRYPOINT ["micromamba activate _MDTF_base"] +CMD ["/bin/bash"] diff --git a/README.md b/README.md index 651ed4725..df8f13077 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # MDTF-diagnostics: A Portable Framework for Weather and Climate Model Data Analysis -[![Documentation Status](https://readthedocs.org/projects/mdtf-diagnostics/badge/?version=latest)](https://mdtf-diagnostics.readthedocs.io/en/latest/?badge=latest) [![Build Status](https://travis-ci.com/NOAA-GFDL/MDTF-diagnostics.svg?branch=main)](https://travis-ci.com/NOAA-GFDL/MDTF-diagnostics) [![Total alerts](https://img.shields.io/lgtm/alerts/g/NOAA-GFDL/MDTF-diagnostics.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/NOAA-GFDL/MDTF-diagnostics/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/NOAA-GFDL/MDTF-diagnostics.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/NOAA-GFDL/MDTF-diagnostics/context:python) +[![Documentation Status](https://readthedocs.org/projects/mdtf-diagnostics/badge/?version=latest)](https://mdtf-diagnostics.readthedocs.io/en/latest/?badge=latest) [![Build Status](https://travis-ci.com/NOAA-GFDL/MDTF-diagnostics.svg?branch=main)](https://travis-ci.com/NOAA-GFDL/MDTF-diagnostics) [![Total alerts](https://img.shields.io/lgtm/alerts/g/NOAA-GFDL/MDTF-diagnostics.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/NOAA-GFDL/MDTF-diagnostics/alerts/) [![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/NOAA-GFDL/MDTF-diagnostics.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/NOAA-GFDL/MDTF-diagnostics/context:python)[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors) + + The MDTF-diagnostics package is a portable framework for running process-oriented diagnostics (PODs) on weather and climate model data. @@ -201,3 +203,8 @@ E. D. Maloney et al. (2019): Process-Oriented Evaluation of Climate and Weather ## Disclaimer This repository is a scientific product and is not an official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA GitHub project code is provided on an ‘as is’ basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this GitHub project will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government. + + +This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! + + diff --git a/contributing.md b/contributing.md new file mode 100644 index 000000000..51893e1bf --- /dev/null +++ b/contributing.md @@ -0,0 +1,78 @@ + +## How to contribute to MDTF framework + +#### Did you find a bug? + +* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/NOAA-GFDL/MDTF-diagnostics/issues?q=is%3Aissue+is%3Aopen). + +* If you're unable to find an open issue addressing the problem, [open a new one]([](https://github.com/NOAA-GFDL/MDTF-diagnostics/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. + +* If relevant, use the bug report template that appears by default when you open a new issue. + +#### Did you write a patch that fixes a bug? + +* Open a new GitHub pull request with the patch. + +* Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable. + +* Before submitting, please read the [best practices](https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx/dev_coding_tips.html?highlight=coding) guide to know more about coding conventions. Please note that this is a work in progress to set up best practices. +* Open a new issue to provide suggested changes to the best practices. + +#### Did you fix whitespace, format code, or make a purely cosmetic patch + +Changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of MDTF will still need an issue and go through a review process. + +#### Do you intend to add a new feature or change an existing one? + +* Suggest your change in the [GitHub discussions](https://github.com/NOAA-GFDL/MDTF-diagnostics/discussions) and start writing code. + +* Do not open an issue on GitHub until you have collected positive feedback about the change. GitHub issues are primarily intended for bug reports and fixes. + +#### Do you have questions about the source code? + +* Ask any question about how to use MDTF in the [GitHub discussions](https://github.com/NOAA-GFDL/MDTF-diagnostics/discussions). +* Please do check out our [docs](https://mdtf-diagnostics.readthedocs.io/en/latest/) to make sure it's not addressed already. But, please know that it's okay to ask us questions! We may redirect you to existing documentations and gather feedback to improve documentation. + +#### Do you want to contribute to the MDTF documentation? + +* Please start a [GitHub discussions](https://github.com/NOAA-GFDL/MDTF-diagnostics/discussions). We would love your contribution in any form. + +#### Do you have a POD code submission that you'd like to contribute? + +* Please double check the [POD development checklist](https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx/dev_checklist.html?highlight=POD%20%20deve) +* Please check out this [cheatsheet](https://mdtf-diagnostics.readthedocs.io/en/latest/sphinx/dev_cheatsheet.html?highlight=cheatsheet) and start a PR! + +#### A word about code reviewers + +Our code reviewers are presently part of the MDTF framework leads team. Their contributions are valuable! + +#### How can I add myself to the contributors page? + +Thank you for pitching in! Please check [this](https://allcontributors.org/docs/en/bot/usage) out to see how you can add your name to the contributor list. It's just one important step away! + +Create an issue or a PR and just add this "@all-contributors add @your_github_handle for doc" + +Please note that it can be a doc, design, idea, review, tool, talk, code or any contribution, any size! +Refer to [categories](https://allcontributors.org/docs/en/emoji-key) to see available categories. If you don't see a relevant one, open an issue please. +Thanks! + +#### THANK YOU + +We encourage you to pitch in. Many thanks to our wonderful [contributors] + + +## Contributors + + + + + + + + + + + + +[![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors) + diff --git a/ecs-task-defn.json b/ecs-task-defn.json new file mode 100644 index 000000000..b8fefe348 --- /dev/null +++ b/ecs-task-defn.json @@ -0,0 +1,63 @@ +{ + "taskDefinitionArn": "arn:aws:ecs:us-east-1:430073024411:task-definition/mdtf-test-a1r:25", + "containerDefinitions": [ + { + "name": "mdtf-test-a1r", + "image": "public.ecr.aws/c6h4h4s8/mdtf/mdtf-test:latest", + "cpu": 0, + "portMappings": [], + "essential": true, + "environment": [], + "mountPoints": [], + "volumesFrom": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "/ecs/mdtf-test-a1r", + "awslogs-region": "us-east-1", + "awslogs-stream-prefix": "ecs" + } + } + } + ], + "family": "mdtf-test-a1r", + "taskRoleArn": "arn:aws:iam::430073024411:role/ecsTaskExecutionRole", + "executionRoleArn": "arn:aws:iam::430073024411:role/ecsTaskExecutionRole", + "networkMode": "awsvpc", + "revision": 25, + "volumes": [], + "status": "ACTIVE", + "requiresAttributes": [ + { + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "name": "ecs.capability.execution-role-awslogs" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, + { + "name": "com.amazonaws.ecs.capability.task-iam-role" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" + }, + { + "name": "ecs.capability.task-eni" + } + ], + "placementConstraints": [], + "compatibilities": [ + "EC2", + "FARGATE" + ], + "requiresCompatibilities": [ + "FARGATE" + ], + "cpu": "4096", + "memory": "8192", + "registeredAt": "2022-10-20T16:01:08.915Z", + "registeredBy": "arn:aws:iam::430073024411:user/a1r", + "tags": [] +}